diff options
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 7186b9a..8b04da6 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -19,6 +19,7 @@ #include "lldb/Core/Value.h" #include "lldb/Core/InputReader.h" #include "lldb/Core/ValueObjectVariable.h" +#include "lldb/DataFormatters/ValueObjectPrinter.h" #include "lldb/Expression/ClangExpressionVariable.h" #include "lldb/Expression/ClangUserExpression.h" #include "lldb/Expression/ClangFunction.h" @@ -49,6 +50,13 @@ CommandObjectExpression::CommandOptions::~CommandOptions () { } +static OptionEnumValueElement g_description_verbosity_type[] = +{ + { eLanguageRuntimeDescriptionDisplayVerbosityCompact, "compact", "Only show the description string"}, + { eLanguageRuntimeDescriptionDisplayVerbosityFull, "full", "Show the full output, including persistent variable's name and type"}, + { 0, NULL, NULL } +}; + OptionDefinition CommandObjectExpression::CommandOptions::g_option_table[] = { @@ -56,6 +64,7 @@ CommandObjectExpression::CommandOptions::g_option_table[] = { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "ignore-breakpoints", 'i', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Ignore breakpoint hits while running expressions"}, { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "timeout", 't', OptionParser::eRequiredArgument, NULL, 0, eArgTypeUnsignedInteger, "Timeout value (in microseconds) for running the expression."}, { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "unwind-on-error", 'u', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Clean up program state if the expression causes a crash, or raises a signal. Note, unlike gdb hitting a breakpoint is controlled by another option (-i)."}, + { LLDB_OPT_SET_1, false, "description-verbosity", 'v', OptionParser::eOptionalArgument, g_description_verbosity_type, 0, eArgTypeDescriptionVerbosity, "How verbose should the output of this expression be, if the object description is asked for."}, }; @@ -127,6 +136,18 @@ CommandObjectExpression::CommandOptions::SetOptionValue (CommandInterpreter &int error.SetErrorStringWithFormat("could not convert \"%s\" to a boolean value.", option_arg); break; } + + case 'v': + if (!option_arg) + { + m_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityFull; + break; + } + m_verbosity = (LanguageRuntimeDescriptionDisplayVerbosity) Args::StringToOptionEnum(option_arg, g_option_table[option_idx].enum_values, 0, error); + if (!error.Success()) + error.SetErrorStringWithFormat ("unrecognized value for description-verbosity '%s'", option_arg); + break; + default: error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; @@ -153,6 +174,7 @@ CommandObjectExpression::CommandOptions::OptionParsingStarting (CommandInterpret show_summary = true; try_all_threads = true; timeout = 0; + m_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityCompact; } const OptionDefinition* @@ -357,11 +379,10 @@ CommandObjectExpression::EvaluateExpression if (format != eFormatDefault) result_valobj_sp->SetFormat (format); - ValueObject::DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(true,format)); + DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(m_command_options.m_verbosity,format)); - ValueObject::DumpValueObject (*(output_stream), - result_valobj_sp.get(), // Variable object to dump - options); + result_valobj_sp->Dump(*output_stream,options); + if (result) result->SetStatus (eReturnStatusSuccessFinishResult); } |