================ @@ -150,12 +153,17 @@ static void client_handle(GDBRemoteCommunicationServerPlatform &platform, printf("Disconnected.\n"); } -static GDBRemoteCommunicationServerPlatform::PortMap gdbserver_portmap; -static std::mutex gdbserver_portmap_mutex; - static void spawn_process_reaped(lldb::pid_t pid, int signal, int status) { - std::lock_guard<std::mutex> guard(gdbserver_portmap_mutex); - gdbserver_portmap.FreePortForProcess(pid); + if (g_single_pid != LLDB_INVALID_PROCESS_ID && g_single_pid == pid) { + // If not running as a server and the platform connection is closed + if (!g_terminate) { + g_terminate = true; ---------------- labath wrote:
This kind of casual handling of atomics is making me very nervous. Instead `g_single_pid`, I think it be better to just pass a different callback (or a different argument to this callback). And could we get rid of the g_terminate and g_main_loop checks by waiting for the child platform process to be reaped before exiting? https://github.com/llvm/llvm-project/pull/104238 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits