1 import gdbremote_testcase
2 from lldbsuite
.test
.decorators
import *
3 from lldbsuite
.test
.lldbtest
import *
4 from lldbsuite
.test
import lldbutil
7 class TestGdbRemoteSegFault(gdbremote_testcase
.GdbRemoteTestCaseBase
):
8 GDB_REMOTE_STOP_CODE_BAD_ACCESS
= 0x91
10 def inferior_seg_fault_received(self
, expected_signo
):
11 procs
= self
.prep_debug_monitor_and_inferior(inferior_args
=["segfault"])
12 self
.assertIsNotNone(procs
)
14 self
.test_sequence
.add_log_lines(
16 "read packet: $vCont;c#a8",
19 "regex": r
"^\$T([0-9a-fA-F]{2}).*#[0-9a-fA-F]{2}$",
20 "capture": {1: "hex_exit_code"},
26 context
= self
.expect_gdbremote_sequence()
27 self
.assertIsNotNone(context
)
29 hex_exit_code
= context
.get("hex_exit_code")
30 self
.assertIsNotNone(hex_exit_code
)
31 self
.assertEqual(int(hex_exit_code
, 16), expected_signo
)
33 @skipIfWindows # No signal is sent on Windows.
34 def test_inferior_seg_fault_received(self
):
36 if self
.platformIsDarwin():
37 self
.inferior_seg_fault_received(self
.GDB_REMOTE_STOP_CODE_BAD_ACCESS
)
39 self
.inferior_seg_fault_received(lldbutil
.get_signal_number("SIGSEGV"))