summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Core')
-rw-r--r--lldb/source/Core/DataExtractor.cpp17
-rw-r--r--lldb/source/Core/Error.cpp1
-rw-r--r--lldb/source/Core/ValueObject.cpp23
-rw-r--r--lldb/source/Core/ValueObjectDynamicValue.cpp3
-rw-r--r--lldb/source/Core/ValueObjectVariable.cpp162
5 files changed, 123 insertions, 83 deletions
diff --git a/lldb/source/Core/DataExtractor.cpp b/lldb/source/Core/DataExtractor.cpp
index 8ce7b8f3224..bc26c8645e1 100644
--- a/lldb/source/Core/DataExtractor.cpp
+++ b/lldb/source/Core/DataExtractor.cpp
@@ -127,6 +127,15 @@ DataExtractor::DataExtractor (const DataExtractor& data, uint32_t offset, uint32
}
}
+DataExtractor::DataExtractor (const DataExtractor& rhs) :
+ m_start (rhs.m_start),
+ m_end (rhs.m_end),
+ m_byte_order (rhs.m_byte_order),
+ m_addr_size (rhs.m_addr_size),
+ m_data_sp (rhs.m_data_sp)
+{
+}
+
//----------------------------------------------------------------------
// Assignment operator
//----------------------------------------------------------------------
@@ -135,11 +144,11 @@ DataExtractor::operator= (const DataExtractor& rhs)
{
if (this != &rhs)
{
- m_start = rhs.m_start;
- m_end = rhs.m_end;
- m_byte_order= rhs.m_byte_order;
+ m_start = rhs.m_start;
+ m_end = rhs.m_end;
+ m_byte_order = rhs.m_byte_order;
m_addr_size = rhs.m_addr_size;
- m_data_sp = rhs.m_data_sp;
+ m_data_sp = rhs.m_data_sp;
}
return *this;
}
diff --git a/lldb/source/Core/Error.cpp b/lldb/source/Core/Error.cpp
index 6614769f8a0..6e21fe7ee2b 100644
--- a/lldb/source/Core/Error.cpp
+++ b/lldb/source/Core/Error.cpp
@@ -302,7 +302,6 @@ Error::SetErrorString (const char *err_str)
if (Success())
SetErrorToGenericError();
m_string = err_str;
- m_string.append("\n");
}
else
m_string.clear();
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 10247db11e2..ee44876a0ec 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -690,7 +690,12 @@ ValueObject::GetValueAsCString ()
GetBitfieldBitOffset())) // Bitfield bit offset
m_value_str.swap(sstr.GetString());
else
+ {
+ m_error.SetErrorStringWithFormat ("unsufficient data for value (only %u of %u bytes available)",
+ m_data.GetByteSize(),
+ GetByteSize());
m_value_str.clear();
+ }
}
}
break;
@@ -953,7 +958,13 @@ ValueObject::IsIntegerType (bool &is_signed)
bool
ValueObject::IsPointerOrReferenceType ()
{
- return ClangASTContext::IsPointerOrReferenceType(GetClangType());
+ return ClangASTContext::IsPointerOrReferenceType (GetClangType());
+}
+
+bool
+ValueObject::IsPossibleCPlusPlusDynamicType ()
+{
+ return ClangASTContext::IsPossibleCPlusPlusDynamicType (GetClangAST (), GetClangType());
}
ValueObjectSP
@@ -1149,9 +1160,11 @@ ValueObject::DumpValueObject
bool flat_output
)
{
- if (valobj && valobj->UpdateValueIfNeeded ())
+ if (valobj)
{
- if (use_dynamic != lldb::eNoDynamicValues)
+ bool update_success = valobj->UpdateValueIfNeeded ();
+
+ if (update_success && use_dynamic != lldb::eNoDynamicValues)
{
ValueObject *dynamic_value = valobj->GetDynamicValue(use_dynamic).get();
if (dynamic_value)
@@ -1196,7 +1209,7 @@ ValueObject::DumpValueObject
if (!scope_already_checked && !valobj->IsInScope())
{
- err_cstr = "error: out of scope";
+ err_cstr = "out of scope";
}
}
@@ -1210,7 +1223,7 @@ ValueObject::DumpValueObject
if (err_cstr)
{
- s.Printf (" error: %s\n", err_cstr);
+ s.Printf (" <%s>\n", err_cstr);
}
else
{
diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp
index ee50d45433f..a8d48891ab3 100644
--- a/lldb/source/Core/ValueObjectDynamicValue.cpp
+++ b/lldb/source/Core/ValueObjectDynamicValue.cpp
@@ -120,6 +120,9 @@ ValueObjectDynamicValue::UpdateValue ()
if (!m_parent->UpdateValueIfNeeded())
{
+ // The dynamic value failed to get an error, pass the error along
+ if (m_error.Success() && m_parent->GetError().Fail())
+ m_error = m_parent->GetError();
return false;
}
diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp
index 882b7021f49..e2a281b7f95 100644
--- a/lldb/source/Core/ValueObjectVariable.cpp
+++ b/lldb/source/Core/ValueObjectVariable.cpp
@@ -88,7 +88,10 @@ ValueObjectVariable::GetClangAST ()
size_t
ValueObjectVariable::GetByteSize()
{
- return m_variable_sp->GetType()->GetByteSize();
+ Type *type = m_variable_sp->GetType();
+ if (type)
+ return type->GetByteSize();
+ return 0;
}
lldb::ValueType
@@ -107,96 +110,109 @@ ValueObjectVariable::UpdateValue ()
Variable *variable = m_variable_sp.get();
DWARFExpression &expr = variable->LocationExpression();
- lldb::addr_t loclist_base_load_addr = LLDB_INVALID_ADDRESS;
- ExecutionContext exe_ctx (GetExecutionContextScope());
- if (exe_ctx.target)
- {
- m_data.SetByteOrder(exe_ctx.target->GetArchitecture().GetByteOrder());
- m_data.SetAddressByteSize(exe_ctx.target->GetArchitecture().GetAddressByteSize());
- }
-
- if (expr.IsLocationList())
+ if (variable->GetLocationIsConstantValueData())
{
- SymbolContext sc;
- variable->CalculateSymbolContext (&sc);
- if (sc.function)
- loclist_base_load_addr = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (exe_ctx.target);
+ // expr doesn't contain DWARF bytes, it contains the constant variable
+ // value bytes themselves...
+ if (expr.GetExpressionData(m_data))
+ m_value.SetContext(Value::eContextTypeVariable, variable);
+ else
+ m_error.SetErrorString ("empty constant data");
}
- Value old_value(m_value);
- if (expr.Evaluate (&exe_ctx, GetClangAST(), NULL, NULL, NULL, loclist_base_load_addr, NULL, m_value, &m_error))
+ else
{
- m_value.SetContext(Value::eContextTypeVariable, variable);
-
- Value::ValueType value_type = m_value.GetValueType();
+ lldb::addr_t loclist_base_load_addr = LLDB_INVALID_ADDRESS;
+ ExecutionContext exe_ctx (GetExecutionContextScope());
+
+ if (exe_ctx.target)
+ {
+ m_data.SetByteOrder(exe_ctx.target->GetArchitecture().GetByteOrder());
+ m_data.SetAddressByteSize(exe_ctx.target->GetArchitecture().GetAddressByteSize());
+ }
- switch (value_type)
+ if (expr.IsLocationList())
{
- default:
- assert(!"Unhandled expression result value kind...");
- break;
-
- case Value::eValueTypeScalar:
- // The variable value is in the Scalar value inside the m_value.
- // We can point our m_data right to it.
- m_error = m_value.GetValueAsData (&exe_ctx, GetClangAST(), m_data, 0);
- break;
-
- case Value::eValueTypeFileAddress:
- case Value::eValueTypeLoadAddress:
- case Value::eValueTypeHostAddress:
- // The DWARF expression result was an address in the inferior
- // process. If this variable is an aggregate type, we just need
- // the address as the main value as all child variable objects
- // will rely upon this location and add an offset and then read
- // their own values as needed. If this variable is a simple
- // type, we read all data for it into m_data.
- // Make sure this type has a value before we try and read it
-
- // If we have a file address, convert it to a load address if we can.
- if (value_type == Value::eValueTypeFileAddress && exe_ctx.process)
+ SymbolContext sc;
+ variable->CalculateSymbolContext (&sc);
+ if (sc.function)
+ loclist_base_load_addr = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (exe_ctx.target);
+ }
+ Value old_value(m_value);
+ if (expr.Evaluate (&exe_ctx, GetClangAST(), NULL, NULL, NULL, loclist_base_load_addr, NULL, m_value, &m_error))
+ {
+ m_value.SetContext(Value::eContextTypeVariable, variable);
+
+ Value::ValueType value_type = m_value.GetValueType();
+
+ switch (value_type)
{
- lldb::addr_t file_addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
- if (file_addr != LLDB_INVALID_ADDRESS)
+ default:
+ assert(!"Unhandled expression result value kind...");
+ break;
+
+ case Value::eValueTypeScalar:
+ // The variable value is in the Scalar value inside the m_value.
+ // We can point our m_data right to it.
+ m_error = m_value.GetValueAsData (&exe_ctx, GetClangAST(), m_data, 0);
+ break;
+
+ case Value::eValueTypeFileAddress:
+ case Value::eValueTypeLoadAddress:
+ case Value::eValueTypeHostAddress:
+ // The DWARF expression result was an address in the inferior
+ // process. If this variable is an aggregate type, we just need
+ // the address as the main value as all child variable objects
+ // will rely upon this location and add an offset and then read
+ // their own values as needed. If this variable is a simple
+ // type, we read all data for it into m_data.
+ // Make sure this type has a value before we try and read it
+
+ // If we have a file address, convert it to a load address if we can.
+ if (value_type == Value::eValueTypeFileAddress && exe_ctx.process)
{
- SymbolContext var_sc;
- variable->CalculateSymbolContext(&var_sc);
- if (var_sc.module_sp)
+ lldb::addr_t file_addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
+ if (file_addr != LLDB_INVALID_ADDRESS)
{
- ObjectFile *objfile = var_sc.module_sp->GetObjectFile();
- if (objfile)
+ SymbolContext var_sc;
+ variable->CalculateSymbolContext(&var_sc);
+ if (var_sc.module_sp)
{
- Address so_addr(file_addr, objfile->GetSectionList());
- lldb::addr_t load_addr = so_addr.GetLoadAddress (exe_ctx.target);
- if (load_addr != LLDB_INVALID_ADDRESS)
+ ObjectFile *objfile = var_sc.module_sp->GetObjectFile();
+ if (objfile)
{
- m_value.SetValueType(Value::eValueTypeLoadAddress);
- m_value.GetScalar() = load_addr;
+ Address so_addr(file_addr, objfile->GetSectionList());
+ lldb::addr_t load_addr = so_addr.GetLoadAddress (exe_ctx.target);
+ if (load_addr != LLDB_INVALID_ADDRESS)
+ {
+ m_value.SetValueType(Value::eValueTypeLoadAddress);
+ m_value.GetScalar() = load_addr;
+ }
}
}
}
}
- }
- if (ClangASTContext::IsAggregateType (GetClangType()))
- {
- // this value object represents an aggregate type whose
- // children have values, but this object does not. So we
- // say we are changed if our location has changed.
- SetValueDidChange (value_type != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar());
- }
- else
- {
- // Copy the Value and set the context to use our Variable
- // so it can extract read its value into m_data appropriately
- Value value(m_value);
- value.SetContext(Value::eContextTypeVariable, variable);
- m_error = value.GetValueAsData(&exe_ctx, GetClangAST(), m_data, 0);
+ if (ClangASTContext::IsAggregateType (GetClangType()))
+ {
+ // this value object represents an aggregate type whose
+ // children have values, but this object does not. So we
+ // say we are changed if our location has changed.
+ SetValueDidChange (value_type != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar());
+ }
+ else
+ {
+ // Copy the Value and set the context to use our Variable
+ // so it can extract read its value into m_data appropriately
+ Value value(m_value);
+ value.SetContext(Value::eContextTypeVariable, variable);
+ m_error = value.GetValueAsData(&exe_ctx, GetClangAST(), m_data, 0);
+ }
+ break;
}
- break;
- }
- SetValueIsValid (m_error.Success());
+ SetValueIsValid (m_error.Success());
+ }
}
return m_error.Success();
}
OpenPOWER on IntegriCloud