From 58a93a1eec10d30dfa358afda73f402fb308a5e4 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 29 Jul 2026 13:13:00 -0500 Subject: [PATCH] [lldb-mcp] Run managed debug sessions synchronously (#212681) A debugger created for an MCP session has no event loop to service asynchronous stops, so a resume returned before the process stopped and every subsequent command failed against a still-running process. That made breakpoint debugging unusable: `run` reported only the launch, and `bt` that followed it errored out. Create these debuggers in synchronous mode, as lldb-dap does. --- lldb/source/Plugins/Protocol/MCP/Tool.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lldb/source/Plugins/Protocol/MCP/Tool.cpp b/lldb/source/Plugins/Protocol/MCP/Tool.cpp index 7a5c114c5711..ec4599bf040a 100644 --- a/lldb/source/Plugins/Protocol/MCP/Tool.cpp +++ b/lldb/source/Plugins/Protocol/MCP/Tool.cpp @@ -183,6 +183,10 @@ DebuggerCreateTool::Call(const lldb_protocol::mcp::ToolArguments &) { debugger_sp->SetOutputFile(out); debugger_sp->SetErrorFile(out); + // A debugger driven over MCP has no event loop to service asynchronous + // stops, so a resume must not return before the process has stopped. + debugger_sp->SetAsyncExecution(false); + return createTextResult(to_uri(debugger_sp)); }