[Lldb-commits] [lldb] [lldb] Multithreading lldb-server works on Windows now; fixed gdb port mapping (PR #100670)

Dmitry Vasilyev via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 29 10:58:31 PDT 2024


slydiman wrote:

@labath It seems we do not need qSupported and qUpgradeToGdbConnection. We can run
`lldb-server platform --server --listen 1234 --gdbserver-port 1235`

Option 1:
On receiving qLaunchGDBServer we can
- fork the child process to know the new pid
- send the response with the pid and port 1235
- wait for the connection on the port 1235 for 10 seconds
  - kill the child process if no connection accepted in 10 seconds
  - execve `lldb-server gdbserver --fd x` where x is fd of the accepted connection
We need a pipe for communication between the main `lldb-server platform` process and the forked child process within 10 secconds. But unfortunately this scenario is impossible on Windows because of fork() is missing. 

Option 2:
It seems PlatformRemoteGDBServer uses `debugserver_pid` only to kill the gdbserver process if connection failed. 
It seems we can just do nothing and respond `pid:0;port:1235;` to `qLaunchGDBServer`. Then listen the port 1235 and launch `lldb-server gdbserver --fd x` when a connection is accepted. `lldb-server gdbserver` must exit if the connection x is closed.

https://github.com/llvm/llvm-project/pull/100670


More information about the lldb-commits mailing list