[lldb] Make sure the process is stopped when computing the symbol context (#135458)
Make sure the process is stopped when computing the symbol context. Both Adrian and Felipe reported a handful of crashes in GetSymbolContext called from Statusline::Redraw on the default event thread. Given that we're handling a StackFrameSP, it's not clear to me how that could have gotten invalidated, but Jim points out that it doesn't make sense to compute the symbol context for the frame when the process isn't stopped. Depends on #135455
This commit is contained in:
parent
d792094c26
commit
73b554d7a0
@ -12,6 +12,7 @@
|
||||
#include "lldb/Host/StreamFile.h"
|
||||
#include "lldb/Interpreter/CommandInterpreter.h"
|
||||
#include "lldb/Symbol/SymbolContext.h"
|
||||
#include "lldb/Target/Process.h"
|
||||
#include "lldb/Target/StackFrame.h"
|
||||
#include "lldb/Utility/AnsiTerminal.h"
|
||||
#include "lldb/Utility/StreamString.h"
|
||||
@ -134,8 +135,15 @@ void Statusline::Redraw(bool update) {
|
||||
exe_ctx.SetTargetPtr(&m_debugger.GetSelectedOrDummyTarget());
|
||||
|
||||
SymbolContext symbol_ctx;
|
||||
if (auto frame_sp = exe_ctx.GetFrameSP())
|
||||
symbol_ctx = frame_sp->GetSymbolContext(eSymbolContextEverything);
|
||||
if (ProcessSP process_sp = exe_ctx.GetProcessSP()) {
|
||||
// Check if the process is stopped, and if it is, make sure it remains
|
||||
// stopped until we've computed the symbol context.
|
||||
Process::StopLocker stop_locker;
|
||||
if (stop_locker.TryLock(&process_sp->GetRunLock())) {
|
||||
if (auto frame_sp = exe_ctx.GetFrameSP())
|
||||
symbol_ctx = frame_sp->GetSymbolContext(eSymbolContextEverything);
|
||||
}
|
||||
}
|
||||
|
||||
StreamString stream;
|
||||
if (auto *format = m_debugger.GetStatuslineFormat())
|
||||
|
Loading…
x
Reference in New Issue
Block a user