199451b44SJordan Rupprechtimport json 299451b44SJordan Rupprechtimport gdbremote_testcase 399451b44SJordan Rupprechtimport lldbgdbserverutils 499451b44SJordan Rupprechtfrom lldbsuite.support import seven 599451b44SJordan Rupprechtfrom lldbsuite.test.decorators import * 699451b44SJordan Rupprechtfrom lldbsuite.test.lldbtest import * 799451b44SJordan Rupprechtfrom lldbsuite.test import lldbutil 899451b44SJordan Rupprecht 999451b44SJordan Rupprecht 1099451b44SJordan Rupprechtclass TestGdbRemoteModuleInfo(gdbremote_testcase.GdbRemoteTestCaseBase): 110a8a2453SPavel Labath @add_test_categories(["llgs"]) 120a8a2453SPavel Labath def test_module_info(self): 130a8a2453SPavel Labath self.build() 140a8a2453SPavel Labath self.set_inferior_startup_launch() 1599451b44SJordan Rupprecht procs = self.prep_debug_monitor_and_inferior() 1699451b44SJordan Rupprecht self.add_process_info_collection_packets() 1799451b44SJordan Rupprecht context = self.expect_gdbremote_sequence() 1899451b44SJordan Rupprecht info = self.parse_process_info_response(context) 1999451b44SJordan Rupprecht 202238dcc3SJonas Devlieghere self.test_sequence.add_log_lines( 212238dcc3SJonas Devlieghere [ 222238dcc3SJonas Devlieghere "read packet: $jModulesInfo:%s]#00" 232238dcc3SJonas Devlieghere % json.dumps( 242238dcc3SJonas Devlieghere [ 252238dcc3SJonas Devlieghere { 262238dcc3SJonas Devlieghere "file": lldbutil.append_to_process_working_directory( 272238dcc3SJonas Devlieghere self, "a.out" 282238dcc3SJonas Devlieghere ), 292238dcc3SJonas Devlieghere "triple": seven.unhexlify(info["triple"]), 302238dcc3SJonas Devlieghere } 312238dcc3SJonas Devlieghere ] 322238dcc3SJonas Devlieghere ), 332238dcc3SJonas Devlieghere { 342238dcc3SJonas Devlieghere "direction": "send", 352238dcc3SJonas Devlieghere "regex": r"^\$\[{(.*)}\]\]#[0-9A-Fa-f]{2}", 362238dcc3SJonas Devlieghere "capture": {1: "spec"}, 372238dcc3SJonas Devlieghere }, 382238dcc3SJonas Devlieghere ], 392238dcc3SJonas Devlieghere True, 402238dcc3SJonas Devlieghere ) 4199451b44SJordan Rupprecht 4299451b44SJordan Rupprecht context = self.expect_gdbremote_sequence() 4399451b44SJordan Rupprecht spec = context.get("spec") 44*737bc9f7SJonas Devlieghere self.assertRegex(spec, '"file_path":".*"') 45*737bc9f7SJonas Devlieghere self.assertRegex(spec, '"file_offset":\d+') 46*737bc9f7SJonas Devlieghere self.assertRegex(spec, '"file_size":\d+') 47*737bc9f7SJonas Devlieghere self.assertRegex(spec, '"triple":"\w*-\w*-.*"') 48*737bc9f7SJonas Devlieghere self.assertRegex(spec, '"uuid":"[A-Fa-f0-9]+"') 49