summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/ValueObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Core/ValueObject.cpp')
-rw-r--r--lldb/source/Core/ValueObject.cpp124
1 files changed, 124 insertions, 0 deletions
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index ae53a838af5..4b7f0d70807 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -851,3 +851,127 @@ ValueObject::SetDynamicValue ()
return true;
}
+
+
+void
+ValueObject::DumpValueObject
+(
+ Stream &s,
+ ExecutionContextScope *exe_scope,
+ ValueObject *valobj,
+ const char *root_valobj_name,
+ uint32_t ptr_depth,
+ uint32_t curr_depth,
+ uint32_t max_depth,
+ bool show_types,
+ bool show_location,
+ bool use_objc,
+ bool scope_already_checked
+)
+{
+ if (valobj)
+ {
+ //const char *loc_cstr = valobj->GetLocationAsCString();
+ if (show_location)
+ {
+ s.Printf("%s: ", valobj->GetLocationAsCString(exe_scope));
+ }
+
+ s.Indent();
+
+ if (show_types)
+ s.Printf("(%s) ", valobj->GetTypeName().AsCString());
+
+ const char *name_cstr = root_valobj_name ? root_valobj_name : valobj->GetName().AsCString("");
+ s.Printf ("%s = ", name_cstr);
+
+ if (!scope_already_checked && !valobj->IsInScope(exe_scope->CalculateStackFrame()))
+ {
+ s.PutCString("error: out of scope");
+ return;
+ }
+
+ const char *val_cstr = valobj->GetValueAsCString(exe_scope);
+ const char *err_cstr = valobj->GetError().AsCString();
+
+ if (err_cstr)
+ {
+ s.Printf ("error: %s", err_cstr);
+ }
+ else
+ {
+ const char *sum_cstr = valobj->GetSummaryAsCString(exe_scope);
+
+ const bool is_aggregate = ClangASTContext::IsAggregateType (valobj->GetClangType());
+
+ if (val_cstr)
+ s.PutCString(val_cstr);
+
+ if (sum_cstr)
+ s.Printf(" %s", sum_cstr);
+
+ if (use_objc)
+ {
+ const char *object_desc = valobj->GetObjectDescription(exe_scope);
+ if (object_desc)
+ s.Printf("\n%s\n", object_desc);
+ else
+ s.Printf ("No description available.\n");
+ return;
+ }
+
+
+ if (curr_depth < max_depth)
+ {
+ if (is_aggregate)
+ s.PutChar('{');
+
+ bool is_ptr_or_ref = ClangASTContext::IsPointerOrReferenceType (valobj->GetClangType());
+
+ if (is_ptr_or_ref && ptr_depth == 0)
+ return;
+
+ const uint32_t num_children = valobj->GetNumChildren();
+ if (num_children)
+ {
+ s.IndentMore();
+ for (uint32_t idx=0; idx<num_children; ++idx)
+ {
+ ValueObjectSP child_sp(valobj->GetChildAtIndex(idx, true));
+ if (child_sp.get())
+ {
+ s.EOL();
+ DumpValueObject (s,
+ exe_scope,
+ child_sp.get(),
+ NULL,
+ is_ptr_or_ref ? ptr_depth - 1 : ptr_depth,
+ curr_depth + 1,
+ max_depth,
+ show_types,
+ show_location,
+ false,
+ true);
+ if (idx + 1 < num_children)
+ s.PutChar(',');
+ }
+ }
+ s.IndentLess();
+ }
+ if (is_aggregate)
+ {
+ s.EOL();
+ s.Indent("}");
+ }
+ }
+ else
+ {
+ if (is_aggregate)
+ {
+ s.PutCString("{...}");
+ }
+ }
+ }
+ }
+}
+
OpenPOWER on IntegriCloud