[Lldb-commits] [lldb] [lldb][Windows] Remember server's primary stop thread on gdb-remote stops (PR #203525)
Charles Zablit via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 22 07:48:00 PDT 2026
charles-zablit wrote:
> The client kept the previously-selected thread across stops, ignoring the primary tid from the server in `T<sig>thread:<tid>`. On Windows, lldb-server halts the inferior by injecting a thread called `DbgUiRemoteBreakin` whose only job is to execute an int 3. After an interrupt, the process has `N+1` threads and the new one is what caused the stop. The server reports that thread as primary, but the client ignored it and stayed on whichever thread was selected before. In `TestExpressionInSyscall` that thread is main, paused just past `NtDelayExecution`'s syscall with a garbage value in the RSI register. Evaluating an expression there crashes the JIT trampoline.
>
> This patch makes `ProcessGDBRemote::RefreshStateAfterStop` record the primary tid from the most recent T-packet's `thread:<tid>` and select it after applying per thread stop infos.
>
> Fixes `TestBreakpointSetRestart` and `TestExpressionInSyscall` with LLDB_USE_LLDB_SERVER=1.
With the in-process / native plugin, lldb does not stop on the main thread, it stops on the injected one: https://github.com/llvm/llvm-project/blob/1ba7c9677649ed5072205c63532c1c2d5da38e13/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp#L340
This patch mirrors this.
https://github.com/llvm/llvm-project/pull/203525
More information about the lldb-commits
mailing list