diff options
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index fa2be2c9efb..3f550883b29 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -63,6 +63,7 @@ CommandObjectExpression::CommandOptions::g_option_table[] = { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Specifies the Language to use when parsing the expression. If not set the target.language setting is used." }, { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "apply-fixits", 'X', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "If true, simple FixIt hints will be automatically applied to the expression." }, { LLDB_OPT_SET_1, false, "description-verbosity", 'v', OptionParser::eOptionalArgument, nullptr, g_description_verbosity_type, 0, eArgTypeDescriptionVerbosity, "How verbose should the output of this expression be, if the object description is asked for."}, + { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "top-level", 'p', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone, "Interpret the expression as top-level definitions rather than code to be immediately executed."} }; uint32_t @@ -149,6 +150,10 @@ CommandObjectExpression::CommandOptions::SetOptionValue (CommandInterpreter &int unwind_on_error = false; ignore_breakpoints = false; break; + + case 'p': + top_level = true; + break; case 'X': { @@ -191,6 +196,7 @@ CommandObjectExpression::CommandOptions::OptionParsingStarting (CommandInterpret language = eLanguageTypeUnknown; m_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityCompact; auto_apply_fixits = eLazyBoolCalculate; + top_level = false; } const OptionDefinition* @@ -315,6 +321,9 @@ CommandObjectExpression::EvaluateExpression(const char *expr, auto_apply_fixits = m_command_options.auto_apply_fixits == eLazyBoolYes ? true : false; options.SetAutoApplyFixIts(auto_apply_fixits); + + if (m_command_options.top_level) + options.SetExecutionPolicy(eExecutionPolicyTopLevel); // If there is any chance we are going to stop and want to see // what went wrong with our expression, we should generate debug info |