Don't push null ExecutionContext on CommandInterp exectx stack

The driver can push a null ExecutionContext on to this stack,
and later calls to SBCommandInterpreter::HandleCommand which
don't specify an ExecutionContext can pull an entry from the
stack, resulting in settings that aren't applied.

Differential Revision: https://reviews.llvm.org/D111209
rdar://81489207
This commit is contained in:
Jason Molenda 2022-04-26 18:30:18 -07:00
parent 8dc8e59eba
commit a2681c4330
1 changed files with 9 additions and 3 deletions

View File

@ -3050,9 +3050,15 @@ void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler,
StartHandlingCommand();
OverrideExecutionContext(m_debugger.GetSelectedExecutionContext());
auto finalize = llvm::make_scope_exit([this]() {
RestoreExecutionContext();
ExecutionContext exe_ctx = m_debugger.GetSelectedExecutionContext();
bool pushed_exe_ctx = false;
if (exe_ctx.HasTargetScope()) {
OverrideExecutionContext(exe_ctx);
pushed_exe_ctx = true;
}
auto finalize = llvm::make_scope_exit([this, pushed_exe_ctx]() {
if (pushed_exe_ctx)
RestoreExecutionContext();
});
lldb_private::CommandReturnObject result(m_debugger.GetUseColor());