|
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"
|
@@ -119,19 +120,25 @@ void Statusline::Redraw(bool update) {
|
119 | 120 | return;
|
120 | 121 | }
|
121 | 122 |
|
122 |
| - StreamString stream; |
123 |
| - ExecutionContext exe_ctx = |
124 |
| - m_debugger.GetCommandInterpreter().GetExecutionContext(); |
| 123 | + ExecutionContext exe_ctx = m_debugger.GetSelectedExecutionContext(); |
125 | 124 |
|
126 | 125 | // For colors and progress events, the format entity needs access to the
|
127 | 126 | // debugger, which requires a target in the execution context.
|
128 | 127 | if (!exe_ctx.HasTargetScope())
|
129 | 128 | exe_ctx.SetTargetPtr(&m_debugger.GetSelectedOrDummyTarget());
|
130 | 129 |
|
131 | 130 | SymbolContext symbol_ctx;
|
132 |
| - if (auto frame_sp = exe_ctx.GetFrameSP()) |
133 |
| - symbol_ctx = frame_sp->GetSymbolContext(eSymbolContextEverything); |
| 131 | + if (ProcessSP process_sp = exe_ctx.GetProcessSP()) { |
| 132 | + // Check if the process is stopped, and if it is, make sure it remains |
| 133 | + // stopped until we've computed the symbol context. |
| 134 | + Process::StopLocker stop_locker; |
| 135 | + if (stop_locker.TryLock(&process_sp->GetRunLock())) { |
| 136 | + if (auto frame_sp = exe_ctx.GetFrameSP()) |
| 137 | + symbol_ctx = frame_sp->GetSymbolContext(eSymbolContextEverything); |
| 138 | + } |
| 139 | + } |
134 | 140 |
|
| 141 | + StreamString stream; |
135 | 142 | if (auto *format = m_debugger.GetStatuslineFormat())
|
136 | 143 | FormatEntity::Format(*format, stream, &symbol_ctx, &exe_ctx, nullptr,
|
137 | 144 | nullptr, false, false);
|
|
0 commit comments