[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP module tests. (PR #207869)
https://github.com/da-viper closed https://github.com/llvm/llvm-project/pull/207869 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP module tests. (PR #207869)
https://github.com/ashgti approved this pull request. https://github.com/llvm/llvm-project/pull/207869 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP module tests. (PR #207869)
github-actions[bot] wrote: # :window: Windows x64 Test Results * 33345 tests passed * 902 tests skipped * 1 test failed ## Failed Tests (click on a test name to see its output) ### lldb-api lldb-api.tools/lldb-dap/module-event/TestDAP_module_event.py ``` Script: -- C:/Python312/python.exe C:/_work/llvm-project/llvm-project/lldb\test\API\dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=C:/_work/llvm-project/llvm-project/build/./lib --env LLVM_INCLUDE_DIR=C:/_work/llvm-project/llvm-project/build/include --env LLVM_TOOLS_DIR=C:/_work/llvm-project/llvm-project/build/./bin --triple x86_64-pc-windows-msvc --build-dir C:/_work/llvm-project/llvm-project/build/lldb-test-build --lldb-module-cache-dir C:/_work/llvm-project/llvm-project/build/lldb-test-build/module-cache-lldb\lldb-api --clang-module-cache-dir C:/_work/llvm-project/llvm-project/build/lldb-test-build/module-cache-clang\lldb-api --executable C:/_work/llvm-project/llvm-project/build/./bin/lldb.exe --lldb-python-dir C:\_work\llvm-project\llvm-project\build\Lib\site-packages --compiler C:/_work/llvm-project/llvm-project/build/./bin/clang.exe --dsymutil C:/_work/llvm-project/llvm-project/build/./bin/dsymutil.exe --make C:/ProgramData/chocolatey/bin/make.exe --llvm-tools-dir C:/_work/llvm-project/llvm-project/build/./bin --lldb-obj-root C:/_work/llvm-project/llvm-project/build/tools/lldb --lldb-libs-dir C:/_work/llvm-project/llvm-project/build/./lib --cmake-build-type Release --env LLDB_LAUNCH_FLAG_USE_PIPES=1 C:\_work\llvm-project\llvm-project\lldb\test\API\tools\lldb-dap\module-event -p TestDAP_module_event.py -- Exit Code: 1 Command Output (stdout): -- Skipping the following test categories: libc++, libstdcxx, dwo, dsym, gmodules, debugserver, objc, fork, pexpect -- Command Output (stderr): -- FAIL: LLDB (C:\_work\llvm-project\llvm-project\build\bin\clang.exe-x86_64) :: test_module_event (TestDAP_module_event.TestDAP_module_event.test_module_event) Log Files: - C:\_work\llvm-project\llvm-project\build\lldb-test-build\tools\lldb-dap\module-event\TestDAP_module_event\Error_test_module_event.log == ERROR: test_module_event (TestDAP_module_event.TestDAP_module_event.test_module_event) -- Error when building test subject. Build Command: C:/ProgramData/chocolatey/bin/make.exe 'VPATH=C:\_work\llvm-project\llvm-project\lldb\test\API\tools\lldb-dap\module-event' -C 'C:\_work\llvm-project\llvm-project\build\lldb-test-build\tools\lldb-dap\module-event\TestDAP_module_event' -I 'C:\_work\llvm-project\llvm-project\lldb\test\API\tools\lldb-dap\module-event' -I 'C:\_work\llvm-project\llvm-project\lldb\packages\Python\lldbsuite\test\make' -f 'C:\_work\llvm-project\llvm-project\lldb\test\API\tools\lldb-dap\module-event\Makefile' all TRIPLE=x86_64-pc-windows-msvc 'CC=C:\_work\llvm-project\llvm-project\build\bin\clang.exe' CC_TYPE=clang 'CXX=C:\_work\llvm-project\llvm-project\build\bin\clang++.exe' 'LLVM_AR=C:/_work/llvm-project/llvm-project/build/./bin\llvm-ar.exe' 'AR=C:/_work/llvm-project/llvm-project/build/./bin\llvm-ar.exe' 'OBJCOPY=C:/_work/llvm-project/llvm-project/build/./bin\llvm-objcopy.exe' 'STRIP=C:/_work/llvm-project/llvm-project/build/./bin\llvm-strip.exe' 'ARCHIVER=C:/_work/llvm-project/llvm-project/build/./bin\llvm-ar.exe' 'DWP=C:/_work/llvm-project/llvm-project/build/./bin\llvm-dwp.exe' 'CLANG_MODULE_CACHE_DIR=C:/_work/llvm-project/llvm-project/build/lldb-test-build/module-cache-clang\lldb-api' LLDB_OBJ_ROOT=C:/_work/llvm-project/llvm-project/build/tools/lldb OS=Windows_NT HOST_OS=Windows_NT Build Command Output: make: Entering directory 'C:/_work/llvm-project/llvm-project/build/lldb-test-build/tools/lldb-dap/module-event/TestDAP_module_event' "C:\_work\llvm-project\llvm-project\build\bin\clang++.exe" -mllvm -x86-asm-syntax=att -std=c++11 -gdwarf -O0 -IC:\_work\llvm-project\llvm-project\lldb\packages\Python\lldbsuite\test\make/../../../../..//include -IC:/_work/llvm-project/llvm-project/build/tools/lldb/include -IC:\_work\llvm-project\llvm-project\lldb\test\API\tools\lldb-dap\module-event -IC:\_work\llvm-project\llvm-project\lldb\packages\Python\lldbsuite\test\make -include C:\_work\llvm-project\llvm-project\lldb\packages\Python\lldbsuite\test\make/test_common.h -fno-limit-debug-info -target x86_64-pc-windows-msvc -mllvm -x86-asm-syntax=att -fms-compatibility-version=19.0 -std=c++14 --driver-mode=g++ -MT main.o -MD -MP -MF main.d -c -o main.o C:\_work\llvm-project\llvm-project\lldb\test\API\tools\lldb-dap\module-event/main.cpp C:\_work\llvm-project\llvm-project\lldb\test\API\tools\lldb-dap\module-event/main.cpp:1:10: fatal error: 'dlfcn.h' file not found 1 | #include | ^ 1 error generated. make: *** [Makefile.rules:668: main.o] Error 1 make: Leaving directory 'C:/_work/llvm-project/llvm-project/bui
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP module tests. (PR #207869)
https://github.com/DrSergei approved this pull request. https://github.com/llvm/llvm-project/pull/207869 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP module tests. (PR #207869)
@@ -2,39 +2,37 @@
Test lldb-dap moduleSymbols request
"""
-import lldbdap_testcase
-from lldbsuite.test.decorators import *
+from lldbsuite.test.decorators import skipIfWindows
+from lldbsuite.test.tools.lldb_dap.dap_types import LaunchArgs,
ModuleSymbolsArgs
+from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase
-class TestDAP_moduleSymbols(lldbdap_testcase.DAPTestCaseBase):
+class TestDAP_moduleSymbols(DAPTestCaseBase):
# On windows LLDB doesn't recognize symbols in a.out.
@skipIfWindows
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)
+session = self.build_and_create_session()
+session.launch(LaunchArgs(program=program))
-symbol_names = []
-i = 0
+symbol_names = set()
+start = 0
+page_size = 100
while True:
-next_symbol = self.dap_server.request_moduleSymbols(
-moduleName="a.out", startIndex=i, count=1
+module_sym_args = ModuleSymbolsArgs(
+moduleName="a.out", startIndex=start, count=page_size
)
-self.assertIn("symbols", next_symbol["body"])
-result_symbols = next_symbol["body"]["symbols"]
-self.assertLessEqual(len(result_symbols), 1)
-if len(result_symbols) == 0:
-break
+response = session.send_request(module_sym_args).result()
+symbols = response.body.symbols
+symbol_names.update(sym.name for sym in symbols)
-self.assertIn("name", result_symbols[0])
-symbol_names.append(result_symbols[0]["name"])
-i += 1
-if i >= 1000:
+if len(symbols) < page_size:
da-viper wrote:
The logic is a little different. previously there is a top limit on the number
of symbols. so we fetch 1 symbol and stop if we get 0 symbols or the number of
symbols >= 1000.
but now we fetch 100 symbols for each call and only stop if we receive less
than 100 symbols (signifying there is no more symbols in the module).
https://github.com/llvm/llvm-project/pull/207869
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP module tests. (PR #207869)
@@ -1,57 +1,50 @@ -import dap_server -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil -import lldbdap_testcase -import re +from lldbsuite.test.lldbtest import line_number +from lldbsuite.test.tools.lldb_dap.dap_types import LaunchArgs, StoppedReason +from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase -@skipIfTargetDoesNotSupportSharedLibraries() da-viper wrote: No it isn't, added it back https://github.com/llvm/llvm-project/pull/207869 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP module tests. (PR #207869)
@@ -2,88 +2,94 @@
Test lldb-dap module request
"""
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-import lldbdap_testcase
+import platform
import re
+from lldbsuite.test.decorators import skipIfWindows, skipUnlessDarwin
+from lldbsuite.test.lldbtest import line_number
+from lldbsuite.test.tools.lldb_dap.dap_types import (
+CompileUnitsArgs,
+LaunchArgs,
+ModuleEvent,
+ModuleReason,
+)
+from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase
-@skipIfTargetDoesNotSupportSharedLibraries()
-class TestDAP_module(lldbdap_testcase.DAPTestCaseBase):
-def run_test(self, symbol_basename, expect_debug_info_size):
+
+class TestDAP_module(DAPTestCaseBase):
+def run_test(self, symbol_basename: str, expect_debug_info_size: bool):
+session = self.build_and_create_session()
program_basename = "a.out.stripped"
program = self.getBuildArtifact(program_basename)
-self.build_and_launch(program)
-functions = ["foo"]
-# This breakpoint will be resolved only when the libfoo module is
loaded
-breakpoint_ids = self.set_function_breakpoints(
-functions, wait_for_resolve=False
-)
-self.assertEqual(len(breakpoint_ids), len(functions), "expect one
breakpoint")
-self.continue_to_breakpoints(breakpoint_ids)
-active_modules = self.dap_server.get_modules()
+with session.configure(LaunchArgs(program)) as ctx:
+# This breakpoint will be resolved only when the libfoo module is
loaded.
+breakpoints =
session.set_function_breakpoints(["foo"]).body.breakpoints
+self.assertEqual(len(breakpoints), 1, "expect one breakpoint.")
+foo_bp_id = self.expect_not_none(breakpoints[0].id)
+
+session.verify_stopped_on_breakpoint(foo_bp_id,
after=ctx.process_event)
+active_modules = session.get_modules()
program_module = active_modules[program_basename]
self.assertIn(
program_basename,
active_modules,
-"%s module is in active modules" % (program_basename),
+f"{program_basename} module is in active modules",
)
-self.assertIn("name", program_module, "make sure name is in module")
-self.assertEqual(program_basename, program_module["name"])
-self.assertIn("path", program_module, "make sure path is in module")
-self.assertEqual(program, program_module["path"])
-self.assertNotIn(
-"symbolFilePath",
-program_module,
-"Make sure a.out.stripped has no debug info",
+self.assertEqual(program_basename, program_module.name)
+self.assertIsNotNone(program_module.path, "make sure path is in
module")
+self.assertEqual(program, program_module.path)
+self.assertIsNone(
+program_module.symbolFilePath, "Make sure a.out.stripped has no
debug info"
)
symbols_path = self.getBuildArtifact(symbol_basename)
-self.dap_server.request_evaluate(
-"`%s" % ('target symbols add -s "%s" "%s"' % (program,
symbols_path)),
-context="repl",
+event_before_mod_change = session.last_event()
+session.evaluate(
+f'''`target symbols add -s "{program}" "{symbols_path}"''',
context="repl"
)
-def check_symbols_loaded_with_size():
-active_modules = self.dap_server.get_modules()
-program_module = active_modules[program_basename]
-self.assertIn("symbolFilePath", program_module)
-self.assertIn(symbols_path, program_module["symbolFilePath"])
-size_regex = re.compile(r"[0-9]+(\.[0-9]*)?[KMG]?B")
-return size_regex.match(program_module["debugInfoSize"])
+# Make sure we got an update event for the program module when the
+# symbols got added.
+changed_event = session.verify_next_module_event(
+ModuleReason.CHANGED, after=event_before_mod_change
+)
+changed_module = changed_event.body.module
+self.assertEqual(program_module.name, changed_module.name)
+self.assertIsNotNone(changed_module.symbolFilePath)
+changed_symbols_path =
self.expect_not_none(changed_module.symbolFilePath)
+self.assertIn(symbols_path, changed_symbols_path)
if expect_debug_info_size:
-self.assertTrue(
-self.wait_until(check_symbols_loaded_with_size),
-"expect has debug info size",
+changed_debug_size =
self.expect_not_none(changed_module.debugInfoSize)
+size_regex = re.compile(r"[0-9]+(\.[0-9]*)?[KMG]?B")
+self.assertRegex(
+changed_debug_size, size_regex, "expect has debug info size"
)
-active_modules = self.dap_server.get_modules()
+active_modules = session.get_modules()
pr
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP module tests. (PR #207869)
https://github.com/da-viper updated
https://github.com/llvm/llvm-project/pull/207869
>From 1760c25edb6d79ded84d5d8a433d67987f09a3eb Mon Sep 17 00:00:00 2001
From: Ebuka Ezike
Date: Thu, 2 Jul 2026 17:05:10 +0100
Subject: [PATCH 1/2] [lldb-dap] Migrate all DAP module tests.
---
.../module-event/TestDAP_module_event.py | 67
.../tools/lldb-dap/module/TestDAP_module.py | 144 +-
.../moduleSymbols/TestDAP_moduleSymbols.py| 34 ++---
3 files changed, 122 insertions(+), 123 deletions(-)
diff --git a/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
b/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
index bf64f7f822ea2..4b3ef9dc725df 100644
--- a/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
+++ b/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
@@ -1,57 +1,50 @@
-import dap_server
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-import lldbdap_testcase
-import re
+from lldbsuite.test.lldbtest import line_number
+from lldbsuite.test.tools.lldb_dap.dap_types import LaunchArgs, StoppedReason
+from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase
-@skipIfTargetDoesNotSupportSharedLibraries()
-class TestDAP_module_event(lldbdap_testcase.DAPTestCaseBase):
-@skipIfWindows
+class TestDAP_module_event(DAPTestCaseBase):
def test_module_event(self):
+session = self.build_and_create_session()
program = self.getBuildArtifact("a.out")
-self.build_and_launch(program)
source = "main.cpp"
-breakpoint1_line = line_number(source, "// breakpoint 1")
-breakpoint2_line = line_number(source, "// breakpoint 2")
-breakpoint3_line = line_number(source, "// breakpoint 3")
-
-breakpoint_ids = self.set_source_breakpoints(
-source, [breakpoint1_line, breakpoint2_line, breakpoint3_line]
+bp1_line = line_number(source, "// breakpoint 1")
+bp2_line = line_number(source, "// breakpoint 2")
+bp3_line = line_number(source, "// breakpoint 3")
+
+with session.configure(LaunchArgs(program=program)) as ctx:
+[bp1, bp2, bp3] = session.resolve_source_breakpoints(
+source, [bp1_line, bp2_line, bp3_line]
+)
+# Wait for the breakpoint before dlopen.
+before_dlopen_event = session.verify_stopped_on_breakpoint(
+bp1, after=ctx.process_event
)
-self.continue_to_breakpoints(breakpoint_ids)
-
-# We're now stopped at breakpoint 1 before the dlopen. Flush all the
module events.
-self.dap_server.wait_for_module_events()
# Continue to the second breakpoint, before the dlclose.
-self.continue_to_breakpoints(breakpoint_ids)
+session.continue_to_breakpoint(bp2)
# Make sure we got a module event for libother.
-event = self.dap_server.wait_for_event(["module"])
-self.assertIsNotNone(event, "didn't get a module event")
-module_name = event["body"]["module"]["name"]
-module_id = event["body"]["module"]["id"]
-self.assertEqual(event["body"]["reason"], "new")
-self.assertIn("libother", module_name)
+new_module_event =
session.verify_next_module_event(after=before_dlopen_event)
+module_id = new_module_event.body.module.id
+self.assertEqual(new_module_event.body.reason, "new")
+self.assertIn("libother", new_module_event.body.module.name)
# Continue to the third breakpoint, after the dlclose.
-self.continue_to_breakpoints(breakpoint_ids)
+session.continue_to_breakpoint(bp3)
# Make sure we got a module event for libother.
-event = self.dap_server.wait_for_event(["module"])
-self.assertIsNotNone(event, "didn't get a module event")
-reason = event["body"]["reason"]
+removed_module_event =
session.verify_next_module_event(after=new_module_event)
+reason = removed_module_event.body.reason
self.assertEqual(reason, "removed")
-self.assertEqual(event["body"]["module"]["id"], module_id)
+self.assertEqual(removed_module_event.body.module.id, module_id)
# The removed module event should omit everything but the module id
and name
# as they are required fields.
-module_data = event["body"]["module"]
-required_keys = ["id", "name"]
-self.assertListEqual(list(module_data.keys()), required_keys)
-self.assertEqual(module_data["name"], "", "expects empty name.")
+removed_module = removed_module_event.body.module
+self.assertIsNotNone(removed_module.id)
+self.assertIsNotNone(removed_module.name)
+self.assertEqual(removed_module.name, "", "expects empty name.")
-self.continue_to_exit()
+session.continue_to_exit()
diff --git a/lldb/test/API/tools/lldb-
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP module tests. (PR #207869)
@@ -2,88 +2,94 @@
Test lldb-dap module request
"""
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-import lldbdap_testcase
+import platform
import re
+from lldbsuite.test.decorators import skipIfWindows, skipUnlessDarwin
+from lldbsuite.test.lldbtest import line_number
+from lldbsuite.test.tools.lldb_dap.dap_types import (
+CompileUnitsArgs,
+LaunchArgs,
+ModuleEvent,
+ModuleReason,
+)
+from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase
-@skipIfTargetDoesNotSupportSharedLibraries()
-class TestDAP_module(lldbdap_testcase.DAPTestCaseBase):
-def run_test(self, symbol_basename, expect_debug_info_size):
+
+class TestDAP_module(DAPTestCaseBase):
+def run_test(self, symbol_basename: str, expect_debug_info_size: bool):
+session = self.build_and_create_session()
program_basename = "a.out.stripped"
program = self.getBuildArtifact(program_basename)
-self.build_and_launch(program)
-functions = ["foo"]
-# This breakpoint will be resolved only when the libfoo module is
loaded
-breakpoint_ids = self.set_function_breakpoints(
-functions, wait_for_resolve=False
-)
-self.assertEqual(len(breakpoint_ids), len(functions), "expect one
breakpoint")
-self.continue_to_breakpoints(breakpoint_ids)
-active_modules = self.dap_server.get_modules()
+with session.configure(LaunchArgs(program)) as ctx:
+# This breakpoint will be resolved only when the libfoo module is
loaded.
+breakpoints =
session.set_function_breakpoints(["foo"]).body.breakpoints
+self.assertEqual(len(breakpoints), 1, "expect one breakpoint.")
+foo_bp_id = self.expect_not_none(breakpoints[0].id)
+
+session.verify_stopped_on_breakpoint(foo_bp_id,
after=ctx.process_event)
+active_modules = session.get_modules()
program_module = active_modules[program_basename]
self.assertIn(
program_basename,
active_modules,
-"%s module is in active modules" % (program_basename),
+f"{program_basename} module is in active modules",
)
-self.assertIn("name", program_module, "make sure name is in module")
-self.assertEqual(program_basename, program_module["name"])
-self.assertIn("path", program_module, "make sure path is in module")
-self.assertEqual(program, program_module["path"])
-self.assertNotIn(
-"symbolFilePath",
-program_module,
-"Make sure a.out.stripped has no debug info",
+self.assertEqual(program_basename, program_module.name)
+self.assertIsNotNone(program_module.path, "make sure path is in
module")
+self.assertEqual(program, program_module.path)
+self.assertIsNone(
+program_module.symbolFilePath, "Make sure a.out.stripped has no
debug info"
)
symbols_path = self.getBuildArtifact(symbol_basename)
-self.dap_server.request_evaluate(
-"`%s" % ('target symbols add -s "%s" "%s"' % (program,
symbols_path)),
-context="repl",
+event_before_mod_change = session.last_event()
+session.evaluate(
+f'''`target symbols add -s "{program}" "{symbols_path}"''',
context="repl"
)
-def check_symbols_loaded_with_size():
-active_modules = self.dap_server.get_modules()
-program_module = active_modules[program_basename]
-self.assertIn("symbolFilePath", program_module)
-self.assertIn(symbols_path, program_module["symbolFilePath"])
-size_regex = re.compile(r"[0-9]+(\.[0-9]*)?[KMG]?B")
-return size_regex.match(program_module["debugInfoSize"])
+# Make sure we got an update event for the program module when the
+# symbols got added.
+changed_event = session.verify_next_module_event(
+ModuleReason.CHANGED, after=event_before_mod_change
+)
+changed_module = changed_event.body.module
+self.assertEqual(program_module.name, changed_module.name)
+self.assertIsNotNone(changed_module.symbolFilePath)
+changed_symbols_path =
self.expect_not_none(changed_module.symbolFilePath)
+self.assertIn(symbols_path, changed_symbols_path)
if expect_debug_info_size:
-self.assertTrue(
-self.wait_until(check_symbols_loaded_with_size),
-"expect has debug info size",
+changed_debug_size =
self.expect_not_none(changed_module.debugInfoSize)
+size_regex = re.compile(r"[0-9]+(\.[0-9]*)?[KMG]?B")
+self.assertRegex(
+changed_debug_size, size_regex, "expect has debug info size"
)
-active_modules = self.dap_server.get_modules()
+active_modules = session.get_modules()
pr
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP module tests. (PR #207869)
@@ -2,88 +2,94 @@ Test lldb-dap module request """ -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -import lldbdap_testcase +import platform import re +from lldbsuite.test.decorators import skipIfWindows, skipUnlessDarwin +from lldbsuite.test.lldbtest import line_number +from lldbsuite.test.tools.lldb_dap.dap_types import ( +CompileUnitsArgs, +LaunchArgs, +ModuleEvent, +ModuleReason, +) +from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase -@skipIfTargetDoesNotSupportSharedLibraries() -class TestDAP_module(lldbdap_testcase.DAPTestCaseBase): -def run_test(self, symbol_basename, expect_debug_info_size): + +class TestDAP_module(DAPTestCaseBase): +def run_test(self, symbol_basename: str, expect_debug_info_size: bool): +session = self.build_and_create_session() program_basename = "a.out.stripped" program = self.getBuildArtifact(program_basename) -self.build_and_launch(program) -functions = ["foo"] -# This breakpoint will be resolved only when the libfoo module is loaded -breakpoint_ids = self.set_function_breakpoints( -functions, wait_for_resolve=False -) -self.assertEqual(len(breakpoint_ids), len(functions), "expect one breakpoint") -self.continue_to_breakpoints(breakpoint_ids) -active_modules = self.dap_server.get_modules() +with session.configure(LaunchArgs(program)) as ctx: +# This breakpoint will be resolved only when the libfoo module is loaded. +breakpoints = session.set_function_breakpoints(["foo"]).body.breakpoints +self.assertEqual(len(breakpoints), 1, "expect one breakpoint.") +foo_bp_id = self.expect_not_none(breakpoints[0].id) DrSergei wrote: Can we add check that `breakpoints[0].verified` is `False`? https://github.com/llvm/llvm-project/pull/207869 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP module tests. (PR #207869)
@@ -1,57 +1,50 @@ -import dap_server -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil -import lldbdap_testcase -import re +from lldbsuite.test.lldbtest import line_number +from lldbsuite.test.tools.lldb_dap.dap_types import LaunchArgs, StoppedReason +from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase -@skipIfTargetDoesNotSupportSharedLibraries() DrSergei wrote: Is it safe to remove these decorators? https://github.com/llvm/llvm-project/pull/207869 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP module tests. (PR #207869)
@@ -2,39 +2,37 @@
Test lldb-dap moduleSymbols request
"""
-import lldbdap_testcase
-from lldbsuite.test.decorators import *
+from lldbsuite.test.decorators import skipIfWindows
+from lldbsuite.test.tools.lldb_dap.dap_types import LaunchArgs,
ModuleSymbolsArgs
+from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase
-class TestDAP_moduleSymbols(lldbdap_testcase.DAPTestCaseBase):
+class TestDAP_moduleSymbols(DAPTestCaseBase):
# On windows LLDB doesn't recognize symbols in a.out.
@skipIfWindows
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)
+session = self.build_and_create_session()
+session.launch(LaunchArgs(program=program))
-symbol_names = []
-i = 0
+symbol_names = set()
+start = 0
+page_size = 100
while True:
-next_symbol = self.dap_server.request_moduleSymbols(
-moduleName="a.out", startIndex=i, count=1
+module_sym_args = ModuleSymbolsArgs(
+moduleName="a.out", startIndex=start, count=page_size
)
-self.assertIn("symbols", next_symbol["body"])
-result_symbols = next_symbol["body"]["symbols"]
-self.assertLessEqual(len(result_symbols), 1)
-if len(result_symbols) == 0:
-break
+response = session.send_request(module_sym_args).result()
+symbols = response.body.symbols
+symbol_names.update(sym.name for sym in symbols)
-self.assertIn("name", result_symbols[0])
-symbol_names.append(result_symbols[0]["name"])
-i += 1
-if i >= 1000:
+if len(symbols) < page_size:
DrSergei wrote:
If I understand original logic correctly, it should be `len(symbols) >=
page_size`
https://github.com/llvm/llvm-project/pull/207869
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP module tests. (PR #207869)
llvmorg-github-actions[bot] wrote:
@llvm/pr-subscribers-lldb
Author: Ebuka Ezike (da-viper)
Changes
migrate tests module, moduleEvents and moduleSymbols
---
Full diff: https://github.com/llvm/llvm-project/pull/207869.diff
3 Files Affected:
- (modified) lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
(+30-37)
- (modified) lldb/test/API/tools/lldb-dap/module/TestDAP_module.py (+76-68)
- (modified)
lldb/test/API/tools/lldb-dap/moduleSymbols/TestDAP_moduleSymbols.py (+16-18)
``diff
diff --git a/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
b/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
index bf64f7f822ea2..4b3ef9dc725df 100644
--- a/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
+++ b/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
@@ -1,57 +1,50 @@
-import dap_server
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-import lldbdap_testcase
-import re
+from lldbsuite.test.lldbtest import line_number
+from lldbsuite.test.tools.lldb_dap.dap_types import LaunchArgs, StoppedReason
+from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase
-@skipIfTargetDoesNotSupportSharedLibraries()
-class TestDAP_module_event(lldbdap_testcase.DAPTestCaseBase):
-@skipIfWindows
+class TestDAP_module_event(DAPTestCaseBase):
def test_module_event(self):
+session = self.build_and_create_session()
program = self.getBuildArtifact("a.out")
-self.build_and_launch(program)
source = "main.cpp"
-breakpoint1_line = line_number(source, "// breakpoint 1")
-breakpoint2_line = line_number(source, "// breakpoint 2")
-breakpoint3_line = line_number(source, "// breakpoint 3")
-
-breakpoint_ids = self.set_source_breakpoints(
-source, [breakpoint1_line, breakpoint2_line, breakpoint3_line]
+bp1_line = line_number(source, "// breakpoint 1")
+bp2_line = line_number(source, "// breakpoint 2")
+bp3_line = line_number(source, "// breakpoint 3")
+
+with session.configure(LaunchArgs(program=program)) as ctx:
+[bp1, bp2, bp3] = session.resolve_source_breakpoints(
+source, [bp1_line, bp2_line, bp3_line]
+)
+# Wait for the breakpoint before dlopen.
+before_dlopen_event = session.verify_stopped_on_breakpoint(
+bp1, after=ctx.process_event
)
-self.continue_to_breakpoints(breakpoint_ids)
-
-# We're now stopped at breakpoint 1 before the dlopen. Flush all the
module events.
-self.dap_server.wait_for_module_events()
# Continue to the second breakpoint, before the dlclose.
-self.continue_to_breakpoints(breakpoint_ids)
+session.continue_to_breakpoint(bp2)
# Make sure we got a module event for libother.
-event = self.dap_server.wait_for_event(["module"])
-self.assertIsNotNone(event, "didn't get a module event")
-module_name = event["body"]["module"]["name"]
-module_id = event["body"]["module"]["id"]
-self.assertEqual(event["body"]["reason"], "new")
-self.assertIn("libother", module_name)
+new_module_event =
session.verify_next_module_event(after=before_dlopen_event)
+module_id = new_module_event.body.module.id
+self.assertEqual(new_module_event.body.reason, "new")
+self.assertIn("libother", new_module_event.body.module.name)
# Continue to the third breakpoint, after the dlclose.
-self.continue_to_breakpoints(breakpoint_ids)
+session.continue_to_breakpoint(bp3)
# Make sure we got a module event for libother.
-event = self.dap_server.wait_for_event(["module"])
-self.assertIsNotNone(event, "didn't get a module event")
-reason = event["body"]["reason"]
+removed_module_event =
session.verify_next_module_event(after=new_module_event)
+reason = removed_module_event.body.reason
self.assertEqual(reason, "removed")
-self.assertEqual(event["body"]["module"]["id"], module_id)
+self.assertEqual(removed_module_event.body.module.id, module_id)
# The removed module event should omit everything but the module id
and name
# as they are required fields.
-module_data = event["body"]["module"]
-required_keys = ["id", "name"]
-self.assertListEqual(list(module_data.keys()), required_keys)
-self.assertEqual(module_data["name"], "", "expects empty name.")
+removed_module = removed_module_event.body.module
+self.assertIsNotNone(removed_module.id)
+self.assertIsNotNone(removed_module.name)
+self.assertEqual(removed_module.name, "", "expects empty name.")
-self.continue_to_exit()
+session.continue_to_exit()
diff --git a/lldb/test/API/tools/lldb-da
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP module tests. (PR #207869)
https://github.com/da-viper created
https://github.com/llvm/llvm-project/pull/207869
migrate tests module, moduleEvents and moduleSymbols
>From 1760c25edb6d79ded84d5d8a433d67987f09a3eb Mon Sep 17 00:00:00 2001
From: Ebuka Ezike
Date: Thu, 2 Jul 2026 17:05:10 +0100
Subject: [PATCH] [lldb-dap] Migrate all DAP module tests.
---
.../module-event/TestDAP_module_event.py | 67
.../tools/lldb-dap/module/TestDAP_module.py | 144 +-
.../moduleSymbols/TestDAP_moduleSymbols.py| 34 ++---
3 files changed, 122 insertions(+), 123 deletions(-)
diff --git a/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
b/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
index bf64f7f822ea2..4b3ef9dc725df 100644
--- a/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
+++ b/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
@@ -1,57 +1,50 @@
-import dap_server
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-import lldbdap_testcase
-import re
+from lldbsuite.test.lldbtest import line_number
+from lldbsuite.test.tools.lldb_dap.dap_types import LaunchArgs, StoppedReason
+from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase
-@skipIfTargetDoesNotSupportSharedLibraries()
-class TestDAP_module_event(lldbdap_testcase.DAPTestCaseBase):
-@skipIfWindows
+class TestDAP_module_event(DAPTestCaseBase):
def test_module_event(self):
+session = self.build_and_create_session()
program = self.getBuildArtifact("a.out")
-self.build_and_launch(program)
source = "main.cpp"
-breakpoint1_line = line_number(source, "// breakpoint 1")
-breakpoint2_line = line_number(source, "// breakpoint 2")
-breakpoint3_line = line_number(source, "// breakpoint 3")
-
-breakpoint_ids = self.set_source_breakpoints(
-source, [breakpoint1_line, breakpoint2_line, breakpoint3_line]
+bp1_line = line_number(source, "// breakpoint 1")
+bp2_line = line_number(source, "// breakpoint 2")
+bp3_line = line_number(source, "// breakpoint 3")
+
+with session.configure(LaunchArgs(program=program)) as ctx:
+[bp1, bp2, bp3] = session.resolve_source_breakpoints(
+source, [bp1_line, bp2_line, bp3_line]
+)
+# Wait for the breakpoint before dlopen.
+before_dlopen_event = session.verify_stopped_on_breakpoint(
+bp1, after=ctx.process_event
)
-self.continue_to_breakpoints(breakpoint_ids)
-
-# We're now stopped at breakpoint 1 before the dlopen. Flush all the
module events.
-self.dap_server.wait_for_module_events()
# Continue to the second breakpoint, before the dlclose.
-self.continue_to_breakpoints(breakpoint_ids)
+session.continue_to_breakpoint(bp2)
# Make sure we got a module event for libother.
-event = self.dap_server.wait_for_event(["module"])
-self.assertIsNotNone(event, "didn't get a module event")
-module_name = event["body"]["module"]["name"]
-module_id = event["body"]["module"]["id"]
-self.assertEqual(event["body"]["reason"], "new")
-self.assertIn("libother", module_name)
+new_module_event =
session.verify_next_module_event(after=before_dlopen_event)
+module_id = new_module_event.body.module.id
+self.assertEqual(new_module_event.body.reason, "new")
+self.assertIn("libother", new_module_event.body.module.name)
# Continue to the third breakpoint, after the dlclose.
-self.continue_to_breakpoints(breakpoint_ids)
+session.continue_to_breakpoint(bp3)
# Make sure we got a module event for libother.
-event = self.dap_server.wait_for_event(["module"])
-self.assertIsNotNone(event, "didn't get a module event")
-reason = event["body"]["reason"]
+removed_module_event =
session.verify_next_module_event(after=new_module_event)
+reason = removed_module_event.body.reason
self.assertEqual(reason, "removed")
-self.assertEqual(event["body"]["module"]["id"], module_id)
+self.assertEqual(removed_module_event.body.module.id, module_id)
# The removed module event should omit everything but the module id
and name
# as they are required fields.
-module_data = event["body"]["module"]
-required_keys = ["id", "name"]
-self.assertListEqual(list(module_data.keys()), required_keys)
-self.assertEqual(module_data["name"], "", "expects empty name.")
+removed_module = removed_module_event.body.module
+self.assertIsNotNone(removed_module.id)
+self.assertIsNotNone(removed_module.name)
+self.assertEqual(removed_module.name, "", "expects empty name.")
-self.continue_to_exit()
+session.continu
