summaryrefslogtreecommitdiffstats
path: root/lldb/source/DataFormatters
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/DataFormatters')
-rw-r--r--lldb/source/DataFormatters/TypeFormat.cpp8
-rw-r--r--lldb/source/DataFormatters/ValueObjectPrinter.cpp36
2 files changed, 34 insertions, 10 deletions
diff --git a/lldb/source/DataFormatters/TypeFormat.cpp b/lldb/source/DataFormatters/TypeFormat.cpp
index 0c62daf87bb..64d37501a92 100644
--- a/lldb/source/DataFormatters/TypeFormat.cpp
+++ b/lldb/source/DataFormatters/TypeFormat.cpp
@@ -59,9 +59,9 @@ TypeFormatImpl_Format::FormatObject (ValueObject *valobj,
{
if (!valobj)
return false;
- if (valobj->GetClangType().IsAggregateType () == false)
+ if (valobj->CanProvideValue())
{
- const Value& value(valobj->GetValue());
+ Value& value(valobj->GetValue());
const Value::ContextType context_type = value.GetContextType();
ExecutionContext exe_ctx (valobj->GetExecutionContextRef());
DataExtractor data;
@@ -92,7 +92,7 @@ TypeFormatImpl_Format::FormatObject (ValueObject *valobj,
}
else
{
- ClangASTType clang_type = valobj->GetClangType ();
+ ClangASTType clang_type = value.GetClangType ();
if (clang_type)
{
// put custom bytes to display in the DataExtractor to override the default value logic
@@ -180,7 +180,7 @@ TypeFormatImpl_EnumType::FormatObject (ValueObject *valobj,
dest.clear();
if (!valobj)
return false;
- if (valobj->GetClangType().IsAggregateType ())
+ if (!valobj->CanProvideValue())
return false;
ProcessSP process_sp;
TargetSP target_sp;
diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/lldb/source/DataFormatters/ValueObjectPrinter.cpp
index 3ce5051cc4e..126ff78c389 100644
--- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp
+++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp
@@ -66,7 +66,7 @@ ValueObjectPrinter::Init (ValueObject* valobj,
bool
ValueObjectPrinter::PrintValueObject ()
{
- if (!GetDynamicValueIfNeeded () || m_valobj == nullptr)
+ if (!GetMostSpecializedValue () || m_valobj == nullptr)
return false;
if (ShouldPrintValueObject())
@@ -97,7 +97,7 @@ ValueObjectPrinter::PrintValueObject ()
}
bool
-ValueObjectPrinter::GetDynamicValueIfNeeded ()
+ValueObjectPrinter::GetMostSpecializedValue ()
{
if (m_valobj)
return true;
@@ -134,6 +134,25 @@ ValueObjectPrinter::GetDynamicValueIfNeeded ()
else
m_valobj = m_orig_valobj;
}
+
+ if (m_valobj->IsSynthetic())
+ {
+ if (options.m_use_synthetic == false)
+ {
+ ValueObject *non_synthetic = m_valobj->GetNonSyntheticValue().get();
+ if (non_synthetic)
+ m_valobj = non_synthetic;
+ }
+ }
+ else
+ {
+ if (options.m_use_synthetic == true)
+ {
+ ValueObject *synthetic = m_valobj->GetSyntheticValue().get();
+ if (synthetic)
+ m_valobj = synthetic;
+ }
+ }
}
m_clang_type = m_valobj->GetClangType();
m_type_flags = m_clang_type.GetTypeInfo ();
@@ -442,8 +461,7 @@ ValueObjectPrinter::ShouldPrintChildren (bool is_failed_description,
ValueObject*
ValueObjectPrinter::GetValueObjectForChildrenGeneration ()
{
- ValueObjectSP synth_valobj_sp = m_valobj->GetSyntheticValue (options.m_use_synthetic);
- return (synth_valobj_sp ? synth_valobj_sp.get() : m_valobj);
+ return m_valobj;
}
void
@@ -540,7 +558,13 @@ ValueObjectPrinter::PrintChildren (uint32_t curr_ptr_depth)
{
// Aggregate, no children...
if (ShouldPrintValueObject())
- m_stream->PutCString(" {}\n");
+ {
+ // if it has a synthetic value, then don't print {}, the synthetic children are probably only being used to vend a value
+ if (m_valobj->DoesProvideSyntheticValue())
+ m_stream->PutCString( "\n");
+ else
+ m_stream->PutCString(" {}\n");
+ }
}
else
{
@@ -552,7 +576,7 @@ ValueObjectPrinter::PrintChildren (uint32_t curr_ptr_depth)
bool
ValueObjectPrinter::PrintChildrenOneLiner (bool hide_names)
{
- if (!GetDynamicValueIfNeeded () || m_valobj == nullptr)
+ if (!GetMostSpecializedValue () || m_valobj == nullptr)
return false;
ValueObject* synth_m_valobj = GetValueObjectForChildrenGeneration();
OpenPOWER on IntegriCloud