<rdar://problem/14393032>
DumpValueObject() 2.0
This checkin restores pre-Xcode5 functionality to the "po" (expr -O) command:
- expr now has a new --description-verbosity (-v) argument, which takes either compact or full as a value (-v is the same as -vfull)
When the full mode is on, "po" will show the extended output with type name, persistent variable name and value, as in
(lldb) expr -O -v -- foo
(id) $0 = 0x000000010010baf0 {
1 = 2;
2 = 3;
}
When -v is omitted, or -vcompact is passed, the Xcode5-style output will be shown, as in
(lldb) expr -O -- foo
{
1 = 2;
2 = 3;
}
- for a non-ObjectiveC object, LLDB will still try to retrieve a summary and/or value to display
(lldb) po 5
5
-v also works in this mode
(lldb) expr -O -vfull -- 5
(int) $4 = 5
On top of that, this is a major refactoring of the ValueObject printing code. The functionality is now factored into a ValueObjectPrinter class for easier maintenance in the future
DumpValueObject() was turned into an instance method ValueObject::Dump() which simply calls through to the printer code, Dump_Impl has been removed
Test case to follow
llvm-svn: 191694
diff --git a/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp b/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
index 0129d3e..c79f49d 100644
--- a/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
+++ b/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
@@ -15,6 +15,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
+#include "lldb/DataFormatters/ValueObjectPrinter.h"
#include "lldb/Target/Target.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Utility/Utils.h"
@@ -147,12 +148,12 @@
}
}
-ValueObject::DumpValueObjectOptions
-OptionGroupValueObjectDisplay::GetAsDumpOptions (bool objc_is_compact,
+DumpValueObjectOptions
+OptionGroupValueObjectDisplay::GetAsDumpOptions (LanguageRuntimeDescriptionDisplayVerbosity lang_descr_verbosity,
lldb::Format format,
lldb::TypeSummaryImplSP summary_sp)
{
- ValueObject::DumpValueObjectOptions options;
+ DumpValueObjectOptions options;
options.SetMaximumPointerDepth(ptr_depth);
if (use_objc)
options.SetShowSummary(false);
@@ -169,7 +170,7 @@
.SetFormat(format)
.SetSummary(summary_sp);
- if (objc_is_compact)
+ if (lang_descr_verbosity == eLanguageRuntimeDescriptionDisplayVerbosityCompact)
options.SetHideRootType(use_objc)
.SetHideName(use_objc)
.SetHideValue(use_objc);