• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2
3import gdbremote_testcase
4from lldbsuite.test.decorators import *
5from lldbsuite.test.lldbtest import *
6from lldbsuite.test import lldbutil
7
8
9class TestGdbRemoteAbort(gdbremote_testcase.GdbRemoteTestCaseBase):
10    mydir = TestBase.compute_mydir(__file__)
11
12    @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
13    def inferior_abort_received(self):
14        procs = self.prep_debug_monitor_and_inferior(inferior_args=["abort"])
15        self.assertIsNotNone(procs)
16
17        self.test_sequence.add_log_lines(["read packet: $vCont;c#a8",
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                                         True)
23
24        context = self.expect_gdbremote_sequence()
25        self.assertIsNotNone(context)
26
27        hex_exit_code = context.get("hex_exit_code")
28        self.assertIsNotNone(hex_exit_code)
29        self.assertEqual(int(hex_exit_code, 16),
30                         lldbutil.get_signal_number('SIGABRT'))
31
32    @debugserver_test
33    def test_inferior_abort_received_debugserver(self):
34        self.init_debugserver_test()
35        self.build()
36        self.inferior_abort_received()
37
38    @skipIfWindows # No signal is sent on Windows.
39    @llgs_test
40    # std::abort() on <= API 16 raises SIGSEGV - b.android.com/179836
41    @expectedFailureAndroid(api_levels=list(range(16 + 1)))
42    def test_inferior_abort_received_llgs(self):
43        self.init_llgs_test()
44        self.build()
45        self.inferior_abort_received()
46