[Lldb-commits] [lldb] e4d6ed5 - [lldb] [llgs] Include process id in W/X stop reasons

Michał Górny via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 20 04:37:29 PDT 2022


Author: Michał Górny
Date: 2022-06-20T13:37:23+02:00
New Revision: e4d6ed58a86edc339ae124b74668b600f2a0f6d5

URL: https://github.com/llvm/llvm-project/commit/e4d6ed58a86edc339ae124b74668b600f2a0f6d5
DIFF: https://github.com/llvm/llvm-project/commit/e4d6ed58a86edc339ae124b74668b600f2a0f6d5.diff

LOG: [lldb] [llgs] Include process id in W/X stop reasons

Include the process identifier in W/X stop reasons when multiprocess
extensions are enabled.

The LLDB client does not support process identifiers there at the moment
but it parses packets in such a way that their presence does not cause
any problems.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D127191

Added: 
    

Modified: 
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
    lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 0a44929ce2b7b..2b491f505aca1 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -474,6 +474,8 @@ GDBRemoteCommunicationServerLLGS::SendWResponse(
 
   StreamGDBRemote response;
   response.Format("{0:g}", *wait_status);
+  if (bool(m_extensions_supported & NativeProcessProtocol::Extension::multiprocess))
+    response.Format(";process:{0:x-}", process->GetID());
   return SendPacketNoLock(response.GetString());
 }
 

diff  --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
index 3ce10f5964b8e..45f3c95809da0 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
@@ -74,7 +74,7 @@ def test_fork(self):
         # resume the parent
         self.test_sequence.add_log_lines([
             "read packet: $c#00",
-            {"direction": "send", "regex": r"[$]W00#.*"},
+            {"direction": "send", "regex": r"[$]W00;process:[0-9a-f]+#.*"},
         ], True)
         self.expect_gdbremote_sequence()
 
@@ -87,7 +87,7 @@ def test_vfork(self):
             "read packet: $c#00",
             {"direction": "send", "regex": r"[$]T.*vforkdone.*"},
             "read packet: $c#00",
-            {"direction": "send", "regex": r"[$]W00#.*"},
+            {"direction": "send", "regex": r"[$]W00;process:[0-9a-f]+#.*"},
         ], True)
         self.expect_gdbremote_sequence()
 
@@ -135,7 +135,7 @@ def fork_and_follow_test(self, variant):
         # resume the child
         self.test_sequence.add_log_lines([
             "read packet: $c#00",
-            {"direction": "send", "regex": r"[$]W00#.*"},
+            {"direction": "send", "regex": r"[$]W00;process:[0-9a-f]+#.*"},
         ], True)
         self.expect_gdbremote_sequence()
 


        


More information about the lldb-commits mailing list