aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectExpression.cpp
diff options
context:
space:
mode:
authorMarianne Mailhot-Sarrasin <marianne.mailhot.sarrasin@gmail.com>2016-05-12 20:00:53 +0000
committerMarianne Mailhot-Sarrasin <marianne.mailhot.sarrasin@gmail.com>2016-05-12 20:00:53 +0000
commit3fe71581743ceb838b113ee728e6de7f7ee8d25d (patch)
treec87db2d9a24ac05559c2a4b0da0e8cb2d4e1b06d /lldb/source/Commands/CommandObjectExpression.cpp
parentbc8397cdf0a76c614e53dc1deede78b0e568f753 (diff)
downloadllvm-3fe71581743ceb838b113ee728e6de7f7ee8d25d.zip
llvm-3fe71581743ceb838b113ee728e6de7f7ee8d25d.tar.gz
llvm-3fe71581743ceb838b113ee728e6de7f7ee8d25d.tar.bz2
[LLDB] Added support for PHI nodes to IR interpreter
This allows expressions such as 'i == 1 || i == 2` to be executed using the IR interpreter, instead of relying on JIT code injection (which may not be available on some platforms). Patch by cameron314 Differential Revision: http://reviews.llvm.org/D19124 llvm-svn: 269340
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index ff350a5..1b890c5 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -63,7 +63,8 @@ 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."}
+ { 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."},
+ { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "allow-jit", 'j', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Controls whether the expression can fall back to being JITted if it's not supported by the interpreter (defaults to true)."}
};
uint32_t
@@ -111,6 +112,18 @@ CommandObjectExpression::CommandOptions::SetOptionValue (CommandInterpreter &int
error.SetErrorStringWithFormat("could not convert \"%s\" to a boolean value.", option_arg);
break;
}
+
+ case 'j':
+ {
+ bool success;
+ bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
+ if (success)
+ allow_jit = tmp_value;
+ else
+ error.SetErrorStringWithFormat("could not convert \"%s\" to a boolean value.", option_arg);
+ break;
+ }
+
case 't':
{
bool success;
@@ -197,6 +210,7 @@ CommandObjectExpression::CommandOptions::OptionParsingStarting (CommandInterpret
m_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityCompact;
auto_apply_fixits = eLazyBoolCalculate;
top_level = false;
+ allow_jit = true;
}
const OptionDefinition*
@@ -325,6 +339,9 @@ CommandObjectExpression::EvaluateExpression(const char *expr,
options.SetTryAllThreads(m_command_options.try_all_threads);
options.SetDebug(m_command_options.debug);
options.SetLanguage(m_command_options.language);
+ options.SetExecutionPolicy(m_command_options.allow_jit ?
+ EvaluateExpressionOptions::default_execution_policy :
+ lldb_private::eExecutionPolicyNever);
bool auto_apply_fixits;
if (m_command_options.auto_apply_fixits == eLazyBoolCalculate)