diff options
author | Greg Clayton <gclayton@apple.com> | 2013-11-04 19:35:17 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-11-04 19:35:17 +0000 |
commit | 62afb9f663be1f80d80e3b25ba5fe69245bd28b9 (patch) | |
tree | e6fa5fdcf76c3390c4a8986098eb2be5d82616b9 /lldb/source/Commands/CommandObjectExpression.cpp | |
parent | cfcfee0be4fef4061834a0eabbf33b63074efec3 (diff) | |
download | bcm5719-llvm-62afb9f663be1f80d80e3b25ba5fe69245bd28b9.tar.gz bcm5719-llvm-62afb9f663be1f80d80e3b25ba5fe69245bd28b9.zip |
Added a "--debug" option to the "expression" command.
Cleaned up ClangUserExpression::Evaluate() to have only one variant that takes a "const EvaluateExpressionOptions& options" instead of taking many arguments.
The "--debug" option is designed to allow you to debug your expression by stopping at the first instruction (it enables --ignore-breakpoints=true and --unwind-on-error=false) and allowing you to step through your JIT code. It needs to be more integrated with the thread plan, so I am checking this in so Jim Ingham can make it happen.
llvm-svn: 194009
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 8b04da600f4..6d44f71b8d9 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -64,6 +64,7 @@ CommandObjectExpression::CommandOptions::g_option_table[] = { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "ignore-breakpoints", 'i', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Ignore breakpoint hits while running expressions"}, { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "timeout", 't', OptionParser::eRequiredArgument, NULL, 0, eArgTypeUnsignedInteger, "Timeout value (in microseconds) for running the expression."}, { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "unwind-on-error", 'u', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Clean up program state if the expression causes a crash, or raises a signal. Note, unlike gdb hitting a breakpoint is controlled by another option (-i)."}, + { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "debug", 'g', OptionParser::eNoArgument , NULL, 0, eArgTypeNone, "When specified, debug the JIT code by setting a breakpoint on the first instruction and forcing breakpoints to not be ignored (-i0) and no unwinding to happen on error (-u0)."}, { LLDB_OPT_SET_1, false, "description-verbosity", 'v', OptionParser::eOptionalArgument, g_description_verbosity_type, 0, eArgTypeDescriptionVerbosity, "How verbose should the output of this expression be, if the object description is asked for."}, }; @@ -147,7 +148,13 @@ CommandObjectExpression::CommandOptions::SetOptionValue (CommandInterpreter &int if (!error.Success()) error.SetErrorStringWithFormat ("unrecognized value for description-verbosity '%s'", option_arg); break; - + + case 'g': + debug = true; + unwind_on_error = false; + ignore_breakpoints = false; + break; + default: error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; @@ -174,6 +181,7 @@ CommandObjectExpression::CommandOptions::OptionParsingStarting (CommandInterpret show_summary = true; try_all_threads = true; timeout = 0; + debug = false; m_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityCompact; } @@ -361,7 +369,10 @@ CommandObjectExpression::EvaluateExpression .SetKeepInMemory(keep_in_memory) .SetUseDynamic(m_varobj_options.use_dynamic) .SetRunOthers(m_command_options.try_all_threads) - .SetTimeoutUsec(m_command_options.timeout); + .SetDebug(m_command_options.debug); + + if (m_command_options.timeout > 0) + options.SetTimeoutUsec(m_command_options.timeout); exe_results = target->EvaluateExpression (expr, exe_ctx.GetFramePtr(), |