[Lldb-commits] [PATCH] D11557: [LLGS] Spawned process handling cleanup

Oleksiy Vyalov ovyalov at google.com
Tue Jul 28 07:32:15 PDT 2015


ovyalov accepted this revision.
This revision is now accepted and ready to land.

================
Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:280
@@ -291,1 +279,3 @@
+    // Before we try to attach, make sure we aren't already monitoring something else.
+    if (m_debugged_process_sp)
     {
----------------
We may want to check for GetID() != LLDB_INVALID_PROCESS_ID becauseNativeProcessProtocol::Attach doesn't nullify native_process_sp if AttachToInferior fails.

Considering how often we check something like m_debugged_process_sp && (m_debugged_process_sp->GetID () != LLDB_INVALID_PROCESS_ID)" having a separate method for this might be pretty convenient - we can do it in another CL.

================
Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:282
@@ -291,16 +281,3 @@
     {
-        // Before we try to attach, make sure we aren't already monitoring something else.
-        Mutex::Locker locker (m_spawned_pids_mutex);
-        if (!m_spawned_pids.empty ())
-        {
-            error.SetErrorStringWithFormat ("cannot attach to a process %" PRIu64 " when another process with pid %" PRIu64 " is being debugged.", pid, *m_spawned_pids.begin());
-            return error;
-        }
-
-        // Try to attach.
-        error = NativeProcessProtocol::Attach(pid, *this, m_mainloop, m_debugged_process_sp);
-        if (!error.Success ())
-        {
-            fprintf (stderr, "%s: failed to attach to process %" PRIu64 ": %s", __FUNCTION__, pid, error.AsCString ());
-            return error;
-        }
+        error.SetErrorStringWithFormat ("cannot attach to a process %" PRIu64 " when another process with pid %" PRIu64 " is being debugged.", pid, m_debugged_process_sp->GetID());
+        return error;
----------------
return Error(...)?


http://reviews.llvm.org/D11557







More information about the lldb-commits mailing list