LLDB does not support GDB's "extended-remote" mode
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
LLDB sessions are started in one of two ways. Let's assume we're using lldb and lldb-server (debugserver has no platform mode).
1. You have lldb start an lldb-server for you, which is debugging some program. Or you start lldb-server manually and tell lldb to connect to it. The result is the same. One lldb-server that's debugging one program and when the client disconnects, lldb-server also exits. This is also how most people use gdb / gdbserver.
2. You start an lldb-server in "platform" mode and tell lldb to connect to that with `platform select` / `platform connect`. Then you tell the platform to debug a process. How it does that is by spawning a new lldb-server in mode number 1, then telling lldb how to connect to that new lldb-server. On disconnect, that new server quits, but the platform stays running. (see https://lldb.llvm.org/use/remote.html)
In other words, method 1 is 1 to 1 and shortlived. Method 2 is many to many and longlived.
GDB has mode 1 but not mode 2 as far as I know. What it has instead is an in between called "extended-remote" which we do not currently support.
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Connecting.html
As I understand it, in this mode gdb does not change what it's connect to but there are ways to tell the single gdbserver to switch to a new debugee or stop debugging a debugee.
A user in https://github.com/llvm/llvm-project/issues/196535 tried to use lldb with an extended-remote stub and had issues because:
* In theory they could manually send extended-remote packets with `process plugin packet send`, but this requires that you have a process plugin loaded.
* That means connecting with `gdb-remote` which acts like method 1. However when they do that, lldb gets confused, likely because there is no debugee on the other end to query.
Maybe they can work around that but the overall issue here is that we do not support this extended-remote mode.
I do not intend to pursue this myself, but someone might and I'm opening this to document the limitation better than random connection failures will do.
Contributor guide
Research direction
The issue names no source files or tests. Start with LLDB's remote connection flow and the linked remote debugging documentation, then compare gdb-remote handling with GDB's extended-remote behavior; done means LLDB can connect to and control an extended-remote stub without the described failures.
Written by the indexing model from the issue text.
Assessment
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100