|
12 | 12 | #include "lldb/Host/StreamFile.h"
|
13 | 13 | #include "lldb/Interpreter/CommandInterpreter.h"
|
14 | 14 | #include "lldb/Symbol/SymbolContext.h"
|
| 15 | +#include "lldb/Target/Process.h" |
15 | 16 | #include "lldb/Target/StackFrame.h"
|
16 | 17 | #include "lldb/Utility/AnsiTerminal.h"
|
17 | 18 | #include "lldb/Utility/StreamString.h"
|
@@ -126,19 +127,25 @@ void Statusline::Redraw(bool update) {
|
126 | 127 | return;
|
127 | 128 | }
|
128 | 129 |
|
129 |
| - StreamString stream; |
130 |
| - ExecutionContext exe_ctx = |
131 |
| - m_debugger.GetCommandInterpreter().GetExecutionContext(); |
| 130 | + ExecutionContext exe_ctx = m_debugger.GetSelectedExecutionContext(); |
132 | 131 |
|
133 | 132 | // For colors and progress events, the format entity needs access to the
|
134 | 133 | // debugger, which requires a target in the execution context.
|
135 | 134 | if (!exe_ctx.HasTargetScope())
|
136 | 135 | exe_ctx.SetTargetPtr(&m_debugger.GetSelectedOrDummyTarget());
|
137 | 136 |
|
138 | 137 | SymbolContext symbol_ctx;
|
139 |
| - if (auto frame_sp = exe_ctx.GetFrameSP()) |
140 |
| - symbol_ctx = frame_sp->GetSymbolContext(eSymbolContextEverything); |
| 138 | + if (ProcessSP process_sp = exe_ctx.GetProcessSP()) { |
| 139 | + // Check if the process is stopped, and if it is, make sure it remains |
| 140 | + // stopped until we've computed the symbol context. |
| 141 | + Process::StopLocker stop_locker; |
| 142 | + if (stop_locker.TryLock(&process_sp->GetRunLock())) { |
| 143 | + if (auto frame_sp = exe_ctx.GetFrameSP()) |
| 144 | + symbol_ctx = frame_sp->GetSymbolContext(eSymbolContextEverything); |
| 145 | + } |
| 146 | + } |
141 | 147 |
|
| 148 | + StreamString stream; |
142 | 149 | if (auto *format = m_debugger.GetStatuslineFormat())
|
143 | 150 | FormatEntity::Format(*format, stream, &symbol_ctx, &exe_ctx, nullptr,
|
144 | 151 | nullptr, false, false);
|
|
0 commit comments