Issue 63468
Summary lldb-server fails to find gdbremote stub when started via a absolute path to a link
Labels new issue
Assignees
Reporter Maddimax
    If I start:

```/usr/bin/lldb-server platform --listen '*:10000' --server```

then I get `Launch: invalid host:port specification: '[192.168.64.5]'`
but if I start:

```lldb-server platform --listen '*:10000' --server```

then everything works and I can debug without any problems.

```
$ which lldb-server
/usr/bin/lldb-server
```

In lldb I run:
`command script import test.py`
[test.py](https://github.com/llvm/llvm-project/files/11833541/test.txt)

---
We found the reason here: https://github.com/llvm/llvm-project/issues/61955#issuecomment-1603786142

The code that is looking for the "support exe dir" is finding the wrong dir, see these two runs with logging enabled:

```
...
distribution id command returned "Distributor ID:	Ubuntu
"
distribution id set to "ubuntu"
GDBRemoteCommunication::StartDebugserverProcess(url="" port=0)
shlib dir -> `/usr/bin/`
HostInfo::ComputePathRelativeToLibrary() attempting to derive the path /bin relative to liblldb install path: /usr/bin
HostInfo::ComputePathRelativeToLibrary() derived the path as: /usr/bin
support exe dir -> `/usr/bin/`
GDBRemoteCommunication::StartDebugserverProcess() could not find gdb-remote stub exe ''
GDBRemoteCommunication::StartDebugserverProcess() failed: unable to locate lldb-server-15.0.7
error: lost connection
lldb-server exiting...
```
vs.
```
distribution id set to "ubuntu"
GDBRemoteCommunication::StartDebugserverProcess(url="" port=0)
shlib dir -> `/usr/lib/llvm-15/bin/`
HostInfo::ComputePathRelativeToLibrary() attempting to derive the path /bin relative to liblldb install path: /usr/lib/llvm-15/bin
HostInfo::ComputePathRelativeToLibrary() derived the path as: /usr/lib/llvm-15/bin
support exe dir -> `/usr/lib/llvm-15/bin/`
GDBRemoteCommunication::StartDebugserverProcess() found gdb-remote stub exe '/usr/lib/llvm-15/bin/lldb-server-15.0.7'
launch info for gdb-remote stub:
Executable: lldb-server-15.0.7
Triple: *-*-*
Arguments:
argv[0]="/usr/lib/llvm-15/bin/lldb-server-15.0.7"
argv[1]="gdbserver"
argv[2]="tcp://[192.168.64.1]:0"
argv[3]="--native-regs"
argv[4]="--pipe"
argv[5]="6"
argv[6]=NULL
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to