[Lldb-commits] [PATCH] Prevent debugserver from sending two stop notifications on 'k' gdb-remote message

Todd Fiala todd.fiala at gmail.com
Mon Jul 14 13:04:12 PDT 2014


Currently debugserver sends two responses to the 'k' gdb-remote kill
request.  The first one is automatically sent out without question when
receiving the 'k' packet.  The second one comes when the process really
dies (i.e. the real result, including extra info re: description).

This change removes the first automatic 'X09' response, and adjusts the
gdb-remote 'k' test to accept the key-val info from the true X response
from death of the process on MacOSX.  This change also eliminates a set of
verbose warnings from the gdb-remote test suite where the second X results
was picked up but was unexpected, never matched, by the test system.

llgs already behaves this way.

Index: test/tools/lldb-gdbserver/TestLldbGdbServer.py
===================================================================
--- test/tools/lldb-gdbserver/TestLldbGdbServer.py (revision 212951)
+++ test/tools/lldb-gdbserver/TestLldbGdbServer.py (working copy)
@@ -408,10 +408,10 @@

     def attach_commandline_kill_after_initial_stop(self):
         procs = self.prep_debug_monitor_and_inferior()
-        self.test_sequence.add_log_lines(
-            ["read packet: $k#6b",
-             "send packet: $X09#00"],
-            True)
+        self.test_sequence.add_log_lines([
+            "read packet: $k#6b",
+            {"direction":"send",
"regex":r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}" },
+            ], True)
         self.expect_gdbremote_sequence()

         # Wait a moment for completed and now-detached inferior process to
clear.
Index: tools/debugserver/source/RNBRemote.cpp
===================================================================
--- tools/debugserver/source/RNBRemote.cpp (revision 212951)
+++ tools/debugserver/source/RNBRemote.cpp (working copy)
@@ -3857,7 +3857,8 @@
     // No response to should be sent to the kill packet
     if (m_ctx.HasValidProcessID())
         DNBProcessKill (m_ctx.ProcessID());
-    SendPacket ("X09");
+    // Don't send the X - wait for the real process death to do that.
+    // Otherwise, we get two X stop notifications for the process death.
     return rnb_success;
 }

-- 
-Todd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140714/bb1c84eb/attachment.html>
-------------- next part --------------
Index: test/tools/lldb-gdbserver/TestLldbGdbServer.py
===================================================================
--- test/tools/lldb-gdbserver/TestLldbGdbServer.py	(revision 212951)
+++ test/tools/lldb-gdbserver/TestLldbGdbServer.py	(working copy)
@@ -408,10 +408,10 @@
 
     def attach_commandline_kill_after_initial_stop(self):
         procs = self.prep_debug_monitor_and_inferior()
-        self.test_sequence.add_log_lines(
-            ["read packet: $k#6b",
-             "send packet: $X09#00"],
-            True)
+        self.test_sequence.add_log_lines([
+            "read packet: $k#6b",
+            {"direction":"send", "regex":r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}" },
+            ], True)
         self.expect_gdbremote_sequence()
 
         # Wait a moment for completed and now-detached inferior process to clear.
Index: tools/debugserver/source/RNBRemote.cpp
===================================================================
--- tools/debugserver/source/RNBRemote.cpp	(revision 212951)
+++ tools/debugserver/source/RNBRemote.cpp	(working copy)
@@ -3857,7 +3857,8 @@
     // No response to should be sent to the kill packet
     if (m_ctx.HasValidProcessID())
         DNBProcessKill (m_ctx.ProcessID());
-    SendPacket ("X09");
+    // Don't send the X - wait for the real process death to do that.
+    // Otherwise, we get two X stop notifications for the process death.
     return rnb_success;
 }
 


More information about the lldb-commits mailing list