diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-03-09 00:10:52 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-03-09 00:10:52 +0000 |
commit | c5bfa3dafb3e7ccc871734a96b7a9188868d925a (patch) | |
tree | 9c5d2d797435bdfbdfad48f8f8be1f36725ae4d0 /lldb/source/Commands/CommandObjectExpression.cpp | |
parent | cee6c47a62c4d043c00eed860dc3900ad180b067 (diff) | |
download | bcm5719-llvm-c5bfa3dafb3e7ccc871734a96b7a9188868d925a.tar.gz bcm5719-llvm-c5bfa3dafb3e7ccc871734a96b7a9188868d925a.zip |
Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands
Inspired by Zachary's mail on lldb-dev, this seemed like low hanging
fruit. This patch breaks the circular dependency between commands and
expression.
Differential revision: https://reviews.llvm.org/D59158
llvm-svn: 355762
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 948a874895f..d59b7812541 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -571,6 +571,29 @@ void CommandObjectExpression::GetMultilineExpression() { debugger.PushIOHandler(io_handler_sp); } +static EvaluateExpressionOptions +GetExprOptions(ExecutionContext &ctx, + CommandObjectExpression::CommandOptions command_options) { + command_options.OptionParsingStarting(&ctx); + + // Default certain settings for REPL regardless of the global settings. + command_options.unwind_on_error = false; + command_options.ignore_breakpoints = false; + command_options.debug = false; + + EvaluateExpressionOptions expr_options; + expr_options.SetUnwindOnError(command_options.unwind_on_error); + expr_options.SetIgnoreBreakpoints(command_options.ignore_breakpoints); + expr_options.SetTryAllThreads(command_options.try_all_threads); + + if (command_options.timeout > 0) + expr_options.SetTimeout(std::chrono::microseconds(command_options.timeout)); + else + expr_options.SetTimeout(llvm::None); + + return expr_options; +} + bool CommandObjectExpression::DoExecute(llvm::StringRef command, CommandReturnObject &result) { m_fixed_expression.clear(); @@ -626,7 +649,8 @@ bool CommandObjectExpression::DoExecute(llvm::StringRef command, if (repl_sp) { if (initialize) { - repl_sp->SetCommandOptions(m_command_options); + repl_sp->SetEvaluateOptions( + GetExprOptions(exe_ctx, m_command_options)); repl_sp->SetFormatOptions(m_format_options); repl_sp->SetValueObjectDisplayOptions(m_varobj_options); } |