9ec40c11742883ed8be427970282c8d446dc3c4a
[openbsd] /
1
2 import gdbremote_testcase
3 from lldbsuite.test.decorators import *
4 from lldbsuite.test.lldbtest import *
5 from lldbsuite.test import lldbutil
6
7
8 class TestGdbRemoteThreadName(gdbremote_testcase.GdbRemoteTestCaseBase):
9
10     mydir = TestBase.compute_mydir(__file__)
11
12     def run_and_check_name(self, expected_name):
13         self.test_sequence.add_log_lines(["read packet: $vCont;c#a8",
14                                           {"direction": "send",
15                                            "regex":
16                                            r"^\$T([0-9a-fA-F]{2})([^#]+)#[0-9a-fA-F]{2}$",
17                                            "capture": {
18                                                1: "signal",
19                                                2: "key_vals_text"}},
20                                           ],
21                                          True)
22
23         context = self.expect_gdbremote_sequence()
24         self.assertIsNotNone(context)
25
26         sigint = lldbutil.get_signal_number("SIGINT")
27         self.assertEqual(sigint, int(context.get("signal"), 16))
28         kv_dict = self.parse_key_val_dict(context.get("key_vals_text"))
29         self.assertEqual(expected_name, kv_dict.get("name"))
30
31     @skipIfWindows # the test is not updated for Windows.
32     @llgs_test
33     def test(self):
34         """ Make sure lldb-server can retrieve inferior thread name"""
35         self.init_llgs_test()
36         self.build()
37         self.set_inferior_startup_launch()
38         procs = self.prep_debug_monitor_and_inferior()
39
40         self.run_and_check_name("hello world")
41         self.run_and_check_name("goodbye world")