e0ba3d7eb684be010ba02198b837075e4fa982d1
[openbsd] /
1
2
3 import gdbremote_testcase
4 from lldbsuite.test.decorators import *
5 from lldbsuite.test.lldbtest import *
6 from lldbsuite.test import lldbutil
7
8
9 class TestGdbRemoteSegFault(gdbremote_testcase.GdbRemoteTestCaseBase):
10     mydir = TestBase.compute_mydir(__file__)
11
12     GDB_REMOTE_STOP_CODE_BAD_ACCESS = 0x91
13
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)
19
20         self.test_sequence.add_log_lines(["read packet: $vCont;c#a8",
21                                           {"direction": "send",
22                                            "regex": r"^\$T([0-9a-fA-F]{2}).*#[0-9a-fA-F]{2}$",
23                                            "capture": {1: "hex_exit_code"}},
24                                           ],
25                                          True)
26
27         context = self.expect_gdbremote_sequence()
28         self.assertIsNotNone(context)
29
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)
33
34     @debugserver_test
35     def test_inferior_seg_fault_received_debugserver(self):
36         self.init_debugserver_test()
37         self.build()
38         self.inferior_seg_fault_received(self.GDB_REMOTE_STOP_CODE_BAD_ACCESS)
39
40     @skipIfWindows # No signal is sent on Windows.
41     @llgs_test
42     def test_inferior_seg_fault_received_llgs(self):
43         self.init_llgs_test()
44         self.build()
45         self.inferior_seg_fault_received(lldbutil.get_signal_number('SIGSEGV'))