This revision was automatically updated to reflect the committed changes.
Closed by commit rL262014: Add support for DW_OP_push_object_address in dwarf 
expressions (authored by tberghammer).

Changed prior to commit:
  http://reviews.llvm.org/D17604?vs=49047&id=49179#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17604

Files:
  lldb/trunk/include/lldb/Expression/DWARFExpression.h
  lldb/trunk/source/Core/ValueObjectVariable.cpp
  lldb/trunk/source/Expression/DWARFExpression.cpp
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/trunk/source/Target/StackFrame.cpp

Index: lldb/trunk/source/Core/ValueObjectVariable.cpp
===================================================================
--- lldb/trunk/source/Core/ValueObjectVariable.cpp
+++ lldb/trunk/source/Core/ValueObjectVariable.cpp
@@ -164,7 +164,15 @@
                 loclist_base_load_addr = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (target);
         }
         Value old_value(m_value);
-        if (expr.Evaluate (&exe_ctx, NULL, NULL, NULL, loclist_base_load_addr, NULL, m_value, &m_error))
+        if (expr.Evaluate (&exe_ctx,
+                           nullptr,
+                           nullptr,
+                           nullptr,
+                           loclist_base_load_addr,
+                           nullptr,
+                           nullptr,
+                           m_value,
+                           &m_error))
         {
             m_resolved_value = m_value;
             m_value.SetContext(Value::eContextTypeVariable, variable);
Index: lldb/trunk/source/Target/StackFrame.cpp
===================================================================
--- lldb/trunk/source/Target/StackFrame.cpp
+++ lldb/trunk/source/Target/StackFrame.cpp
@@ -1221,8 +1221,15 @@
             if (m_sc.function->GetFrameBaseExpression().IsLocationList())
                 loclist_base_addr = m_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (exe_ctx.GetTargetPtr());
 
-            if (!m_sc.function->GetFrameBaseExpression().Evaluate(&exe_ctx, nullptr, nullptr, nullptr, loclist_base_addr,
-                                                                  nullptr, expr_value, &m_frame_base_error))
+            if (m_sc.function->GetFrameBaseExpression().Evaluate(&exe_ctx,
+                                                                 nullptr,
+                                                                 nullptr,
+                                                                 nullptr,
+                                                                 loclist_base_addr,
+                                                                 nullptr,
+                                                                 nullptr,
+                                                                 expr_value,
+                                                                 &m_frame_base_error) == false)
             {
                 // We should really have an error if evaluate returns, but in case
                 // we don't, lets set the error to something at least.
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1063,7 +1063,6 @@
         if (cu_die)
         {
             const char * cu_comp_dir = resolveCompDir(cu_die.GetAttributeValueAsString(DW_AT_comp_dir, nullptr));
-
             const dw_offset_t stmt_list = cu_die.GetAttributeValueAsUnsigned(DW_AT_stmt_list, DW_INVALID_OFFSET);
             if (stmt_list != DW_INVALID_OFFSET)
             {
@@ -1832,7 +1831,7 @@
                                 const DWARFExpression &location = var_sp->LocationExpression();
                                 Value location_result;
                                 Error error;
-                                if (location.Evaluate(NULL, NULL, NULL, LLDB_INVALID_ADDRESS, NULL, location_result, &error))
+                                if (location.Evaluate(nullptr, nullptr, nullptr, LLDB_INVALID_ADDRESS, nullptr, nullptr, location_result, &error))
                                 {
                                     if (location_result.GetValueType() == Value::eValueTypeFileAddress)
                                     {
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
===================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
@@ -715,7 +715,7 @@
                                                                       NULL, // RegisterContext *
                                                                       module_sp, debug_info_data, die.GetCU(),
                                                                       block_offset, block_length, eRegisterKindDWARF,
-                                                                      &initialValue, memberOffset, NULL))
+                                                                      &initialValue, NULL, memberOffset, NULL))
                                         {
                                             member_byte_offset = memberOffset.ResolveValue(NULL).UInt();
                                         }
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2703,19 +2703,20 @@
                                         const DWARFDataExtractor& debug_info_data = die.GetDWARF()->get_debug_info_data();
                                         uint32_t block_length = form_value.Unsigned();
                                         uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart();
-                                        if (DWARFExpression::Evaluate(NULL, // ExecutionContext *
-                                                                      NULL, // ClangExpressionVariableList *
-                                                                      NULL, // ClangExpressionDeclMap *
-                                                                      NULL, // RegisterContext *
+                                        if (DWARFExpression::Evaluate(nullptr, // ExecutionContext *
+                                                                      nullptr, // ClangExpressionVariableList *
+                                                                      nullptr, // ClangExpressionDeclMap *
+                                                                      nullptr, // RegisterContext *
                                                                       module_sp,
                                                                       debug_info_data,
                                                                       die.GetCU(),
                                                                       block_offset,
                                                                       block_length,
                                                                       eRegisterKindDWARF,
                                                                       &initialValue,
+                                                                      nullptr,
                                                                       memberOffset,
-                                                                      NULL))
+                                                                      nullptr))
                                         {
                                             member_byte_offset = memberOffset.ResolveValue(NULL).UInt();
                                         }
@@ -3129,19 +3130,20 @@
                                         const DWARFDataExtractor& debug_info_data = die.GetDWARF()->get_debug_info_data();
                                         uint32_t block_length = form_value.Unsigned();
                                         uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart();
-                                        if (DWARFExpression::Evaluate (NULL,
-                                                                       NULL,
-                                                                       NULL,
-                                                                       NULL,
+                                        if (DWARFExpression::Evaluate (nullptr,
+                                                                       nullptr,
+                                                                       nullptr,
+                                                                       nullptr,
                                                                        module_sp,
                                                                        debug_info_data,
                                                                        die.GetCU(),
                                                                        block_offset,
                                                                        block_length,
                                                                        eRegisterKindDWARF,
                                                                        &initialValue,
+                                                                       nullptr,
                                                                        memberOffset,
-                                                                       NULL))
+                                                                       nullptr))
                                         {
                                             member_byte_offset = memberOffset.ResolveValue(NULL).UInt();
                                         }
Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
===================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -1536,7 +1536,7 @@
         dwarfexpr.SetRegisterKind (unwindplan_registerkind);
         Value result;
         Error error;
-        if (dwarfexpr.Evaluate (&exe_ctx, NULL, NULL, this, 0, NULL, result, &error))
+        if (dwarfexpr.Evaluate (&exe_ctx, nullptr, nullptr, this, 0, nullptr, nullptr, result, &error))
         {
             addr_t val;
             val = result.GetScalar().ULongLong();
@@ -1836,7 +1836,7 @@
             dwarfexpr.SetRegisterKind (row_register_kind);
             Value result;
             Error error;
-            if (dwarfexpr.Evaluate (&exe_ctx, NULL, NULL, this, 0, NULL, result, &error))
+            if (dwarfexpr.Evaluate (&exe_ctx, nullptr, nullptr, this, 0, nullptr, nullptr, result, &error))
             {
                 cfa_value = result.GetScalar().ULongLong();
 
Index: lldb/trunk/source/Expression/DWARFExpression.cpp
===================================================================
--- lldb/trunk/source/Expression/DWARFExpression.cpp
+++ lldb/trunk/source/Expression/DWARFExpression.cpp
@@ -1108,12 +1108,21 @@
     ClangExpressionDeclMap *decl_map,
     lldb::addr_t loclist_base_load_addr,
     const Value* initial_value_ptr,
+    const Value* object_address_ptr,
     Value& result,
     Error *error_ptr
 ) const
 {
     ExecutionContext exe_ctx (exe_scope);
-    return Evaluate(&exe_ctx, expr_locals, decl_map, NULL, loclist_base_load_addr, initial_value_ptr, result, error_ptr);
+    return Evaluate(&exe_ctx,
+                    expr_locals,
+                    decl_map,
+                    nullptr,
+                    loclist_base_load_addr,
+                    initial_value_ptr,
+                    object_address_ptr,
+                    result,
+                    error_ptr);
 }
 
 bool
@@ -1125,6 +1134,7 @@
     RegisterContext *reg_ctx,
     lldb::addr_t loclist_base_load_addr,
     const Value* initial_value_ptr,
+    const Value* object_address_ptr,
     Value& result,
     Error *error_ptr
 ) const
@@ -1189,6 +1199,7 @@
                                                       length,
                                                       m_reg_kind,
                                                       initial_value_ptr,
+                                                      object_address_ptr,
                                                       result,
                                                       error_ptr);
                 }
@@ -1212,6 +1223,7 @@
                                       m_data.GetByteSize(),
                                       m_reg_kind,
                                       initial_value_ptr,
+                                      object_address_ptr,
                                       result,
                                       error_ptr);
 }
@@ -1232,6 +1244,7 @@
     const lldb::offset_t opcodes_length,
     const lldb::RegisterKind reg_kind,
     const Value* initial_value_ptr,
+    const Value* object_address_ptr,
     Value& result,
     Error *error_ptr
 )
@@ -1367,6 +1380,7 @@
                         intptr_t ptr;
                         ::memcpy (&ptr, src, sizeof(void *));
                         stack.back().GetScalar() = ptr;
+                        stack.back().SetValueType(Value::eValueTypeScalar);
                         stack.back().ClearContext();
                     }
                     break;
@@ -1381,6 +1395,7 @@
                             if (pointer_value != LLDB_INVALID_ADDRESS)
                             {
                                 stack.back().GetScalar() = pointer_value;
+                                stack.back().SetValueType(Value::eValueTypeScalar);
                                 stack.back().ClearContext();
                             }
                             else
@@ -1462,6 +1477,7 @@
                             default: break;
                         }
                         stack.back().GetScalar() = ptr;
+                        stack.back().SetValueType(Value::eValueTypeScalar);
                         stack.back().ClearContext();
                     }
                     break;
@@ -1485,6 +1501,7 @@
                                     case 8: stack.back().GetScalar() = addr_data.GetU64(&addr_data_offset); break;
                                     default: stack.back().GetScalar() = addr_data.GetPointer(&addr_data_offset);
                                 }
+                                stack.back().SetValueType(Value::eValueTypeScalar);
                                 stack.back().ClearContext();
                             }
                             else
@@ -2689,9 +2706,15 @@
         // during user expression evaluation.
         //----------------------------------------------------------------------
         case DW_OP_push_object_address:
-            if (error_ptr)
-                error_ptr->SetErrorString ("Unimplemented opcode DW_OP_push_object_address.");
-            return false;
+            if (object_address_ptr)
+                stack.push_back(*object_address_ptr);
+            else
+            {
+                if (error_ptr)
+                    error_ptr->SetErrorString ("DW_OP_push_object_address used without specifying an object address");
+                return false;
+            }
+            break;
 
         //----------------------------------------------------------------------
         // OPCODE: DW_OP_call2
Index: lldb/trunk/include/lldb/Expression/DWARFExpression.h
===================================================================
--- lldb/trunk/include/lldb/Expression/DWARFExpression.h
+++ lldb/trunk/include/lldb/Expression/DWARFExpression.h
@@ -282,6 +282,7 @@
               ClangExpressionDeclMap *decl_map,
               lldb::addr_t loclist_base_load_addr,
               const Value* initial_value_ptr,
+              const Value* object_address_ptr,
               Value& result,
               Error *error_ptr) const;
 
@@ -296,6 +297,7 @@
               RegisterContext *reg_ctx,
               lldb::addr_t loclist_base_load_addr,
               const Value* initial_value_ptr,
+              const Value* object_address_ptr,
               Value& result,
               Error *error_ptr) const;
 
@@ -370,6 +372,7 @@
               const lldb::offset_t length,
               const lldb::RegisterKind reg_set,
               const Value* initial_value_ptr,
+              const Value* object_address_ptr,
               Value& result,
               Error *error_ptr);
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to