[Lldb-commits] [PATCH] D127192: [lldb] [llgs] Include process ID in stop responses

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 7 08:07:32 PDT 2022


mgorny updated this revision to Diff 434818.
mgorny added a comment.

Fix formatting.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127192/new/

https://reviews.llvm.org/D127192

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


Index: lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
===================================================================
--- lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
+++ lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
@@ -102,15 +102,12 @@
         self.reset_test_sequence()
 
         # continue and expect fork
-        procinfo_regex = "[$]pid:([0-9a-f]+);.*"
-        fork_regex = "[$]T.*;{}:p([0-9a-f]+)[.]([0-9a-f]+).*".format(variant)
+        fork_regex = ("[$]T[0-9a-f]{{2}}thread:p([0-9a-f]+)[.][0-9a-f]+;.*"
+                      "{}:p([0-9a-f]+)[.]([0-9a-f]+).*".format(variant))
         self.test_sequence.add_log_lines([
-            "read packet: $qProcessInfo#00",
-            {"direction": "send", "regex": procinfo_regex,
-             "capture": {1: "parent_pid"}},
             "read packet: $c#00",
             {"direction": "send", "regex": fork_regex,
-             "capture": {1: "pid", 2: "tid"}},
+             "capture": {1: "parent_pid", 2: "pid", 3: "tid"}},
         ], True)
         ret = self.expect_gdbremote_sequence()
         parent_pid, pid, tid = (int(ret[x], 16) for x
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -809,8 +809,12 @@
   // Print the signal number.
   response.PutHex8(signum & 0xff);
 
-  // Include the tid.
-  response.Printf("thread:%" PRIx64 ";", tid);
+  // Include the (pid and) tid.
+  response.PutCString("thread:");
+  if (bool(m_extensions_supported &
+           NativeProcessProtocol::Extension::multiprocess))
+    response.Format("p{0:x-}.", m_current_process->GetID());
+  response.Format("{0:x-};", tid);
 
   // Include the thread name if there is one.
   const std::string thread_name = thread->GetName();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127192.434818.patch
Type: text/x-patch
Size: 1977 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220607/c9a8b5ee/attachment.bin>


More information about the lldb-commits mailing list