• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2import json
3import gdbremote_testcase
4import lldbgdbserverutils
5from lldbsuite.support import seven
6from lldbsuite.test.decorators import *
7from lldbsuite.test.lldbtest import *
8from lldbsuite.test import lldbutil
9
10
11class TestGdbRemoteModuleInfo(gdbremote_testcase.GdbRemoteTestCaseBase):
12
13    mydir = TestBase.compute_mydir(__file__)
14
15    def module_info(self):
16        procs = self.prep_debug_monitor_and_inferior()
17        self.add_process_info_collection_packets()
18        context = self.expect_gdbremote_sequence()
19        info = self.parse_process_info_response(context)
20
21        self.test_sequence.add_log_lines([
22            'read packet: $jModulesInfo:%s]#00' % json.dumps(
23                [{"file":lldbutil.append_to_process_working_directory(self, "a.out"),
24                  "triple":seven.unhexlify(info["triple"])}]),
25            {"direction": "send",
26             "regex": r'^\$\[{(.*)}\]\]#[0-9A-Fa-f]{2}',
27             "capture": {1: "spec"}},
28        ], True)
29
30        context = self.expect_gdbremote_sequence()
31        spec = context.get("spec")
32        self.assertRegexpMatches(spec, '"file_path":".*"')
33        self.assertRegexpMatches(spec, '"file_offset":\d+')
34        self.assertRegexpMatches(spec, '"file_size":\d+')
35        self.assertRegexpMatches(spec, '"triple":"\w*-\w*-.*"')
36        self.assertRegexpMatches(spec, '"uuid":"[A-Fa-f0-9]+"')
37
38    @llgs_test
39    def test_module_info(self):
40        self.init_llgs_test()
41        self.build()
42        self.set_inferior_startup_launch()
43        self.module_info()
44