Issue 151891
Summary `gdb-remote` with a Unix socket does not work
Labels new issue
Assignees
Reporter jeras
    Running on Ubuntu 24.04:
```
$ lldb --version
lldb version 18.1.3
```

I am trying to connect to my custom GDB stub using a Unix socket (a file named `gdb_server_stub_socket`).
But it is either not supported, or not documented (works with `platform connect` but not with `gdb-remote`).

TCP works, but at least with GDB it is much slower than a Unix socket.

First the results of my attempt:
```
gdb-remote unix-connect:///home/.../gdb_server_stub_socket
error: gdb-remote [<hostname>:]<portnum>
```

To show that a connection is possible, I tried to set up a platform, but think my GDB server stub is far too primitive to be considered a platform.
```
(lldb) log enable gdb-remote packets
(lldb) platform select remote-gdb-server
  Platform: remote-gdb-server
 Connected: no
(lldb) platform connect unix-connect:///home/.../gdb_server_stub_socket
lldb             <   1> send packet: +
lldb             history[1] tid=0x1c95f3 <   1> send packet: +
lldb             <  19> send packet: $QStartNoAckMode#b0
lldb <   1> read packet: +
lldb             <   6> read packet: $OK#9a
lldb <   1> send packet: +
lldb             <  13> send packet: $qHostInfo#9b
lldb             <   4> read packet: $#00
lldb             < 18> send packet: $qGetWorkingDir#91
lldb             <   4> read packet: $#00
lldb             <  19> send packet: $qQueryGDBServer#cb
lldb <   4> read packet: $#00
  Platform: remote-gdb-server
  Hostname: (null)
 Connected: yes
(lldb) platform status
lldb             <  18> send packet: $qGetWorkingDir#91
lldb             <   4> read packet: $#00
 Platform: remote-gdb-server
  Hostname: (null)
 Connected: yes
```

And to show what I would like to achieve, here is an example connection over TCP.
The TCP speed might not have much of an impact on usability of the final setup, but it does bother me.

```
(lldb) gdb-remote 8000
lldb <   1> send packet: +
lldb             history[1] tid=0x1c95f3 <   1> send packet: +
lldb             <  19> send packet: $QStartNoAckMode#b0
lldb             <   1> read packet: +
lldb <   6> read packet: $OK#9a
lldb             <   1> send packet: +
lldb <  86> send packet: $qSupported:xmlRegisters=i386,arm,mips,arc;multiprocess+;fork-events+;vfork-events+#2e
lldb < 112> read packet: $QStartNoAckMode+;ReverseContinue+;ReverseStep+;binary-upload-;error-message+;hwbreak+;multiprocess-;swbreak+#b2
lldb <  26> send packet: $QThreadSuffixSupported#e4
lldb <   4> read packet: $#00
lldb             <  27> send packet: $QListThreadsInStopReply#21
lldb             <   4> read packet: $#00
lldb <  13> send packet: $qHostInfo#9b
lldb             <   4> read packet: $#00
lldb             <  10> send packet: $vCont?#49
lldb <   4> read packet: $#00
lldb             <  27> send packet: $qVAttachOrWaitSupported#38
lldb             <   4> read packet: $#00
lldb <  23> send packet: $QEnableErrorStrings#8c
lldb             < 4> read packet: $#00
lldb             <  16> send packet: $qProcessInfo#dc
lldb             <   4> read packet: $#00
lldb <   6> send packet: $qC#b4
lldb             <   4> read packet: $#00
lldb <  16> send packet: $qfThreadInfo#bb
lldb             <   4> read packet: $#00
lldb             <   5> send packet: $?#3f
lldb             < 7> read packet: $S05#b8
lldb             <  16> send packet: $qProcessInfo#dc
lldb             <   4> read packet: $#00
lldb <  16> send packet: $qProcessInfo#dc
lldb             <   4> read packet: $#00
lldb             <  18> send packet: $qRegisterInfo0#72
lldb <   4> read packet: $#00
lldb             <  16> send packet: $qfThreadInfo#bb
lldb             <   4> read packet: $#00
lldb <   7> send packet: $Hg1#e0
lldb             <   4> read packet: $#00
lldb <   6> send packet: $p0#a0
lldb             <  14> read packet: $p000000000#20
lldb             <  16> send packet: $qProcessInfo#dc
lldb <   4> read packet: $#00
lldb             <  16> send packet: $qProcessInfo#dc
lldb             <   4> read packet: $#00
lldb <  16> send packet: $qProcessInfo#dc
lldb             <   4> read packet: $#00
lldb             <  26> send packet: $qStructuredDataPlugins#02
lldb <   4> read packet: $#00
lldb             <  18> send packet: $qShlibInfoAddr#6a
lldb             <   4> read packet: $#00
lldb <  16> send packet: $qfThreadInfo#bb
lldb             <   4> read packet: $#00
lldb             <  16> send packet: $qfThreadInfo#bb
lldb <   4> read packet: $#00
dbg.evt-handler  <  16> send packet: $jThreadsInfo#c1
(lldb) dbg.evt-handler  <   4> read packet: $#00
dbg.evt-handler  <  24> send packet: $jThreadExtendedInfo:#b9
dbg.evt-handler  <   4> read packet: $#00
Process 1 stopped
* thread #1, stop reason = signal SIGTRAP
    frame #0: 0xffffffffffffffff 
(lldb) detach
lldb             <   5> send packet: $D#44
lldb             <   6> read packet: $OK#9a
Process 1 detached
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to