[Lldb-commits] [PATCH] D11520: [LLGS] Avoid bogus error message on process termination

Pavel Labath labath at google.com
Tue Jul 28 02:07:23 PDT 2015


This revision was automatically updated to reflect the committed changes.
labath marked an inline comment as done.
Closed by commit rL243397: [LLGS] Avoid bogus error message on process termination (authored by labath).

Changed prior to commit:
  http://reviews.llvm.org/D11520?vs=30683&id=30795#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11520

Files:
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp

Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -1142,26 +1142,21 @@
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServerLLGS::Handle_k (StringExtractorGDBRemote &packet)
 {
-    // shutdown all spawned processes
-    std::set<lldb::pid_t> spawned_pids_copy;
+    Log *log (GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
 
-    // copy pids
-    {
-        Mutex::Locker locker (m_spawned_pids_mutex);
-        spawned_pids_copy.insert (m_spawned_pids.begin (), m_spawned_pids.end ());
-    }
+    StopSTDIOForwarding();
 
-    // nuke the spawned processes
-    for (auto it = spawned_pids_copy.begin (); it != spawned_pids_copy.end (); ++it)
+    if (! m_debugged_process_sp)
     {
-        lldb::pid_t spawned_pid = *it;
-        if (!KillSpawnedProcess (spawned_pid))
-        {
-            fprintf (stderr, "%s: failed to kill spawned pid %" PRIu64 ", ignoring.\n", __FUNCTION__, spawned_pid);
-        }
+        if (log)
+            log->Printf("GDBRemoteCommunicationServerLLGS::%s No debugged process found.", __FUNCTION__);
+        return PacketResult::Success;
     }
 
-    StopSTDIOForwarding();
+    Error error = m_debugged_process_sp->Kill();
+    if (error.Fail() && log)
+        log->Printf("GDBRemoteCommunicationServerLLGS::%s Failed to kill debugged process %" PRIu64 ": %s",
+                __FUNCTION__, m_debugged_process_sp->GetID(), error.AsCString());
 
     // No OK response for kill packet.
     // return SendOKResponse ();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11520.30795.patch
Type: text/x-patch
Size: 1761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150728/c1c12e7b/attachment.bin>


More information about the lldb-commits mailing list