[debugserver] Correctly pass argv[0] to execl
authorJonas Devlieghere <jonas@devlieghere.com>
Tue, 16 Feb 2021 02:38:21 +0000 (18:38 -0800)
committerJonas Devlieghere <jonas@devlieghere.com>
Tue, 16 Feb 2021 02:42:21 +0000 (18:42 -0800)
The execl function takes both the executable and argv[0].

lldb/tools/debugserver/source/DNB.cpp

index a69fc33..7048bec 100644 (file)
@@ -468,8 +468,9 @@ nub_process_t DNBProcessAttach(nub_process_t attach_pid,
 
         snprintf(fdstr, sizeof(fdstr), "--fd=%d", communication_fd);
         snprintf(pidstr, sizeof(pidstr), "--attach=%d", attach_pid);
-        execl(translated_debugserver, "--native-regs", "--setsid", fdstr,
-              "--handoff-attach-from-native", pidstr, (char *)0);
+        execl(translated_debugserver, translated_debugserver, "--native-regs",
+              "--setsid", fdstr, "--handoff-attach-from-native", pidstr,
+              (char *)0);
         DNBLogThreadedIf(LOG_PROCESS, "Failed to launch debugserver for "
                          "translated process: ", errno, strerror(errno));
         __builtin_trap();