https://github.com/yuvald-sweet-security updated https://github.com/llvm/llvm-project/pull/131519
>From 0af05f390616de8fa73fb975c4c202aac13d3745 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 | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lldb/tools/lldb-server/lldb-platform.cpp b/lldb/tools/lldb-server/lldb-platform.cpp index 880b45b989b9c..32e31ff70c5fd 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, + main_loop, [progpath, 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