aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/API/SBCommandInterpreter.cpp
diff options
context:
space:
mode:
authorTatyana Krasnukha <tatyana@synopsys.com>2020-12-18 16:36:15 +0300
committerTatyana Krasnukha <tatyana@synopsys.com>2021-02-08 15:09:09 +0300
commit36de94cf54efbad967a9a0fa41329a8b59bc35c4 (patch)
tree247b40f741e8a9e43cffda9ab5b0ac595a0b130e /lldb/source/API/SBCommandInterpreter.cpp
parenta39bcbca92e169baeb8b2c55dff90141ddd53888 (diff)
downloadllvm-36de94cf54efbad967a9a0fa41329a8b59bc35c4.zip
llvm-36de94cf54efbad967a9a0fa41329a8b59bc35c4.tar.gz
llvm-36de94cf54efbad967a9a0fa41329a8b59bc35c4.tar.bz2
Reland "[lldb] Make CommandInterpreter's execution context the same as debugger's one"
Diffstat (limited to 'lldb/source/API/SBCommandInterpreter.cpp')
-rw-r--r--lldb/source/API/SBCommandInterpreter.cpp37
1 files changed, 16 insertions, 21 deletions
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp
index 31e7da8..d28bc41 100644
--- a/lldb/source/API/SBCommandInterpreter.cpp
+++ b/lldb/source/API/SBCommandInterpreter.cpp
@@ -171,27 +171,23 @@ 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);
- m_opaque_ptr->HandleCommand(command_line,
- add_to_history ? eLazyBoolYes : eLazyBoolNo,
- result.ref(), ctx_ptr);
+ 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());
} else {
result->AppendError(
"SBCommandInterpreter or the command line is not valid");
result->SetStatus(eReturnStatusFailed);
}
-
return result.GetStatus();
}
@@ -219,15 +215,14 @@ void SBCommandInterpreter::HandleCommandsFromFile(
}
FileSpec tmp_spec = file.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());
+ 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());
}
int SBCommandInterpreter::HandleCompletion(