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 @@ -694,6 +694,16 @@ return nullptr; } +static int GetSignalForStopReason(const struct ThreadStopInfo &tid_stop_info) { + if (tid_stop_info.reason == eStopReasonException) + return SIGTRAP; // TODO: does this make sense? + if (tid_stop_info.reason == eStopReasonFork || + tid_stop_info.reason == eStopReasonVFork || + tid_stop_info.reason == eStopReasonVForkDone) + return SIGTRAP; + return tid_stop_info.details.signal.signo; +} + static llvm::Expected GetJSONThreadsInfo(NativeProcessProtocol &process, bool abridged) { Log *log = GetLog(LLDBLog::Process | LLDBLog::Thread); @@ -715,7 +725,7 @@ return llvm::make_error( "failed to get stop reason", llvm::inconvertibleErrorCode()); - const int signum = tid_stop_info.details.signal.signo; + const int signum = GetSignalForStopReason(tid_stop_info); if (log) { LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64 @@ -799,7 +809,7 @@ StreamString response; // Output the T packet with the thread response.PutChar('T'); - int signum = tid_stop_info.details.signal.signo; + int signum = GetSignalForStopReason(tid_stop_info); LLDB_LOG( log, "pid {0}, tid {1}, got signal signo = {2}, reason = {3}, exc_type = {4}", 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 @@ -16,7 +16,7 @@ self.reset_test_sequence() # continue and expect fork - fork_regex = "[$]T.*;fork:p([0-9a-f]+)[.]([0-9a-f]+).*" + fork_regex = "[$]T05.*;fork:p([0-9a-f]+)[.]([0-9a-f]+).*" self.test_sequence.add_log_lines([ "read packet: $c#00", {"direction": "send", "regex": fork_regex, @@ -50,7 +50,7 @@ self.reset_test_sequence() # continue and expect fork - fork_regex = "[$]T.*;{}:p([0-9a-f]+)[.]([0-9a-f]+).*".format(variant) + fork_regex = "[$]T05.*;{}:p([0-9a-f]+)[.]([0-9a-f]+).*".format(variant) self.test_sequence.add_log_lines([ "read packet: $c#00", {"direction": "send", "regex": fork_regex, @@ -86,7 +86,7 @@ # resume the parent self.test_sequence.add_log_lines([ "read packet: $c#00", - {"direction": "send", "regex": r"[$]T.*vforkdone.*"}, + {"direction": "send", "regex": r"[$]T05.*vforkdone.*"}, "read packet: $c#00", {"direction": "send", "regex": r"[$]W00;process:[0-9a-f]+#.*"}, ], True)