From 19d761478bdad5615e3f3c7f4a1b71c1c698725b Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Fri, 11 Apr 2025 16:56:53 -0700 Subject: [PATCH] =?UTF-8?q?Revert=20"Revert=20"[lldb]=20Make=20sure=20the?= =?UTF-8?q?=20process=20is=20stopped=20when=20computing=20the=20sy?= =?UTF-8?q?=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 179d30f8c3fddd3c85056fd2b8e877a4a8513158. --- lldb/source/Core/Statusline.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lldb/source/Core/Statusline.cpp b/lldb/source/Core/Statusline.cpp index ed5308ef53eb0..e14691e2538a2 100644 --- a/lldb/source/Core/Statusline.cpp +++ b/lldb/source/Core/Statusline.cpp @@ -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())