summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/ValueObjectChild.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-11-02 01:50:16 +0000
committerGreg Clayton <gclayton@apple.com>2010-11-02 01:50:16 +0000
commit7c8a966442a2c70e0017a6497b0db353c3164523 (patch)
tree614405a869aed05c3780b027ae5e19fbb3a44d34 /lldb/source/Core/ValueObjectChild.cpp
parent07072664c4c24d10b9563ec8293a902c4882398b (diff)
downloadbcm5719-llvm-7c8a966442a2c70e0017a6497b0db353c3164523.tar.gz
bcm5719-llvm-7c8a966442a2c70e0017a6497b0db353c3164523.zip
Print better error messages when memory reads fail when displaying variable
values. Always show the variable types for the top level items when dumping program variables. llvm-svn: 117999
Diffstat (limited to 'lldb/source/Core/ValueObjectChild.cpp')
-rw-r--r--lldb/source/Core/ValueObjectChild.cpp46
1 files changed, 33 insertions, 13 deletions
diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp
index 554646b8f86..a0f238c1231 100644
--- a/lldb/source/Core/ValueObjectChild.cpp
+++ b/lldb/source/Core/ValueObjectChild.cpp
@@ -146,13 +146,27 @@ ValueObjectChild::UpdateValue (ExecutionContextScope *exe_scope)
{
uint32_t offset = 0;
m_value.GetScalar() = parent->GetDataExtractor().GetPointer(&offset);
- // For pointers, m_byte_offset should only ever be set if we
- // ValueObject::GetSyntheticArrayMemberFromPointer() was called
- if (ClangASTContext::IsPointerType (parent->GetClangType()) && m_byte_offset)
- m_value.GetScalar() += m_byte_offset;
- if (value_type == Value::eValueTypeScalar ||
- value_type == Value::eValueTypeFileAddress)
- m_value.SetValueType (Value::eValueTypeLoadAddress);
+
+ lldb::addr_t addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
+
+ if (addr == LLDB_INVALID_ADDRESS)
+ {
+ m_error.SetErrorString ("parent address is invalid.");
+ }
+ else if (addr == 0)
+ {
+ m_error.SetErrorString ("parent is NULL");
+ }
+ else
+ {
+ // For pointers, m_byte_offset should only ever be set if we
+ // ValueObject::GetSyntheticArrayMemberFromPointer() was called
+ if (ClangASTContext::IsPointerType (parent->GetClangType()) && m_byte_offset)
+ m_value.GetScalar() += m_byte_offset;
+ if (value_type == Value::eValueTypeScalar ||
+ value_type == Value::eValueTypeFileAddress)
+ m_value.SetValueType (Value::eValueTypeLoadAddress);
+ }
}
else
{
@@ -163,14 +177,20 @@ ValueObjectChild::UpdateValue (ExecutionContextScope *exe_scope)
case Value::eValueTypeHostAddress:
{
lldb::addr_t addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
- if (addr == LLDB_INVALID_ADDRESS || addr == 0)
+ if (addr == LLDB_INVALID_ADDRESS)
+ {
+ m_error.SetErrorString ("parent address is invalid.");
+ }
+ else if (addr == 0)
+ {
+ m_error.SetErrorString ("parent is NULL");
+ }
+ else
{
- m_error.SetErrorStringWithFormat("Parent address is invalid: 0x%llx.\n", addr);
- break;
+ // Set this object's scalar value to the address of its
+ // value be adding its byte offset to the parent address
+ m_value.GetScalar() += GetByteOffset();
}
- // Set this object's scalar value to the address of its
- // value be adding its byte offset to the parent address
- m_value.GetScalar() += GetByteOffset();
}
break;
OpenPOWER on IntegriCloud