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