diff options
author | Pavel Labath <pavel@labath.sk> | 2020-12-17 17:10:17 +0100 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2020-12-17 17:47:53 +0100 |
commit | 122a4ebde3f4394a84e9f93b9c7085f088be6dd7 (patch) | |
tree | 0cdf9c43e826c3e4d159e06b854520d837efe9ea /lldb/source/API/SBCommandInterpreter.cpp | |
parent | f50066292477fb26806336e5604615d0eddde399 (diff) | |
download | llvm-122a4ebde3f4394a84e9f93b9c7085f088be6dd7.zip llvm-122a4ebde3f4394a84e9f93b9c7085f088be6dd7.tar.gz llvm-122a4ebde3f4394a84e9f93b9c7085f088be6dd7.tar.bz2 |
Revert "[lldb] Make CommandInterpreter's execution context the same as debugger's one."
This reverts commit a01b26fb51c710a3a8ef88cc83b0701461f5b9ab, because it
breaks the "finish" command in some way -- the command does not
terminate after it steps out, but continues running the target. The
exact blast radius is not clear, but it at least affects the usage of
the "finish" command in TestGuiBasicDebug.py. The error is *not*
gui-related, as the same issue can be reproduced by running the same
steps outside of the gui.
There is some kind of a race going on, as the test fails only 20% of the
time on the buildbot.
Diffstat (limited to 'lldb/source/API/SBCommandInterpreter.cpp')
-rw-r--r-- | lldb/source/API/SBCommandInterpreter.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index d28bc41..31e7da8 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -171,23 +171,27 @@ lldb::ReturnStatus SBCommandInterpreter::HandleCommand( lldb::SBCommandReturnObject &, bool), command_line, override_context, result, add_to_history); + + ExecutionContext ctx, *ctx_ptr; + if (override_context.get()) { + ctx = override_context.get()->Lock(true); + ctx_ptr = &ctx; + } else + ctx_ptr = nullptr; + result.Clear(); if (command_line && IsValid()) { result.ref().SetInteractive(false); - auto do_add_to_history = add_to_history ? eLazyBoolYes : eLazyBoolNo; - if (override_context.get()) - m_opaque_ptr->HandleCommand(command_line, do_add_to_history, - override_context.get()->Lock(true), - result.ref()); - else - m_opaque_ptr->HandleCommand(command_line, do_add_to_history, - result.ref()); + m_opaque_ptr->HandleCommand(command_line, + add_to_history ? eLazyBoolYes : eLazyBoolNo, + result.ref(), ctx_ptr); } else { result->AppendError( "SBCommandInterpreter or the command line is not valid"); result->SetStatus(eReturnStatusFailed); } + return result.GetStatus(); } @@ -215,14 +219,15 @@ void SBCommandInterpreter::HandleCommandsFromFile( } FileSpec tmp_spec = file.ref(); - if (override_context.get()) - m_opaque_ptr->HandleCommandsFromFile(tmp_spec, - override_context.get()->Lock(true), - options.ref(), - result.ref()); - - else - m_opaque_ptr->HandleCommandsFromFile(tmp_spec, options.ref(), result.ref()); + ExecutionContext ctx, *ctx_ptr; + if (override_context.get()) { + ctx = override_context.get()->Lock(true); + ctx_ptr = &ctx; + } else + ctx_ptr = nullptr; + + m_opaque_ptr->HandleCommandsFromFile(tmp_spec, ctx_ptr, options.ref(), + result.ref()); } int SBCommandInterpreter::HandleCompletion( |