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    @add_test_categories(["llgs"])
14    def test_module_info(self):
15        self.build()
16        self.set_inferior_startup_launch()
17        procs = self.prep_debug_monitor_and_inferior()
18        self.add_process_info_collection_packets()
19        context = self.expect_gdbremote_sequence()
20        info = self.parse_process_info_response(context)
21
22        self.test_sequence.add_log_lines([
23            'read packet: $jModulesInfo:%s]#00' % json.dumps(
24                [{"file":lldbutil.append_to_process_working_directory(self, "a.out"),
25                  "triple":seven.unhexlify(info["triple"])}]),
26            {"direction": "send",
27             "regex": r'^\$\[{(.*)}\]\]#[0-9A-Fa-f]{2}',
28             "capture": {1: "spec"}},
29        ], True)
30
31        context = self.expect_gdbremote_sequence()
32        spec = context.get("spec")
33        self.assertRegexpMatches(spec, '"file_path":".*"')
34        self.assertRegexpMatches(spec, '"file_offset":\d+')
35        self.assertRegexpMatches(spec, '"file_size":\d+')
36        self.assertRegexpMatches(spec, '"triple":"\w*-\w*-.*"')
37        self.assertRegexpMatches(spec, '"uuid":"[A-Fa-f0-9]+"')
38