aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp33
1 files changed, 8 insertions, 25 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 9f1f520..dcff53f 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2471,7 +2471,7 @@ PlatformSP CommandInterpreter::GetPlatform(bool prefer_target_platform) {
return platform_sp;
}
-bool CommandInterpreter::DidProcessStopAbnormally() {
+bool CommandInterpreter::DidProcessStopAbnormally() const {
auto exe_ctx = GetExecutionContext();
TargetSP target_sp = exe_ctx.GetTargetSP();
if (!target_sp)
@@ -2976,22 +2976,10 @@ void CommandInterpreter::FindCommandsForApropos(llvm::StringRef search_word,
m_alias_dict);
}
-ExecutionContext CommandInterpreter::GetExecutionContext() {
- ExecutionContext exe_ctx;
- if (!m_overriden_exe_contexts.empty()) {
- // During the course of a command, the target may have replaced the process
- // coming in with another. I fix that here:
- exe_ctx = m_overriden_exe_contexts.top();
- // Don't use HasProcessScope, that returns false if there is a process but
- // it's no longer valid, which is one of the cases we want to catch here.
- if (exe_ctx.HasTargetScope() && exe_ctx.GetProcessPtr()) {
- ProcessSP actual_proc_sp = exe_ctx.GetTargetSP()->GetProcessSP();
- if (actual_proc_sp != exe_ctx.GetProcessSP())
- m_overriden_exe_contexts.top().SetContext(actual_proc_sp);
- }
- return m_overriden_exe_contexts.top();
- }
- return m_debugger.GetSelectedExecutionContext();
+ExecutionContext CommandInterpreter::GetExecutionContext() const {
+ return !m_overriden_exe_contexts.empty()
+ ? m_overriden_exe_contexts.top()
+ : m_debugger.GetSelectedExecutionContext();
}
void CommandInterpreter::OverrideExecutionContext(
@@ -3184,17 +3172,12 @@ void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler,
}
bool CommandInterpreter::IOHandlerInterrupt(IOHandler &io_handler) {
- // InterruptCommand returns true if this is the first time
- // we initiate an interrupt for this command. So we give the
- // command a chance to handle the interrupt on the first
- // interrupt, but if that didn't do anything, a second
- // interrupt will do more work to halt the process/interpreter.
- if (InterruptCommand())
- return true;
-
ExecutionContext exe_ctx(GetExecutionContext());
Process *process = exe_ctx.GetProcessPtr();
+ if (InterruptCommand())
+ return true;
+
if (process) {
StateType state = process->GetState();
if (StateIsRunningState(state)) {