Change "frame var" over to using OptionGroups (and thus the OptionGroupVariableObjectDisplay).
Change the boolean "use_dynamic" over to a tri-state, no-dynamic, dynamic-w/o running target,
and dynamic with running target.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130832 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp
index 9a42ae0..0a5988e 100644
--- a/source/API/SBFrame.cpp
+++ b/source/API/SBFrame.cpp
@@ -343,12 +343,12 @@
SBValue
SBFrame::FindVariable (const char *name)
{
- bool use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
+ lldb::DynamicValueType use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
return FindVariable (name, use_dynamic);
}
SBValue
-SBFrame::FindVariable (const char *name, bool use_dynamic)
+SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
{
VariableSP var_sp;
SBValue sb_value;
@@ -389,12 +389,12 @@
SBValue
SBFrame::FindValue (const char *name, ValueType value_type)
{
- bool use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
+ lldb::DynamicValueType use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
return FindValue (name, value_type, use_dynamic);
}
SBValue
-SBFrame::FindValue (const char *name, ValueType value_type, bool use_dynamic)
+SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic)
{
SBValue sb_value;
if (m_opaque_sp && name && name[0])
@@ -579,7 +579,7 @@
bool statics,
bool in_scope_only)
{
- bool use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
+ lldb::DynamicValueType use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
return GetVariables (arguments, locals, statics, in_scope_only, use_dynamic);
}
@@ -588,7 +588,7 @@
bool locals,
bool statics,
bool in_scope_only,
- bool use_dynamic)
+ lldb::DynamicValueType use_dynamic)
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -706,12 +706,12 @@
SBValue
SBFrame::EvaluateExpression (const char *expr)
{
- bool use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
+ lldb::DynamicValueType use_dynamic = m_opaque_sp->CalculateTarget()->GetPreferDynamicValue();
return EvaluateExpression (expr, use_dynamic);
}
SBValue
-SBFrame::EvaluateExpression (const char *expr, bool fetch_dynamic_value)
+SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dynamic_value)
{
Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
@@ -732,8 +732,8 @@
exe_results = m_opaque_sp->GetThread().GetProcess().GetTarget().EvaluateExpression(expr,
m_opaque_sp.get(),
unwind_on_error,
- fetch_dynamic_value,
keep_in_memory,
+ fetch_dynamic_value,
*expr_result);
}
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index f499fae..4ed2c7d 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -339,12 +339,12 @@
SBValue
SBValue::GetChildAtIndex (uint32_t idx)
{
- bool use_dynamic_value = m_opaque_sp->GetUpdatePoint().GetTarget()->GetPreferDynamicValue();
+ lldb::DynamicValueType use_dynamic_value = m_opaque_sp->GetUpdatePoint().GetTarget()->GetPreferDynamicValue();
return GetChildAtIndex (idx, use_dynamic_value);
}
SBValue
-SBValue::GetChildAtIndex (uint32_t idx, bool use_dynamic_value)
+SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic)
{
lldb::ValueObjectSP child_sp;
@@ -353,11 +353,11 @@
child_sp = m_opaque_sp->GetChildAtIndex (idx, true);
}
- if (use_dynamic_value)
+ if (use_dynamic != lldb::eNoDynamicValues)
{
if (child_sp)
{
- lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue (true);
+ lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue (use_dynamic);
if (dynamic_sp)
child_sp = dynamic_sp;
}
@@ -391,12 +391,12 @@
SBValue
SBValue::GetChildMemberWithName (const char *name)
{
- bool use_dynamic_value = m_opaque_sp->GetUpdatePoint().GetTarget()->GetPreferDynamicValue();
+ lldb::DynamicValueType use_dynamic_value = m_opaque_sp->GetUpdatePoint().GetTarget()->GetPreferDynamicValue();
return GetChildMemberWithName (name, use_dynamic_value);
}
SBValue
-SBValue::GetChildMemberWithName (const char *name, bool use_dynamic_value)
+SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dynamic_value)
{
lldb::ValueObjectSP child_sp;
const ConstString str_name (name);
@@ -406,11 +406,11 @@
child_sp = m_opaque_sp->GetChildMemberWithName (str_name, true);
}
- if (use_dynamic_value)
+ if (use_dynamic_value != lldb::eNoDynamicValues)
{
if (child_sp)
{
- lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue (true);
+ lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue (use_dynamic_value);
if (dynamic_sp)
child_sp = dynamic_sp;
}
diff --git a/source/Commands/CommandObjectExpression.cpp b/source/Commands/CommandObjectExpression.cpp
index fa578f4..f8facfd 100644
--- a/source/Commands/CommandObjectExpression.cpp
+++ b/source/Commands/CommandObjectExpression.cpp
@@ -260,27 +260,22 @@
ExecutionResults exe_results;
bool keep_in_memory = true;
- bool use_dynamic;
+ lldb::DynamicValueType use_dynamic;
// If use dynamic is not set, get it from the target:
switch (m_options.use_dynamic)
{
case eLazyBoolCalculate:
- {
- if (m_exe_ctx.target->GetPreferDynamicValue())
- use_dynamic = true;
- else
- use_dynamic = false;
- }
+ use_dynamic = m_exe_ctx.target->GetPreferDynamicValue();
break;
case eLazyBoolYes:
- use_dynamic = true;
+ use_dynamic = lldb::eDynamicCanRunTarget;
break;
case eLazyBoolNo:
- use_dynamic = false;
+ use_dynamic = lldb::eNoDynamicValues;
break;
}
- exe_results = m_exe_ctx.target->EvaluateExpression(expr, m_exe_ctx.frame, m_options.unwind_on_error, use_dynamic, keep_in_memory, result_valobj_sp);
+ exe_results = m_exe_ctx.target->EvaluateExpression(expr, m_exe_ctx.frame, m_options.unwind_on_error, keep_in_memory, use_dynamic, result_valobj_sp);
if (exe_results == eExecutionInterrupted && !m_options.unwind_on_error)
{
diff --git a/source/Commands/CommandObjectFrame.cpp b/source/Commands/CommandObjectFrame.cpp
index 6521416..33e735a 100644
--- a/source/Commands/CommandObjectFrame.cpp
+++ b/source/Commands/CommandObjectFrame.cpp
@@ -25,6 +25,7 @@
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/Options.h"
+#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -285,73 +286,46 @@
{
public:
- class CommandOptions : public Options
+ class OptionGroupFrameVariable : public OptionGroup
{
public:
- CommandOptions (CommandInterpreter &interpreter) :
- Options(interpreter)
+ OptionGroupFrameVariable ()
{
- OptionParsingStarting ();
}
virtual
- ~CommandOptions ()
+ ~OptionGroupFrameVariable ()
{
}
+ virtual uint32_t
+ GetNumDefinitions ();
+
+ virtual const OptionDefinition*
+ GetDefinitions ()
+ {
+ return g_option_table;
+ }
+
virtual Error
- SetOptionValue (uint32_t option_idx, const char *option_arg)
+ SetOptionValue (CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_arg)
{
Error error;
- bool success;
- char short_option = (char) m_getopt_table[option_idx].val;
+ char short_option = (char) g_option_table[option_idx].short_option;
switch (short_option)
{
- case 'o': use_objc = true; break;
- case 'd':
- {
- bool success;
- bool result;
- result = Args::StringToBoolean(option_arg, true, &success);
- if (!success)
- error.SetErrorStringWithFormat("Invalid dynamic value setting: \"%s\".\n", option_arg);
- else
- {
- if (result)
- use_dynamic = eLazyBoolYes;
- else
- use_dynamic = eLazyBoolNo;
- }
- }
- break;
case 'r': use_regex = true; break;
case 'a': show_args = false; break;
case 'l': show_locals = false; break;
case 'g': show_globals = true; break;
- case 't': show_types = true; break;
- case 'y': show_summary = false; break;
- case 'L': show_location= true; break;
case 'c': show_decl = true; break;
- case 'D': debug = true; break;
case 'f': error = Args::StringToFormat(option_arg, format, NULL); break;
- case 'F': flat_output = true; break;
- case 'A':
- max_depth = Args::StringToUInt32 (option_arg, UINT32_MAX, 0, &success);
- if (!success)
- error.SetErrorStringWithFormat("Invalid max depth '%s'.\n", option_arg);
- break;
-
- case 'p':
- ptr_depth = Args::StringToUInt32 (option_arg, 0, 0, &success);
- if (!success)
- error.SetErrorStringWithFormat("Invalid pointer depth '%s'.\n", option_arg);
- break;
-
case 'G':
globals.push_back(ConstString (option_arg));
break;
-
case 's':
show_scope = true;
break;
@@ -364,52 +338,29 @@
return error;
}
- void
- OptionParsingStarting ()
+ virtual void
+ OptionParsingStarting (CommandInterpreter &interpreter)
{
- use_objc = false;
- use_regex = false;
show_args = true;
- show_locals = true;
- show_globals = false;
- show_types = false;
- show_scope = false;
- show_summary = true;
- show_location = false;
show_decl = false;
- debug = false;
- flat_output = false;
- use_dynamic = eLazyBoolCalculate;
- max_depth = UINT32_MAX;
- ptr_depth = 0;
format = eFormatDefault;
+ show_globals = false;
+ show_locals = true;
+ use_regex = false;
+ show_scope = false;
globals.clear();
}
- const OptionDefinition*
- GetDefinitions ()
- {
- return g_option_table;
- }
-
// Options table: Required for subclasses of Options.
static OptionDefinition g_option_table[];
- bool use_objc:1,
- use_regex:1,
+
+ bool use_regex:1,
show_args:1,
show_locals:1,
show_globals:1,
- show_types:1,
show_scope:1,
- show_summary:1,
- show_location:1,
- show_decl:1,
- debug:1,
- flat_output:1;
- LazyBool use_dynamic;
- uint32_t max_depth; // The depth to print when dumping concrete (not pointers) aggreate values
- uint32_t ptr_depth; // The default depth that is dumped when we find pointers
+ show_decl:1;
lldb::Format format; // The format to use when dumping variables or children of variables
std::vector<ConstString> globals;
// Instance variables to hold the values for command options.
@@ -426,7 +377,9 @@
"'var->child.x'.",
NULL,
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
- m_options (interpreter)
+ m_option_group (interpreter),
+ m_frame_var_options(),
+ m_varobj_options()
{
CommandArgumentEntry arg;
CommandArgumentData var_name_arg;
@@ -440,6 +393,10 @@
// Push the data for the first argument into the m_arguments vector.
m_arguments.push_back (arg);
+
+ m_option_group.Append (&m_frame_var_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+ m_option_group.Append (&m_varobj_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+ m_option_group.Finalize();
}
virtual
@@ -451,7 +408,7 @@
Options *
GetOptions ()
{
- return &m_options;
+ return &m_option_group;
}
@@ -479,40 +436,19 @@
VariableSP var_sp;
ValueObjectSP valobj_sp;
- bool use_dynamic;
-
- // If use dynamic is not set, get it from the target:
- switch (m_options.use_dynamic)
- {
- case eLazyBoolCalculate:
- {
- if (exe_ctx.target->GetPreferDynamicValue())
- use_dynamic = true;
- else
- use_dynamic = false;
- }
- break;
- case eLazyBoolYes:
- use_dynamic = true;
- break;
- case eLazyBoolNo:
- use_dynamic = false;
- break;
- }
-
const char *name_cstr = NULL;
size_t idx;
- if (!m_options.globals.empty())
+ if (!m_frame_var_options.globals.empty())
{
uint32_t fail_count = 0;
if (exe_ctx.target)
{
- const size_t num_globals = m_options.globals.size();
+ const size_t num_globals = m_frame_var_options.globals.size();
for (idx = 0; idx < num_globals; ++idx)
{
VariableList global_var_list;
const uint32_t num_matching_globals
- = exe_ctx.target->GetImages().FindGlobalVariables (m_options.globals[idx],
+ = exe_ctx.target->GetImages().FindGlobalVariables (m_frame_var_options.globals[idx],
true,
UINT32_MAX,
global_var_list);
@@ -521,7 +457,7 @@
{
++fail_count;
result.GetErrorStream().Printf ("error: can't find global variable '%s'\n",
- m_options.globals[idx].AsCString());
+ m_frame_var_options.globals[idx].AsCString());
}
else
{
@@ -530,16 +466,18 @@
var_sp = global_var_list.GetVariableAtIndex(global_idx);
if (var_sp)
{
- valobj_sp = exe_ctx.frame->GetValueObjectForFrameVariable (var_sp, use_dynamic);
+ valobj_sp = exe_ctx.frame->GetValueObjectForFrameVariable (var_sp,
+ m_varobj_options.use_dynamic);
if (!valobj_sp)
- valobj_sp = exe_ctx.frame->TrackGlobalVariable (var_sp, use_dynamic);
+ valobj_sp = exe_ctx.frame->TrackGlobalVariable (var_sp,
+ m_varobj_options.use_dynamic);
if (valobj_sp)
{
- if (m_options.format != eFormatDefault)
- valobj_sp->SetFormat (m_options.format);
+ if (m_frame_var_options.format != eFormatDefault)
+ valobj_sp->SetFormat (m_frame_var_options.format);
- if (m_options.show_decl && var_sp->GetDeclaration ().GetFile())
+ if (m_frame_var_options.show_decl && var_sp->GetDeclaration ().GetFile())
{
var_sp->GetDeclaration ().DumpStopContext (&s, false);
s.PutCString (": ");
@@ -548,15 +486,15 @@
ValueObject::DumpValueObject (result.GetOutputStream(),
valobj_sp.get(),
name_cstr,
- m_options.ptr_depth,
+ m_varobj_options.ptr_depth,
0,
- m_options.max_depth,
- m_options.show_types,
- m_options.show_location,
- m_options.use_objc,
- use_dynamic,
+ m_varobj_options.max_depth,
+ m_varobj_options.show_types,
+ m_varobj_options.show_location,
+ m_varobj_options.use_objc,
+ m_varobj_options.use_dynamic,
false,
- m_options.flat_output);
+ m_varobj_options.flat_output);
}
}
}
@@ -576,9 +514,9 @@
// variable objects from them...
for (idx = 0; (name_cstr = command.GetArgumentAtIndex(idx)) != NULL; ++idx)
{
- uint32_t ptr_depth = m_options.ptr_depth;
+ uint32_t ptr_depth = m_varobj_options.ptr_depth;
- if (m_options.use_regex)
+ if (m_frame_var_options.use_regex)
{
const uint32_t regex_start_index = regex_var_list.GetSize();
RegularExpression regex (name_cstr);
@@ -597,13 +535,13 @@
var_sp = regex_var_list.GetVariableAtIndex (regex_idx);
if (var_sp)
{
- valobj_sp = exe_ctx.frame->GetValueObjectForFrameVariable (var_sp, use_dynamic);
+ valobj_sp = exe_ctx.frame->GetValueObjectForFrameVariable (var_sp, m_varobj_options.use_dynamic);
if (valobj_sp)
{
- if (m_options.format != eFormatDefault)
- valobj_sp->SetFormat (m_options.format);
+ if (m_frame_var_options.format != eFormatDefault)
+ valobj_sp->SetFormat (m_frame_var_options.format);
- if (m_options.show_decl && var_sp->GetDeclaration ().GetFile())
+ if (m_frame_var_options.show_decl && var_sp->GetDeclaration ().GetFile())
{
var_sp->GetDeclaration ().DumpStopContext (&s, false);
s.PutCString (": ");
@@ -612,15 +550,15 @@
ValueObject::DumpValueObject (result.GetOutputStream(),
valobj_sp.get(),
var_sp->GetName().AsCString(),
- m_options.ptr_depth,
+ m_varobj_options.ptr_depth,
0,
- m_options.max_depth,
- m_options.show_types,
- m_options.show_location,
- m_options.use_objc,
- use_dynamic,
+ m_varobj_options.max_depth,
+ m_varobj_options.show_types,
+ m_varobj_options.show_location,
+ m_varobj_options.use_objc,
+ m_varobj_options.use_dynamic,
false,
- m_options.flat_output);
+ m_varobj_options.flat_output);
}
}
}
@@ -643,16 +581,17 @@
{
Error error;
uint32_t expr_path_options = StackFrame::eExpressionPathOptionCheckPtrVsMember;
- if (use_dynamic)
- expr_path_options |= StackFrame::eExpressionPathOptionsDynamicValue;
-
- valobj_sp = exe_ctx.frame->GetValueForVariableExpressionPath (name_cstr, expr_path_options, error);
+ lldb::VariableSP var_sp;
+ valobj_sp = exe_ctx.frame->GetValueForVariableExpressionPath (name_cstr,
+ m_varobj_options.use_dynamic,
+ expr_path_options,
+ var_sp,
+ error);
if (valobj_sp)
{
- if (m_options.format != eFormatDefault)
- valobj_sp->SetFormat (m_options.format);
-
- if (m_options.show_decl && var_sp->GetDeclaration ().GetFile())
+ if (m_frame_var_options.format != eFormatDefault)
+ valobj_sp->SetFormat (m_frame_var_options.format);
+ if (m_frame_var_options.show_decl && var_sp && var_sp->GetDeclaration ().GetFile())
{
var_sp->GetDeclaration ().DumpStopContext (&s, false);
s.PutCString (": ");
@@ -662,13 +601,13 @@
valobj_sp->GetParent() ? name_cstr : NULL,
ptr_depth,
0,
- m_options.max_depth,
- m_options.show_types,
- m_options.show_location,
- m_options.use_objc,
- use_dynamic,
+ m_varobj_options.max_depth,
+ m_varobj_options.show_types,
+ m_varobj_options.show_location,
+ m_varobj_options.use_objc,
+ m_varobj_options.use_dynamic,
false,
- m_options.flat_output);
+ m_varobj_options.flat_output);
}
else
{
@@ -696,26 +635,26 @@
switch (var_sp->GetScope())
{
case eValueTypeVariableGlobal:
- dump_variable = m_options.show_globals;
- if (dump_variable && m_options.show_scope)
+ dump_variable = m_frame_var_options.show_globals;
+ if (dump_variable && m_frame_var_options.show_scope)
s.PutCString("GLOBAL: ");
break;
case eValueTypeVariableStatic:
- dump_variable = m_options.show_globals;
- if (dump_variable && m_options.show_scope)
+ dump_variable = m_frame_var_options.show_globals;
+ if (dump_variable && m_frame_var_options.show_scope)
s.PutCString("STATIC: ");
break;
case eValueTypeVariableArgument:
- dump_variable = m_options.show_args;
- if (dump_variable && m_options.show_scope)
+ dump_variable = m_frame_var_options.show_args;
+ if (dump_variable && m_frame_var_options.show_scope)
s.PutCString(" ARG: ");
break;
case eValueTypeVariableLocal:
- dump_variable = m_options.show_locals;
- if (dump_variable && m_options.show_scope)
+ dump_variable = m_frame_var_options.show_locals;
+ if (dump_variable && m_frame_var_options.show_scope)
s.PutCString(" LOCAL: ");
break;
@@ -729,17 +668,18 @@
// Use the variable object code to make sure we are
// using the same APIs as the the public API will be
// using...
- valobj_sp = exe_ctx.frame->GetValueObjectForFrameVariable (var_sp, use_dynamic);
+ valobj_sp = exe_ctx.frame->GetValueObjectForFrameVariable (var_sp,
+ m_varobj_options.use_dynamic);
if (valobj_sp)
{
- if (m_options.format != eFormatDefault)
- valobj_sp->SetFormat (m_options.format);
+ if (m_frame_var_options.format != eFormatDefault)
+ valobj_sp->SetFormat (m_frame_var_options.format);
// When dumping all variables, don't print any variables
// that are not in scope to avoid extra unneeded output
if (valobj_sp->IsInScope ())
{
- if (m_options.show_decl && var_sp->GetDeclaration ().GetFile())
+ if (m_frame_var_options.show_decl && var_sp->GetDeclaration ().GetFile())
{
var_sp->GetDeclaration ().DumpStopContext (&s, false);
s.PutCString (": ");
@@ -747,15 +687,15 @@
ValueObject::DumpValueObject (result.GetOutputStream(),
valobj_sp.get(),
name_cstr,
- m_options.ptr_depth,
+ m_varobj_options.ptr_depth,
0,
- m_options.max_depth,
- m_options.show_types,
- m_options.show_location,
- m_options.use_objc,
- use_dynamic,
+ m_varobj_options.max_depth,
+ m_varobj_options.show_types,
+ m_varobj_options.show_location,
+ m_varobj_options.use_objc,
+ m_varobj_options.use_dynamic,
false,
- m_options.flat_output);
+ m_varobj_options.flat_output);
}
}
}
@@ -769,31 +709,32 @@
}
protected:
- CommandOptions m_options;
+ OptionGroupOptions m_option_group;
+ OptionGroupFrameVariable m_frame_var_options;
+ OptionGroupValueObjectDisplay m_varobj_options;
};
OptionDefinition
-CommandObjectFrameVariable::CommandOptions::g_option_table[] =
+CommandObjectFrameVariable::OptionGroupFrameVariable::g_option_table[] =
{
-{ LLDB_OPT_SET_1, false, "aggregate-depth", 'A', required_argument, NULL, 0, eArgTypeCount, "Set the max recurse depth when dumping aggregate types (default is infinity)."},
{ LLDB_OPT_SET_1, false, "no-args", 'a', no_argument, NULL, 0, eArgTypeNone, "Omit function arguments."},
{ LLDB_OPT_SET_1, false, "show-declaration",'c', no_argument, NULL, 0, eArgTypeNone, "Show variable declaration information (source file and line where the variable was declared)."},
-{ LLDB_OPT_SET_1, false, "debug", 'D', no_argument, NULL, 0, eArgTypeNone, "Enable verbose debug information."},
-{ LLDB_OPT_SET_1, false, "dynamic-type", 'd', required_argument, NULL, 0, eArgTypeBoolean, "Show the object as its full dynamic type, not its static type, if available."},
{ LLDB_OPT_SET_1, false, "format", 'f', required_argument, NULL, 0, eArgTypeExprFormat, "Specify the format that the variable output should use."},
-{ LLDB_OPT_SET_1, false, "flat", 'F', no_argument, NULL, 0, eArgTypeNone, "Display results in a flat format that uses expression paths for each variable or member."},
{ LLDB_OPT_SET_1, false, "show-globals", 'g', no_argument, NULL, 0, eArgTypeNone, "Show the current frame source file global and static variables."},
{ LLDB_OPT_SET_1, false, "find-global", 'G', required_argument, NULL, 0, eArgTypeVarName, "Find a global variable by name (which might not be in the current stack frame source file)."},
-{ LLDB_OPT_SET_1, false, "location", 'L', no_argument, NULL, 0, eArgTypeNone, "Show variable location information."},
{ LLDB_OPT_SET_1, false, "no-locals", 'l', no_argument, NULL, 0, eArgTypeNone, "Omit local variables."},
-{ LLDB_OPT_SET_1, false, "objc", 'o', no_argument, NULL, 0, eArgTypeNone, "When looking up a variable by name, print as an Objective-C object."},
-{ LLDB_OPT_SET_1, false, "ptr-depth", 'p', required_argument, NULL, 0, eArgTypeCount, "The number of pointers to be traversed when dumping values (default is zero)."},
{ LLDB_OPT_SET_1, false, "regex", 'r', no_argument, NULL, 0, eArgTypeRegularExpression, "The <variable-name> argument for name lookups are regular expressions."},
{ LLDB_OPT_SET_1, false, "scope", 's', no_argument, NULL, 0, eArgTypeNone, "Show variable scope (argument, local, global, static)."},
-{ LLDB_OPT_SET_1, false, "show-types", 't', no_argument, NULL, 0, eArgTypeNone, "Show variable types when dumping values."},
-{ LLDB_OPT_SET_1, false, "no-summary", 'y', no_argument, NULL, 0, eArgTypeNone, "Omit summary information."},
{ 0, false, NULL, 0, 0, NULL, NULL, eArgTypeNone, NULL }
};
+
+uint32_t
+CommandObjectFrameVariable::OptionGroupFrameVariable::GetNumDefinitions ()
+{
+ return sizeof(CommandObjectFrameVariable::OptionGroupFrameVariable::g_option_table)/sizeof(OptionDefinition);
+}
+
+
#pragma mark CommandObjectMultiwordFrame
//-------------------------------------------------------------------------
diff --git a/source/Commands/CommandObjectMemory.cpp b/source/Commands/CommandObjectMemory.cpp
index 85b939c..91144e5 100644
--- a/source/Commands/CommandObjectMemory.cpp
+++ b/source/Commands/CommandObjectMemory.cpp
@@ -643,7 +643,6 @@
if (format != eFormatDefault)
valobj_sp->SetFormat (format);
- bool use_dynamic = false;
bool scope_already_checked = true;
ValueObject::DumpValueObject (*output_stream,
@@ -655,7 +654,7 @@
m_varobj_options.show_types,
m_varobj_options.show_location,
m_varobj_options.use_objc,
- use_dynamic,
+ m_varobj_options.use_dynamic,
scope_already_checked,
m_varobj_options.flat_output);
}
diff --git a/source/Core/ValueObject.cpp b/source/Core/ValueObject.cpp
index 521d3eb..819e67a 100644
--- a/source/Core/ValueObject.cpp
+++ b/source/Core/ValueObject.cpp
@@ -986,8 +986,11 @@
}
void
-ValueObject::CalculateDynamicValue ()
+ValueObject::CalculateDynamicValue (lldb::DynamicValueType use_dynamic)
{
+ if (use_dynamic == lldb::eNoDynamicValues)
+ return;
+
if (!m_dynamic_value && !IsDynamic())
{
Process *process = m_update_point.GetProcess();
@@ -1013,12 +1016,12 @@
{
LanguageRuntime *objc_runtime = process->GetLanguageRuntime (lldb::eLanguageTypeObjC);
if (objc_runtime)
- worth_having_dynamic_value = cpp_runtime->CouldHaveDynamicValue(*this);
+ worth_having_dynamic_value = objc_runtime->CouldHaveDynamicValue(*this);
}
}
if (worth_having_dynamic_value)
- m_dynamic_value = new ValueObjectDynamicValue (*this);
+ m_dynamic_value = new ValueObjectDynamicValue (*this, use_dynamic);
// if (worth_having_dynamic_value)
// printf ("Adding dynamic value %s (%p) to (%p) - manager %p.\n", m_name.GetCString(), m_dynamic_value, this, m_manager);
@@ -1027,11 +1030,14 @@
}
ValueObjectSP
-ValueObject::GetDynamicValue (bool can_create)
+ValueObject::GetDynamicValue (DynamicValueType use_dynamic)
{
- if (!IsDynamic() && m_dynamic_value == NULL && can_create)
+ if (use_dynamic == lldb::eNoDynamicValues)
+ return ValueObjectSP();
+
+ if (!IsDynamic() && m_dynamic_value == NULL)
{
- CalculateDynamicValue();
+ CalculateDynamicValue(use_dynamic);
}
if (m_dynamic_value)
return m_dynamic_value->GetSP();
@@ -1137,16 +1143,16 @@
bool show_types,
bool show_location,
bool use_objc,
- bool use_dynamic,
+ lldb::DynamicValueType use_dynamic,
bool scope_already_checked,
bool flat_output
)
{
if (valobj && valobj->UpdateValueIfNeeded ())
{
- if (use_dynamic)
+ if (use_dynamic != lldb::eNoDynamicValues)
{
- ValueObject *dynamic_value = valobj->GetDynamicValue(true).get();
+ ValueObject *dynamic_value = valobj->GetDynamicValue(use_dynamic).get();
if (dynamic_value)
valobj = dynamic_value;
}
diff --git a/source/Core/ValueObjectDynamicValue.cpp b/source/Core/ValueObjectDynamicValue.cpp
index b43c651..ee50d45 100644
--- a/source/Core/ValueObjectDynamicValue.cpp
+++ b/source/Core/ValueObjectDynamicValue.cpp
@@ -34,10 +34,11 @@
using namespace lldb_private;
-ValueObjectDynamicValue::ValueObjectDynamicValue (ValueObject &parent) :
+ValueObjectDynamicValue::ValueObjectDynamicValue (ValueObject &parent, lldb::DynamicValueType use_dynamic) :
ValueObject(parent),
m_address (),
- m_type_sp()
+ m_type_sp(),
+ m_use_dynamic (use_dynamic)
{
SetName (parent.GetName().AsCString());
}
@@ -122,6 +123,14 @@
return false;
}
+ // Setting our type_sp to NULL will route everything back through our
+ // parent which is equivalent to not using dynamic values.
+ if (m_use_dynamic == lldb::eNoDynamicValues)
+ {
+ m_type_sp.reset();
+ return true;
+ }
+
ExecutionContext exe_ctx (GetExecutionContextScope());
if (exe_ctx.target)
@@ -144,19 +153,19 @@
{
LanguageRuntime *runtime = process->GetLanguageRuntime (known_type);
if (runtime)
- found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent, class_type_or_name, dynamic_address);
+ found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address);
}
else
{
LanguageRuntime *cpp_runtime = process->GetLanguageRuntime (lldb::eLanguageTypeC_plus_plus);
if (cpp_runtime)
- found_dynamic_type = cpp_runtime->GetDynamicTypeAndAddress (*m_parent, class_type_or_name, dynamic_address);
+ found_dynamic_type = cpp_runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address);
if (!found_dynamic_type)
{
LanguageRuntime *objc_runtime = process->GetLanguageRuntime (lldb::eLanguageTypeObjC);
if (objc_runtime)
- found_dynamic_type = cpp_runtime->GetDynamicTypeAndAddress (*m_parent, class_type_or_name, dynamic_address);
+ found_dynamic_type = cpp_runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address);
}
}
diff --git a/source/Interpreter/OptionGroupValueObjectDisplay.cpp b/source/Interpreter/OptionGroupValueObjectDisplay.cpp
index dac44b1..3150ea7 100644
--- a/source/Interpreter/OptionGroupValueObjectDisplay.cpp
+++ b/source/Interpreter/OptionGroupValueObjectDisplay.cpp
@@ -13,6 +13,8 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
+#include "lldb/Target/Target.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
using namespace lldb;
using namespace lldb_private;
@@ -28,6 +30,8 @@
static OptionDefinition
g_option_table[] =
{
+ { LLDB_OPT_SET_1, false, "dynamic-type", 'd', required_argument, TargetInstanceSettings::g_dynamic_value_types,
+ 0, eArgTypeNone, "Show the object as its full dynamic type, not its static type, if available."},
{ LLDB_OPT_SET_1, false, "depth", 'D', required_argument, NULL, 0, eArgTypeCount, "Set the max recurse depth when dumping aggregate types (default is infinity)."},
{ LLDB_OPT_SET_1, false, "flat", 'F', no_argument, NULL, 0, eArgTypeNone, "Display results in a flat format that uses expression paths for each variable or member."},
{ LLDB_OPT_SET_1, false, "location", 'L', no_argument, NULL, 0, eArgTypeNone, "Show variable location information."},
@@ -64,6 +68,17 @@
switch (short_option)
{
+ case 'd':
+ {
+ bool success;
+ int32_t result;
+ result = Args::StringToOptionEnum (option_arg, TargetInstanceSettings::g_dynamic_value_types, 2, &success);
+ if (!success)
+ error.SetErrorStringWithFormat("Invalid dynamic value setting: \"%s\".\n", option_arg);
+ else
+ use_dynamic = (lldb::DynamicValueType) result;
+ }
+ break;
case 'T': show_types = true; break;
case 'Y': show_summary = false; break;
case 'L': show_location= true; break;
@@ -99,5 +114,13 @@
use_objc = false;
max_depth = UINT32_MAX;
ptr_depth = 0;
-}
-
+
+ Target *target = interpreter.GetExecutionContext().target;
+ if (target != NULL)
+ use_dynamic = target->GetPreferDynamicValue();
+ else
+ {
+ // If we don't have any targets, then dynamic values won't do us much good.
+ use_dynamic = lldb::eNoDynamicValues;
+ }
+}
\ No newline at end of file
diff --git a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
index 20b608e..76a549a 100644
--- a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -41,7 +41,10 @@
}
bool
-ItaniumABILanguageRuntime::GetDynamicTypeAndAddress (ValueObject &in_value, TypeAndOrName &class_type_or_name, Address &dynamic_address)
+ItaniumABILanguageRuntime::GetDynamicTypeAndAddress (ValueObject &in_value,
+ lldb::DynamicValueType use_dynamic,
+ TypeAndOrName &class_type_or_name,
+ Address &dynamic_address)
{
// For Itanium, if the type has a vtable pointer in the object, it will be at offset 0
// in the object. That will point to the "address point" within the vtable (not the beginning of the
diff --git a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
index 966090d..d9d2600 100644
--- a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
+++ b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
@@ -31,7 +31,10 @@
IsVTableName (const char *name);
virtual bool
- GetDynamicTypeAndAddress (ValueObject &in_value, TypeAndOrName &class_type_or_name, Address &address);
+ GetDynamicTypeAndAddress (ValueObject &in_value,
+ lldb::DynamicValueType use_dynamic,
+ TypeAndOrName &class_type_or_name,
+ Address &address);
virtual bool
CouldHaveDynamicValue (ValueObject &in_value);
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index 62eac38..0d9d0bc 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -194,11 +194,18 @@
bool
AppleObjCRuntime::CouldHaveDynamicValue (ValueObject &in_value)
{
- return in_value.IsPointerType();
+ lldb::LanguageType known_type = in_value.GetObjectRuntimeLanguage();
+ if (known_type == lldb::eLanguageTypeObjC)
+ return true;
+ else
+ return in_value.IsPointerType();
}
bool
-AppleObjCRuntime::GetDynamicTypeAndAddress (ValueObject &in_value, TypeAndOrName &class_type_or_name, Address &address)
+AppleObjCRuntime::GetDynamicTypeAndAddress (ValueObject &in_value,
+ lldb::DynamicValueType use_dynamic,
+ TypeAndOrName &class_type_or_name,
+ Address &address)
{
return false;
}
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
index f3eb074..eff3af1 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
@@ -41,7 +41,10 @@
CouldHaveDynamicValue (ValueObject &in_value);
virtual bool
- GetDynamicTypeAndAddress (ValueObject &in_value, TypeAndOrName &class_type_or_name, Address &address);
+ GetDynamicTypeAndAddress (ValueObject &in_value,
+ lldb::DynamicValueType use_dynamic,
+ TypeAndOrName &class_type_or_name,
+ Address &address);
// These are the ObjC specific functions.
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
index fe29b62..a30e8e3 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
@@ -41,7 +41,10 @@
static const char *pluginShort = "language.apple.objc.v1";
bool
-AppleObjCRuntimeV1::GetDynamicTypeAndAddress (ValueObject &in_value, TypeAndOrName &class_type_or_name, Address &address)
+AppleObjCRuntimeV1::GetDynamicTypeAndAddress (ValueObject &in_value,
+ lldb::DynamicValueType use_dynamic,
+ TypeAndOrName &class_type_or_name,
+ Address &address)
{
return false;
}
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
index 7a43ca3..bbcc9c8 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
@@ -32,7 +32,10 @@
// These are generic runtime functions:
virtual bool
- GetDynamicTypeAndAddress (ValueObject &in_value, TypeAndOrName &class_type_or_name, Address &address);
+ GetDynamicTypeAndAddress (ValueObject &in_value,
+ lldb::DynamicValueType use_dynamic,
+ TypeAndOrName &class_type_or_name,
+ Address &address);
virtual ClangUtilityFunction *
CreateObjectChecker (const char *);
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 42e7aee..4d315f5 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -219,7 +219,10 @@
}
bool
-AppleObjCRuntimeV2::GetDynamicTypeAndAddress (ValueObject &in_value, TypeAndOrName &class_type_or_name, Address &address)
+AppleObjCRuntimeV2::GetDynamicTypeAndAddress (ValueObject &in_value,
+ lldb::DynamicValueType use_dynamic,
+ TypeAndOrName &class_type_or_name,
+ Address &address)
{
// The Runtime is attached to a particular process, you shouldn't pass in a value from another process.
assert (in_value.GetUpdatePoint().GetProcess() == m_process);
@@ -316,7 +319,7 @@
}
char class_buffer[1024];
- if (class_name == NULL)
+ if (class_name == NULL && use_dynamic != lldb::eDynamicDontRunTarget)
{
// If the class address didn't point into the binary, or
// it points into the right section but there wasn't a symbol
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
index 93395ff..0b45d7d 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
@@ -32,7 +32,10 @@
// These are generic runtime functions:
virtual bool
- GetDynamicTypeAndAddress (ValueObject &in_value, TypeAndOrName &class_type_or_name, Address &address);
+ GetDynamicTypeAndAddress (ValueObject &in_value,
+ lldb::DynamicValueType use_dynamic,
+ TypeAndOrName &class_type_or_name,
+ Address &address);
virtual ClangUtilityFunction *
CreateObjectChecker (const char *);
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
index 77a8318..9de258e 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -807,7 +807,8 @@
dispatch_values.PushValue (*(argument_values.GetValueAtIndex(sel_index)));
Value flag_value;
- lldb::clang_type_t clang_int_type = clang_ast_context->GetBuiltinTypeForEncodingAndBitSize(lldb::eEncodingSint, 32);
+ lldb::clang_type_t clang_int_type
+ = clang_ast_context->GetBuiltinTypeForEncodingAndBitSize(lldb::eEncodingSint, 32);
flag_value.SetValueType (Value::eValueTypeScalar);
flag_value.SetContext (Value::eContextTypeClangType, clang_int_type);
diff --git a/source/Target/StackFrame.cpp b/source/Target/StackFrame.cpp
index 169497a..cb4bbd4 100644
--- a/source/Target/StackFrame.cpp
+++ b/source/Target/StackFrame.cpp
@@ -486,14 +486,17 @@
}
ValueObjectSP
-StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, uint32_t options, Error &error)
+StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
+ lldb::DynamicValueType use_dynamic,
+ uint32_t options,
+ lldb::VariableSP &var_sp,
+ Error &error)
{
if (var_expr_cstr && var_expr_cstr[0])
{
const bool check_ptr_vs_member = (options & eExpressionPathOptionCheckPtrVsMember) != 0;
const bool no_fragile_ivar = (options & eExpressionPathOptionsNoFragileObjcIvar) != 0;
- const bool dynamic_value = (options & eExpressionPathOptionsDynamicValue) != 0;
error.Clear();
bool deref = false;
bool address_of = false;
@@ -526,10 +529,10 @@
else
name_const_string.SetCStringWithLength (var_path.c_str(), separator_idx);
- VariableSP var_sp (variable_list->FindVariable(name_const_string));
+ var_sp = variable_list->FindVariable(name_const_string);
if (var_sp)
{
- valobj_sp = GetValueObjectForFrameVariable (var_sp, dynamic_value);
+ valobj_sp = GetValueObjectForFrameVariable (var_sp, use_dynamic);
if (!valobj_sp)
return valobj_sp;
@@ -626,9 +629,9 @@
}
// Remove the child name from the path
var_path.erase(0, child_name.GetLength());
- if (dynamic_value)
+ if (use_dynamic != lldb::eNoDynamicValues)
{
- ValueObjectSP dynamic_value_sp(child_valobj_sp->GetDynamicValue(true));
+ ValueObjectSP dynamic_value_sp(child_valobj_sp->GetDynamicValue(use_dynamic));
if (dynamic_value_sp)
child_valobj_sp = dynamic_value_sp;
}
@@ -688,9 +691,9 @@
// %i is the array index
var_path.erase(0, (end - var_path.c_str()) + 1);
separator_idx = var_path.find_first_of(".-[");
- if (dynamic_value)
+ if (use_dynamic != lldb::eNoDynamicValues)
{
- ValueObjectSP dynamic_value_sp(child_valobj_sp->GetDynamicValue(true));
+ ValueObjectSP dynamic_value_sp(child_valobj_sp->GetDynamicValue(use_dynamic));
if (dynamic_value_sp)
child_valobj_sp = dynamic_value_sp;
}
@@ -738,7 +741,8 @@
}
else
{
- error.SetErrorStringWithFormat("no variable named '%s' found in this frame", name_const_string.GetCString());
+ error.SetErrorStringWithFormat("no variable named '%s' found in this frame",
+ name_const_string.GetCString());
}
}
}
@@ -809,7 +813,7 @@
ValueObjectSP
-StackFrame::GetValueObjectForFrameVariable (const VariableSP &variable_sp, bool use_dynamic)
+StackFrame::GetValueObjectForFrameVariable (const VariableSP &variable_sp, lldb::DynamicValueType use_dynamic)
{
ValueObjectSP valobj_sp;
VariableList *var_list = GetVariableList (true);
@@ -830,9 +834,9 @@
}
}
}
- if (use_dynamic && valobj_sp)
+ if (use_dynamic != lldb::eNoDynamicValues && valobj_sp)
{
- ValueObjectSP dynamic_sp = valobj_sp->GetDynamicValue (true);
+ ValueObjectSP dynamic_sp = valobj_sp->GetDynamicValue (use_dynamic);
if (dynamic_sp)
return dynamic_sp;
}
@@ -840,7 +844,7 @@
}
ValueObjectSP
-StackFrame::TrackGlobalVariable (const VariableSP &variable_sp, bool use_dynamic)
+StackFrame::TrackGlobalVariable (const VariableSP &variable_sp, lldb::DynamicValueType use_dynamic)
{
// Check to make sure we aren't already tracking this variable?
ValueObjectSP valobj_sp (GetValueObjectForFrameVariable (variable_sp, use_dynamic));
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index a023bf5..9f3a45e 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -890,7 +890,7 @@
StackFrame *frame,
bool unwind_on_error,
bool keep_in_memory,
- bool fetch_dynamic_value,
+ lldb::DynamicValueType use_dynamic,
lldb::ValueObjectSP &result_valobj_sp
)
{
@@ -905,7 +905,12 @@
Error error;
const uint32_t expr_path_options = StackFrame::eExpressionPathOptionCheckPtrVsMember |
StackFrame::eExpressionPathOptionsNoFragileObjcIvar;
- result_valobj_sp = frame->GetValueForVariableExpressionPath (expr_cstr, expr_path_options, error);
+ lldb::VariableSP var_sp;
+ result_valobj_sp = frame->GetValueForVariableExpressionPath (expr_cstr,
+ use_dynamic,
+ expr_path_options,
+ var_sp,
+ error);
}
else if (m_process_sp)
{
@@ -932,9 +937,9 @@
}
else
{
- if (fetch_dynamic_value)
+ if (use_dynamic != lldb::eNoDynamicValues)
{
- ValueObjectSP dynamic_sp = result_valobj_sp->GetDynamicValue(true);
+ ValueObjectSP dynamic_sp = result_valobj_sp->GetDynamicValue(use_dynamic);
if (dynamic_sp)
result_valobj_sp = dynamic_sp;
}
@@ -1390,7 +1395,7 @@
InstanceSettings (owner, name ? name : InstanceSettings::InvalidName().AsCString(), live_instance),
m_expr_prefix_file (),
m_expr_prefix_contents_sp (),
- m_prefer_dynamic_value (true, true),
+ m_prefer_dynamic_value (2),
m_skip_prologue (true, true),
m_source_map (NULL, NULL)
{
@@ -1486,7 +1491,10 @@
}
else if (var_name == GetSettingNameForPreferDynamicValue())
{
- err = UserSettingsController::UpdateBooleanOptionValue (value, op, m_prefer_dynamic_value);
+ int new_value;
+ UserSettingsController::UpdateEnumVariable (g_dynamic_value_types, &new_value, value, err);
+ if (err.Success())
+ m_prefer_dynamic_value = new_value;
}
else if (var_name == GetSettingNameForSkipPrologue())
{
@@ -1579,10 +1587,7 @@
}
else if (var_name == GetSettingNameForPreferDynamicValue())
{
- if (m_prefer_dynamic_value)
- value.AppendString ("true");
- else
- value.AppendString ("false");
+ value.AppendString (g_dynamic_value_types[m_prefer_dynamic_value].string_value);
}
else if (var_name == GetSettingNameForSkipPrologue())
{
@@ -1620,6 +1625,14 @@
//--------------------------------------------------
// Target::SettingsController Variable Tables
//--------------------------------------------------
+OptionEnumValueElement
+TargetInstanceSettings::g_dynamic_value_types[] =
+{
+{ eNoDynamicValues, "no-dynamic-values", "Don't calculate the dynamic type of values"},
+{ eDynamicCanRunTarget, "run-target", "Calculate the dynamic type of values even if you have to run the target."},
+{ eDynamicDontRunTarget, "no-run-target", "Calculate the dynamic type of values, but don't run the target."},
+{ 0, NULL, NULL }
+};
SettingEntry
Target::SettingsController::global_settings_table[] =
@@ -1633,11 +1646,11 @@
SettingEntry
Target::SettingsController::instance_settings_table[] =
{
- // var-name var-type default enum init'd hidden help-text
- // ================= ================== =========== ==== ====== ====== =========================================================================
- { TSC_EXPR_PREFIX , eSetVarTypeString , NULL , NULL, false, false, "Path to a file containing expressions to be prepended to all expressions." },
- { TSC_PREFER_DYNAMIC, eSetVarTypeBoolean ,"true" , NULL, false, false, "Should printed values be shown as their dynamic value." },
- { TSC_SKIP_PROLOGUE , eSetVarTypeBoolean ,"true" , NULL, false, false, "Skip function prologues when setting breakpoints by name." },
- { TSC_SOURCE_MAP , eSetVarTypeArray ,NULL , NULL, false, false, "Source path remappings to use when locating source files from debug information." },
- { NULL , eSetVarTypeNone , NULL , NULL, false, false, NULL }
+ // var-name var-type default enum init'd hidden help-text
+ // ================= ================== =============== ======================= ====== ====== =========================================================================
+ { TSC_EXPR_PREFIX , eSetVarTypeString , NULL , NULL, false, false, "Path to a file containing expressions to be prepended to all expressions." },
+ { TSC_PREFER_DYNAMIC, eSetVarTypeEnum , "no-run-target", g_dynamic_value_types, false, false, "Should printed values be shown as their dynamic value." },
+ { TSC_SKIP_PROLOGUE , eSetVarTypeBoolean ,"true" , NULL, false, false, "Skip function prologues when setting breakpoints by name." },
+ { TSC_SOURCE_MAP , eSetVarTypeArray ,NULL , NULL, false, false, "Source path remappings to use when locating source files from debug information." },
+ { NULL , eSetVarTypeNone , NULL , NULL, false, false, NULL }
};