[Lldb-commits] [lldb] [lldb] Removed gdbserver ports map from lldb-server (PR #104238)

Dmitry Vasilyev via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 2 12:17:14 PDT 2024


================
@@ -318,75 +231,67 @@ GDBRemoteCommunicationServerPlatform::Handle_qKillSpawnedProcess(
 
   lldb::pid_t pid = packet.GetU64(LLDB_INVALID_PROCESS_ID);
 
-  // verify that we know anything about this pid. Scope for locker
-  {
-    std::lock_guard<std::recursive_mutex> guard(m_spawned_pids_mutex);
-    if (m_spawned_pids.find(pid) == m_spawned_pids.end()) {
-      // not a pid we know about
-      return SendErrorResponse(10);
-    }
+  // verify that we know anything about this pid.
+  if (SpawnedProcessFinished(pid)) {
+    // not a pid we know about
+    return SendErrorResponse(10); // ECHILD
   }
 
   // go ahead and attempt to kill the spawned process
   if (KillSpawnedProcess(pid))
     return SendOKResponse();
   else
-    return SendErrorResponse(11);
+    return SendErrorResponse(11); // EDEADLK
+}
+
+void GDBRemoteCommunicationServerPlatform::AddSpawnedProcess(lldb::pid_t pid) {
+  assert(pid != LLDB_INVALID_PROCESS_ID);
+  std::lock_guard<std::recursive_mutex> guard(m_spawned_pids_mutex);
+  m_spawned_pids.insert(pid);
+}
+
+bool GDBRemoteCommunicationServerPlatform::SpawnedProcessFinished(
----------------
slydiman wrote:

Done.

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


More information about the lldb-commits mailing list