diff options
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( |