llvm-project/lldb/test/API/tools/lldb-dap/moduleSymbols/TestDAP_moduleSymbols.py
Ely Ronnen 8b64cd8be2
[lldb-dap] Add module symbol table viewer to VS Code extension #140626 (#153836)
- VS Code extension:
- Add module symbol table viewer using
[Tabulator](https://tabulator.info/) for sorting and formatting rows.
  - Add context menu action to the modules tree.
 - lldb-dap
   -  Add `DAPGetModuleSymbolsRequest` to get symbols from a module.
 
Fixes #140626

[Screencast From 2025-08-15
19-12-33.webm](https://github.com/user-attachments/assets/75e2f229-ac82-487c-812e-3ea33a575b70)
2025-08-21 00:31:48 +02:00

38 lines
1.1 KiB
Python

"""
Test lldb-dap moduleSymbols request
"""
import lldbdap_testcase
class TestDAP_moduleSymbols(lldbdap_testcase.DAPTestCaseBase):
def test_moduleSymbols(self):
"""
Test that the moduleSymbols request returns correct symbols from the module.
"""
program = self.getBuildArtifact("a.out")
self.build_and_launch(program)
symbol_names = []
i = 0
while True:
next_symbol = self.dap_server.request_moduleSymbols(
moduleName="a.out", startIndex=i, count=1
)
self.assertIn("symbols", next_symbol["body"])
result_symbols = next_symbol["body"]["symbols"]
self.assertLessEqual(len(result_symbols), 1)
if len(result_symbols) == 0:
break
self.assertIn("name", result_symbols[0])
symbol_names.append(result_symbols[0]["name"])
i += 1
if i >= 1000:
break
self.assertGreater(len(symbol_names), 0)
self.assertIn("main", symbol_names)
self.assertIn("func1", symbol_names)
self.assertIn("func2", symbol_names)