[Lldb-commits] [lldb] [lldb] Use correct path for debugserver (PR #131609)

Yuval Deutscher via lldb-commits lldb-commits at lists.llvm.org
Sun Apr 6 00:36:39 PDT 2025


================
@@ -58,3 +59,45 @@ def test_platform_process_launch_gdb_server(self):
 
         self.runCmd("target create {}".format(self.getBuildArtifact("a.out")))
         self.expect("run", substrs=["unable to launch a GDB server on"], error=True)
+
+    @skipIfRemote
+    @skipUnlessPlatform(["linux"])
+    @add_test_categories(["lldb-server"])
+    def test_lldb_server_weird_symlinks(self):
+        self.build()
+
+        hostname = socket.getaddrinfo("localhost", 0, proto=socket.IPPROTO_TCP)[0][4][0]
+        listen_url = "[%s]:0" % hostname
+
+        port_file = self.getBuildArtifact("port")
+        commandline_args = [
+            "platform",
+            "--listen",
+            listen_url,
+            "--socket-file",
+            port_file,
+        ]
+
+        # Run lldb-server from a symlink without any binary called "lldb-server" in the directory.
+        llgs_hiding_directory = self.getBuildArtifact("hiding-directory")
+        new_lldb_server_link = self.getBuildArtifact(
+            "lldb-server-with-an-unconventional-name"
+        )
+        new_lldb_server = os.path.join(llgs_hiding_directory, "lldb-server")
+        os.makedirs(llgs_hiding_directory)
+        shutil.copy(lldbgdbserverutils.get_lldb_server_exe(), new_lldb_server)
+        os.symlink(new_lldb_server, new_lldb_server_link)
+
+        proc = self.spawnSubprocess(new_lldb_server_link, commandline_args)
+        socket_id = lldbutil.wait_for_file_on_target(self, port_file)
+
+        new_platform = lldb.SBPlatform("remote-" + self.getPlatform())
+        self.dbg.SetSelectedPlatform(new_platform)
+
+        connect_url = "connect://[%s]:%s" % (hostname, socket_id)
+        self.runCmd("platform connect %s" % connect_url)
+        self.runCmd("target create {}".format(self.getBuildArtifact("a.out")))
+        self.runCmd("run")
+
+        # So that lldb-server doesn't crash over SIGHUP
+        os.kill(proc.pid, signal.SIGTERM)
----------------
yuvald-sweet-security wrote:

Yea, this seems to happen also on the lldb-server-20 I got from apt, outside of the test...

```
$ lldb-server-20 platform --server --listen '*:1338' --log-channels "lldb all" &                                                                                      
[1] 225430
Listen to [*]:1338                                                                                                                                                                           
Listen to [*]:0

$ kill -HUP `pidof lldb-server-20`
SIGHUP received, exiting lldb-server...
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: %                                                                                                                                                                 lldb-server-20 platform --server --listen *:1338 --log-channels "lldb all"
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  libLLVM.so.20.1 0x000074b07842bc7f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 63
1  libLLVM.so.20.1 0x000074b078429989 llvm::sys::RunSignalHandlers() + 89
2  libLLVM.so.20.1 0x000074b07842c390
3  libc.so.6       0x000074b076c45330
4  libc.so.6       0x000074b076c9eb2c pthread_kill + 284
5  libc.so.6       0x000074b076c4527e gsignal + 30
6  libc.so.6       0x000074b076c288ff abort + 223
7  lldb-server-20  0x00005d1b74ca3b57
8  libc.so.6       0x000074b076c45330
9  libc.so.6       0x000074b076d1b9ad ppoll + 77
10 lldb-server-20  0x00005d1b74cc2eea
11 lldb-server-20  0x00005d1b74cc3dff
12 lldb-server-20  0x00005d1b74ca39a1
13 lldb-server-20  0x00005d1b74ca6225
14 libc.so.6       0x000074b076c2a1ca
15 libc.so.6       0x000074b076c2a28b __libc_start_main + 139
16 lldb-server-20  0x00005d1b74c9e055
[1]  + 225430 IOT instruction (core dumped)  lldb-server-20 platform --server --listen '*:1338' --log-channels "lldb all"
``` 

whats the intended behavior here, do we expect lldb-server to handle SIGHUP without crashing or is the issue in the test sending that signal?

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


More information about the lldb-commits mailing list