aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2016-04-25 00:52:47 +0000
committerEnrico Granata <egranata@apple.com>2016-04-25 00:52:47 +0000
commit520a422bd8e63087d84e01a01504fdca846ae529 (patch)
tree314d35b1a4d8fb1423f906acb74ae255225a6027 /lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
parenteb4d823184d3d3c7d588f03fbb72d13f026b6113 (diff)
downloadllvm-520a422bd8e63087d84e01a01504fdca846ae529.zip
llvm-520a422bd8e63087d84e01a01504fdca846ae529.tar.gz
llvm-520a422bd8e63087d84e01a01504fdca846ae529.tar.bz2
Add a --element-count option to the expression command
This option evaluates an expression and, if the result is of pointer type, treats it as if it was an array of that many elements and displays such elements This has a couple subtle points but is mostly as straightforward as it sounds Add a parray N <expr> alias for this new mode Also, extend the --object-description mode to do the moral equivalent of the above but display each element in --object-description mode Add a poarray N <expr> alias for this llvm-svn: 267372
Diffstat (limited to 'lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp')
-rw-r--r--lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp b/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
index bbd9668..c30a978 100644
--- a/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
+++ b/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
@@ -44,7 +44,8 @@ g_option_table[] =
{ LLDB_OPT_SET_1, false, "no-summary-depth", 'Y', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeCount, "Set the depth at which omitting summary information stops (default is 1)."},
{ LLDB_OPT_SET_1, false, "raw-output", 'R', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use formatting options."},
{ LLDB_OPT_SET_1, false, "show-all-children", 'A', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Ignore the upper bound on the number of children to show."},
- { LLDB_OPT_SET_1, false, "validate", 'V', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Show results of type validators."},
+ { LLDB_OPT_SET_1, false, "validate", 'V', OptionParser::eRequiredArgument, nullptr, nullptr,0, eArgTypeBoolean, "Show results of type validators."},
+ { LLDB_OPT_SET_1, false, "element-count", 'Z', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "Treat the result of the expression as if its type is an array of this many values."},
{ 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
};
@@ -92,6 +93,12 @@ OptionGroupValueObjectDisplay::SetOptionValue (CommandInterpreter &interpreter,
if (!success)
error.SetErrorStringWithFormat("invalid max depth '%s'", option_arg);
break;
+
+ case 'Z':
+ elem_count = StringConvert::ToUInt32 (option_arg, UINT32_MAX, 0, &success);
+ if (!success)
+ error.SetErrorStringWithFormat("invalid element count '%s'", option_arg);
+ break;
case 'P':
ptr_depth = StringConvert::ToUInt32 (option_arg, 0, 0, &success);
@@ -141,6 +148,7 @@ OptionGroupValueObjectDisplay::OptionParsingStarting (CommandInterpreter &interp
use_objc = false;
max_depth = UINT32_MAX;
ptr_depth = 0;
+ elem_count = 0;
use_synth = true;
be_raw = false;
ignore_cap = false;
@@ -187,6 +195,8 @@ OptionGroupValueObjectDisplay::GetAsDumpOptions (LanguageRuntimeDescriptionDispl
options.SetRawDisplay();
options.SetRunValidator(run_validator);
+
+ options.SetElementCount(elem_count);
return options;
}