diff options
author | Sean Callanan <scallanan@apple.com> | 2011-09-15 02:13:07 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2011-09-15 02:13:07 +0000 |
commit | 3bfdaa2a4735262a1d246ced4db906a3531ba330 (patch) | |
tree | 8ff56a95ada43dd7cee0482eb3400462c7eb9054 /lldb/source/Commands/CommandObjectExpression.cpp | |
parent | 5acab501de113acb4c0d28b48e76c27631ba0904 (diff) | |
download | bcm5719-llvm-3bfdaa2a4735262a1d246ced4db906a3531ba330.tar.gz bcm5719-llvm-3bfdaa2a4735262a1d246ced4db906a3531ba330.zip |
This patch modifies the expression parser to allow it
to execute expressions even in the absence of a process.
This allows expressions to run in situations where the
target cannot run -- e.g., to perform calculations based
on type information, or to inspect a binary's static
data.
This modification touches the following files:
lldb-private-enumerations.h
Introduce a new enum specifying the policy for
processing an expression. Some expressions should
always be JITted, for example if they are functions
that will be used over and over again. Some
expressions should always be interpreted, for
example if the target is unsafe to run. For most,
it is acceptable to JIT them, but interpretation
is preferable when possible.
Target.[h,cpp]
Have EvaluateExpression now accept the new enum.
ClangExpressionDeclMap.[cpp,h]
Add support for the IR interpreter and also make
the ClangExpressionDeclMap more robust in the
absence of a process.
ClangFunction.[cpp,h]
Add support for the new enum.
IRInterpreter.[cpp,h]
New implementation.
ClangUserExpression.[cpp,h]
Add support for the new enum, and for running
expressions in the absence of a process.
ClangExpression.h
Remove references to the old DWARF-based method
of evaluating expressions, because it has been
superseded for now.
ClangUtilityFunction.[cpp,h]
Add support for the new enum.
ClangExpressionParser.[cpp,h]
Add support for the new enum, remove references
to DWARF, and add support for checking whether
the expression could be evaluated statically.
IRForTarget.[h,cpp]
Add support for the new enum, and add utility
functions to support the interpreter.
IRToDWARF.cpp
Removed
CommandObjectExpression.cpp
Remove references to the obsolete -i option.
Process.cpp
Modify calls to ClangUserExpression::Evaluate
to pass the correct enum (for dlopen/dlclose)
SBValue.cpp
Add support for the new enum.
SBFrame.cpp
Add support for he new enum.
BreakpointOptions.cpp
Add support for the new enum.
llvm-svn: 139772
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 4be9b8de3ad..cd6474c658e 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -95,12 +95,13 @@ CommandObjectExpression::CommandOptions::SetOptionValue (uint32_t option_idx, co break; case 'u': - bool success; - unwind_on_error = Args::StringToBoolean(option_arg, true, &success); - if (!success) - error.SetErrorStringWithFormat("Could not convert \"%s\" to a boolean value.", option_arg); - break; - + { + bool success; + unwind_on_error = Args::StringToBoolean(option_arg, true, &success); + if (!success) + error.SetErrorStringWithFormat("Could not convert \"%s\" to a boolean value.", option_arg); + break; + } default: error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); break; @@ -292,7 +293,13 @@ CommandObjectExpression::EvaluateExpression break; } - 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); + exe_results = m_exe_ctx.target->EvaluateExpression(expr, + m_exe_ctx.frame, + eExecutionPolicyOnlyWhenNeeded, + m_options.unwind_on_error, + keep_in_memory, + use_dynamic, + result_valobj_sp); if (exe_results == eExecutionInterrupted && !m_options.unwind_on_error) { @@ -488,7 +495,6 @@ CommandObjectExpression::CommandOptions::g_option_table[] = { LLDB_OPT_SET_2, false, "dynamic-value", 'd', required_argument, NULL, 0, eArgTypeBoolean, "Upcast the value resulting from the expression to its dynamic type if available."}, { LLDB_OPT_SET_ALL, false, "unwind-on-error", 'u', required_argument, NULL, 0, eArgTypeBoolean, "Clean up program state if the expression causes a crash, breakpoint hit or signal."}, { LLDB_OPT_SET_ALL, false, "debug", 'g', no_argument, NULL, 0, eArgTypeNone, "Enable verbose debug logging of the expression parsing and evaluation."}, -{ LLDB_OPT_SET_ALL, false, "use-ir", 'i', no_argument, NULL, 0, eArgTypeNone, "[Temporary] Instructs the expression evaluator to use IR instead of ASTs."}, { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL } }; |