diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -420,7 +420,7 @@ // For ProcessGDBRemote only std::string m_partial_profile_data; std::map m_thread_id_to_used_usec_map; - uint64_t m_last_signals_version = 0; + uint64_t m_last_signals_version = UINT64_MAX; static bool NewThreadNotifyBreakpointHit(void *baton, StoppointCallbackContext *context, diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -2592,7 +2592,7 @@ if (!m_os_up) LoadOperatingSystemPlugin(false); - // We successfully launched the process and stopped, now it the + // We successfully launched the process and stopped, now it is the // right time to set up signal filters before resuming. UpdateAutomaticSignalFiltering(); return Status(); @@ -3026,6 +3026,10 @@ : ""); } } + + // We successfully attached to the process and stopped, now it is the + // right time to set up signal filters before resuming. + UpdateAutomaticSignalFiltering(); } Status Process::ConnectRemote(llvm::StringRef remote_url) { diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteSignalFiltering.py b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteSignalFiltering.py new file mode 100644 --- /dev/null +++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteSignalFiltering.py @@ -0,0 +1,31 @@ +"""Test that GDBRemoteProcess sends default signal filtering info when necessary""" + +import lldb +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * +from lldbsuite.test.gdbclientutils import * +from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase + + +class TestGDBRemoteSignalFiltering(GDBRemoteTestBase): + + def test_signals_sent_on_connect(self): + """Test that signal filtering info is sent on connect""" + class Responder(MockGDBServerResponder): + def qSupported(self, client_supported): + return "PacketSize=3fff;QStartNoAckMode+;QPassSignals+" + + def respond(self, packet): + if packet == "QPassSignals": + return self.QPassSignals() + return MockGDBServerResponder.respond(self, packet) + + def QPassSignals(self): + return "OK" + + self.server.responder = Responder() + target = self.createTarget("a.yaml") + process = self.connect(target) + self.assertGreater( + len([p for p in self.server.responder.packetLog if p.startswith("QPassSignals:")]), + 0)