brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · b19f20c Raw
40 lines · python
1import gdbremote_testcase2from lldbsuite.test.decorators import *3from lldbsuite.test.lldbtest import *4from lldbsuite.test import lldbutil5 6 7class TestGdbRemoteSegFault(gdbremote_testcase.GdbRemoteTestCaseBase):8    GDB_REMOTE_STOP_CODE_BAD_ACCESS = 0x919 10    def inferior_seg_fault_received(self, expected_signo):11        procs = self.prep_debug_monitor_and_inferior(inferior_args=["segfault"])12        self.assertIsNotNone(procs)13 14        self.test_sequence.add_log_lines(15            [16                "read packet: $vCont;c#a8",17                {18                    "direction": "send",19                    "regex": r"^\$T([0-9a-fA-F]{2}).*#[0-9a-fA-F]{2}$",20                    "capture": {1: "hex_exit_code"},21                },22            ],23            True,24        )25 26        context = self.expect_gdbremote_sequence()27        self.assertIsNotNone(context)28 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)32 33    @skipIfWindows  # No signal is sent on Windows.34    def test_inferior_seg_fault_received(self):35        self.build()36        if self.platformIsDarwin():37            self.inferior_seg_fault_received(self.GDB_REMOTE_STOP_CODE_BAD_ACCESS)38        else:39            self.inferior_seg_fault_received(lldbutil.get_signal_number("SIGSEGV"))40