3 import gdbremote_testcase
4 from lldbsuite.test.decorators import *
5 from lldbsuite.test.lldbtest import *
6 from lldbsuite.test import lldbutil
9 class TestGdbRemoteSegFault(gdbremote_testcase.GdbRemoteTestCaseBase):
10 mydir = TestBase.compute_mydir(__file__)
12 GDB_REMOTE_STOP_CODE_BAD_ACCESS = 0x91
14 @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
15 def inferior_seg_fault_received(self, expected_signo):
16 procs = self.prep_debug_monitor_and_inferior(
17 inferior_args=["segfault"])
18 self.assertIsNotNone(procs)
20 self.test_sequence.add_log_lines(["read packet: $vCont;c#a8",
22 "regex": r"^\$T([0-9a-fA-F]{2}).*#[0-9a-fA-F]{2}$",
23 "capture": {1: "hex_exit_code"}},
27 context = self.expect_gdbremote_sequence()
28 self.assertIsNotNone(context)
30 hex_exit_code = context.get("hex_exit_code")
31 self.assertIsNotNone(hex_exit_code)
32 self.assertEqual(int(hex_exit_code, 16), expected_signo)
35 def test_inferior_seg_fault_received_debugserver(self):
36 self.init_debugserver_test()
38 self.inferior_seg_fault_received(self.GDB_REMOTE_STOP_CODE_BAD_ACCESS)
40 @skipIfWindows # No signal is sent on Windows.
42 def test_inferior_seg_fault_received_llgs(self):
45 self.inferior_seg_fault_received(lldbutil.get_signal_number('SIGSEGV'))