Skip to content

Commit ac570fb

Browse files
committed
[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 b601c67. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.llvm.org/D127192
1 parent e4d6ed5 commit ac570fb

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -809,8 +809,12 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread(
809809
// Print the signal number.
810810
response.PutHex8(signum & 0xff);
811811

812-
// Include the tid.
813-
response.Printf("thread:%" PRIx64 ";", tid);
812+
// Include the (pid and) tid.
813+
response.PutCString("thread:");
814+
if (bool(m_extensions_supported &
815+
NativeProcessProtocol::Extension::multiprocess))
816+
response.Format("p{0:x-}.", m_current_process->GetID());
817+
response.Format("{0:x-};", tid);
814818

815819
// Include the thread name if there is one.
816820
const std::string thread_name = thread->GetName();

lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,12 @@ def fork_and_follow_test(self, variant):
101101
self.reset_test_sequence()
102102

103103
# continue and expect fork
104-
procinfo_regex = "[$]pid:([0-9a-f]+);.*"
105-
fork_regex = "[$]T.*;{}:p([0-9a-f]+)[.]([0-9a-f]+).*".format(variant)
104+
fork_regex = ("[$]T[0-9a-f]{{2}}thread:p([0-9a-f]+)[.][0-9a-f]+;.*"
105+
"{}:p([0-9a-f]+)[.]([0-9a-f]+).*".format(variant))
106106
self.test_sequence.add_log_lines([
107-
"read packet: $qProcessInfo#00",
108-
{"direction": "send", "regex": procinfo_regex,
109-
"capture": {1: "parent_pid"}},
110107
"read packet: $c#00",
111108
{"direction": "send", "regex": fork_regex,
112-
"capture": {1: "pid", 2: "tid"}},
109+
"capture": {1: "parent_pid", 2: "pid", 3: "tid"}},
113110
], True)
114111
ret = self.expect_gdbremote_sequence()
115112
parent_pid, pid, tid = (int(ret[x], 16) for x

0 commit comments

Comments
 (0)