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