41 lines · python
1"""2Test lldb-dap moduleSymbols request3"""4 5import lldbdap_testcase6from lldbsuite.test.decorators import *7 8 9class TestDAP_moduleSymbols(lldbdap_testcase.DAPTestCaseBase):10 # On windows LLDB doesn't recognize symbols in a.out.11 @skipIfWindows12 def test_moduleSymbols(self):13 """14 Test that the moduleSymbols request returns correct symbols from the module.15 """16 program = self.getBuildArtifact("a.out")17 self.build_and_launch(program)18 19 symbol_names = []20 i = 021 while True:22 next_symbol = self.dap_server.request_moduleSymbols(23 moduleName="a.out", startIndex=i, count=124 )25 self.assertIn("symbols", next_symbol["body"])26 result_symbols = next_symbol["body"]["symbols"]27 self.assertLessEqual(len(result_symbols), 1)28 if len(result_symbols) == 0:29 break30 31 self.assertIn("name", result_symbols[0])32 symbol_names.append(result_symbols[0]["name"])33 i += 134 if i >= 1000:35 break36 37 self.assertGreater(len(symbol_names), 0)38 self.assertIn("main", symbol_names)39 self.assertIn("func1", symbol_names)40 self.assertIn("func2", symbol_names)41