https://github.com/yuvald-sweet-security updated https://github.com/llvm/llvm-project/pull/131519
>From bbfae1028b2c47b6fe422f71516fb486d94f406b Mon Sep 17 00:00:00 2001 From: Yuval Deutscher <yuvald@sweet.security> Date: Sun, 16 Mar 2025 14:08:57 +0000 Subject: [PATCH] [lldb] Use correct path for lldb-server executable --- lldb/tools/lldb-server/lldb-platform.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lldb/tools/lldb-server/lldb-platform.cpp b/lldb/tools/lldb-server/lldb-platform.cpp index 880b45b989b9c..ac0fd64a14715 100644 --- a/lldb/tools/lldb-server/lldb-platform.cpp +++ b/lldb/tools/lldb-server/lldb-platform.cpp @@ -545,13 +545,28 @@ int main_platform(int argc, char *argv[]) { MainLoop main_loop; { + char progpath[1024]; +#if defined(_WIN32) + if (GetModuleFileName(NULL, progpath, sizeof(progpath)) == 0) { + printf("Error retrieving executable path.\n"); + return 1; + } +#else + ssize_t len = readlink("/proc/self/exe", progpath, sizeof(progpath) - 1); + if (len == -1) { + perror("readlink"); + return 1; + } + progpath[len] = '\0'; +#endif + llvm::Expected<std::vector<MainLoopBase::ReadHandleUP>> platform_handles = platform_sock->Accept( main_loop, [progname, gdbserver_port, &inferior_arguments, log_file, log_channels, &main_loop, &platform_handles](std::unique_ptr<Socket> sock_up) { printf("Connection established.\n"); - Status error = spawn_process(progname, sock_up.get(), + Status error = spawn_process(progpath, sock_up.get(), gdbserver_port, inferior_arguments, log_file, log_channels, main_loop); if (error.Fail()) { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits