more logical behavior for SBValue::CreateValueFromAddress
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136886 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index 8201211..073ea20 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -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));