[Lldb-commits] [lldb] ac570fb - [lldb] [llgs] Include process ID in stop responses
Michał Górny via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 20 04:37:31 PDT 2022
Author: Michał Górny
Date: 2022-06-20T13:37:23+02:00
New Revision: ac570fbb8521a31a1931cc070e1b259fcac6a30f
URL: https://github.com/llvm/llvm-project/commit/ac570fbb8521a31a1931cc070e1b259fcac6a30f
DIFF: https://github.com/llvm/llvm-project/commit/ac570fbb8521a31a1931cc070e1b259fcac6a30f.diff
LOG: [lldb] [llgs] Include process ID in stop responses
Include the process identifier in the `T` stop responses when
multiprocess extension is enabled (i.e. prepend it to the thread
identifier). Use the exposed identifier to simplify the fork-and-follow
tests.
The LLDB client accounts for the possible PID since the multiprocess
extension support was added in b601c6719226fb83c43dae62a581e5ee08bfb169.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D127192
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 2b491f505aca..e173f04bebe4 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -809,8 +809,12 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread(
// 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();
diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
index 45f3c95809da..2156180e7423 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
@@ -101,15 +101,12 @@ def fork_and_follow_test(self, variant):
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
More information about the lldb-commits
mailing list