[Lldb-commits] [lldb] [lldb-dap] Implement `runInTerminal` for Windows (PR #121269)

Hu Jialun via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 24 04:32:35 PST 2025


================
@@ -111,8 +111,10 @@ Error RunInTerminalLauncherCommChannel::WaitUntilDebugAdaptorAttaches(
     return message.takeError();
 }
 
-Error RunInTerminalLauncherCommChannel::NotifyPid() {
-  return m_io.SendJSON(RunInTerminalMessagePid(getpid()).ToJSON());
+Error RunInTerminalLauncherCommChannel::NotifyPid(lldb::pid_t pid) {
+  if (pid == 0)
+    pid = getpid();
----------------
SuibianP wrote:

I used this as kind of a dynamic default argument. The original codepath always used `getpid()` as the PID to be sent through the pipe, but this does not work for Windows where the PID of the target differs from that of the launcher.

https://github.com/llvm/llvm-project/pull/121269/files#diff-2de0ddf6c080497da43990b05d21e6229d309f51cf269ba7e3860a677f507905R4903-R4905

Maybe an explicit argument without such implicit default would be more readable?

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


More information about the lldb-commits mailing list