[Lldb-commits] [lldb] r136886 - /lldb/trunk/source/API/SBValue.cpp

Enrico Granata granata.enrico at gmail.com
Thu Aug 4 10:07:02 PDT 2011


Author: enrico
Date: Thu Aug  4 12:07:02 2011
New Revision: 136886

URL: http://llvm.org/viewvc/llvm-project?rev=136886&view=rev
Log:
more logical behavior for SBValue::CreateValueFromAddress

Modified:
    lldb/trunk/source/API/SBValue.cpp

Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=136886&r1=136885&r2=136886&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Thu Aug  4 12:07:02 2011
@@ -448,16 +448,24 @@
         
         lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
         
-        ValueObjectSP result_valobj_sp(ValueObjectConstResult::Create(m_opaque_sp->GetUpdatePoint().GetExecutionContextScope(),
-                                                                      real_type.m_opaque_sp->GetASTContext(),
-                                                                      real_type.m_opaque_sp->GetOpaqueQualType(),
-                                                                      ConstString(name),
-                                                                      buffer,
-                                                                      lldb::endian::InlHostByteOrder(), 
-                                                                      GetTarget().GetProcess().GetAddressByteSize()));
+        ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create(m_opaque_sp->GetUpdatePoint().GetExecutionContextScope(),
+                                                                          real_type.m_opaque_sp->GetASTContext(),
+                                                                          real_type.m_opaque_sp->GetOpaqueQualType(),
+                                                                          ConstString(name),
+                                                                          buffer,
+                                                                          lldb::endian::InlHostByteOrder(), 
+                                                                          GetTarget().GetProcess().GetAddressByteSize()));
         
-        result_valobj_sp->SetName(ConstString(name));
-        result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
+        ValueObjectSP result_valobj_sp;
+        
+        ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
+        if (ptr_result_valobj_sp)
+        {
+            Error err;
+            result_valobj_sp = ptr_result_valobj_sp->Dereference(err);
+            if (result_valobj_sp)
+                result_valobj_sp->SetName(ConstString(name));
+        }
         result = SBValue(result_valobj_sp);
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));





More information about the lldb-commits mailing list