[Lldb-commits] [lldb] [lldb-dap] Migrate lldb-dap tests in `lldb-dap/breakpoint` (PR #208166)
https://github.com/da-viper updated
https://github.com/llvm/llvm-project/pull/208166
>From fec536f3102b714c47b770c251ed135ce87989f4 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike
Date: Tue, 7 Jul 2026 17:30:40 +0100
Subject: [PATCH 1/3] [lldb-dap] Migrate lldb-dap tests in
`lldb-dap/breakpoint`
migrate breakpointLocations, logpoints, setBreakpoints
exceptionBreakpoints and functionBreakpoints test
---
.../breakpoint/TestDAP_breakpointLocations.py | 121 ++---
.../lldb-dap/breakpoint/TestDAP_logpoints.py | 310 +---
.../breakpoint/TestDAP_setBreakpoints.py | 477 +-
.../TestDAP_setExceptionBreakpoints.py| 35 +-
.../TestDAP_setFunctionBreakpoints.py | 189 ---
5 files changed, 531 insertions(+), 601 deletions(-)
diff --git
a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
index 1fe5f8b9e2adc..f97b4b403b063 100644
--- a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
@@ -2,88 +2,77 @@
Test lldb-dap breakpointLocations request
"""
-
-import dap_server
-import shutil
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-import lldbdap_testcase
import os
+from lldbsuite.test.decorators import (
+skipIfTargetDoesNotSupportSharedLibraries,
+skipIfWindows,
+)
+from lldbsuite.test.lldbtest import line_number
+from lldbsuite.test.tools.lldb_dap.dap_types import BreakpointLocation,
LaunchArgs
+from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase
-@skipIfTargetDoesNotSupportSharedLibraries()
-class TestDAP_breakpointLocations(lldbdap_testcase.DAPTestCaseBase):
-def setUp(self):
-lldbdap_testcase.DAPTestCaseBase.setUp(self)
-
-self.main_basename = "main-copy.cpp"
-self.main_path =
os.path.realpath(self.getBuildArtifact(self.main_basename))
+@skipIfTargetDoesNotSupportSharedLibraries()
+class TestDAP_breakpointLocations(DAPTestCaseBase):
@skipIfWindows
def test_column_breakpoints(self):
"""Test retrieving the available breakpoint locations."""
program = self.getBuildArtifact("a.out")
-self.build_and_launch(program, stopOnEntry=True)
-loop_line = line_number(self.main_path, "// break loop")
-self.dap_server.request_continue()
+session = self.build_and_create_session()
+main_path = os.path.realpath(self.getBuildArtifact("main-copy.cpp"))
-# Ask for the breakpoint locations based only on the line number
-response = self.dap_server.request_breakpointLocations(
-self.main_path, loop_line
-)
-self.assertTrue(response["success"])
-self.assertEqual(
-response["body"]["breakpoints"],
-[
-{"line": loop_line, "column": 9},
-{"line": loop_line, "column": 13},
-{"line": loop_line, "column": 20},
-{"line": loop_line, "column": 23},
-{"line": loop_line, "column": 25},
-{"line": loop_line, "column": 34},
-{"line": loop_line, "column": 37},
-{"line": loop_line, "column": 39},
-{"line": loop_line, "column": 51},
-],
-)
+process_event = session.launch(LaunchArgs(program, stopOnEntry=True))
+session.verify_stopped_on_entry(after=process_event)
-# Ask for the breakpoint locations for a column range
-response = self.dap_server.request_breakpointLocations(
-self.main_path,
-loop_line,
-column=24,
-end_column=46,
-)
-self.assertTrue(response["success"])
-self.assertEqual(
-response["body"]["breakpoints"],
-[
-{"line": loop_line, "column": 25},
-{"line": loop_line, "column": 34},
-{"line": loop_line, "column": 37},
-{"line": loop_line, "column": 39},
-],
+# Ask for the breakpoint locations based only on the line number.
+loop_line = line_number(main_path, "// break loop")
+response = session.get_breakpoint_locations(main_path, loop_line)
+breakpoint_locations = response.body.breakpoints
+
+expected_locations = [
+BreakpointLocation(line=loop_line, column=9),
+BreakpointLocation(line=loop_line, column=13),
+BreakpointLocation(line=loop_line, column=20),
+BreakpointLocation(line=loop_line, column=23),
+BreakpointLocation(line=loop_line, column=25),
+BreakpointLocation(line=loop_line, column=34),
+BreakpointLocation(line=loop_line, column=37),
+BreakpointLocation(line=loop_line, column=39),
+BreakpointLocation(line
[Lldb-commits] [lldb] [lldb-dap] Migrate lldb-dap tests in `lldb-dap/breakpoint` (PR #208166)
https://github.com/DrSergei edited https://github.com/llvm/llvm-project/pull/208166 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate lldb-dap tests in `lldb-dap/breakpoint` (PR #208166)
@@ -159,110 +171,96 @@ def test_set_and_clear(self):
lines.remove(second_line)
# Set 2 breakpoints and verify that the previous breakpoints that were
# set above are still set.
-response = self.dap_server.request_setBreakpoints(
-Source.build(path=self.main_path), lines
-)
-breakpoints = response["body"]["breakpoints"]
+response = session.set_source_breakpoints(self.main_path, lines)
+breakpoints = response.body.breakpoints
self.assertEqual(
-len(breakpoints),
-len(lines),
-"expect %u source breakpoints" % (len(lines)),
+len(breakpoints), len(lines), f"expect {len(lines)} source
breakpoints"
)
-for index, breakpoint in enumerate(breakpoints):
-line = breakpoint["line"]
-self.assertEqual(line, lines[index])
+for expected_line, breakpoint in zip(lines, breakpoints):
+line = self.expect_not_none(breakpoint.line)
+self.assertEqual(line, expected_line)
# Verify the same breakpoints are still set within LLDB by
-# making sure the breakpoint ID didn't change
+# making sure the breakpoint ID didn't change.
self.assertEqual(
line_to_id[line],
-breakpoint["id"],
+breakpoint.id,
"verify previous breakpoints stayed the same",
)
-self.assertTrue(breakpoint["verified"], "expect breakpoint still
verified")
+self.assertTrue(breakpoint.verified, "expect breakpoint still
verified")
# Now get the full list of breakpoints set in the target and verify
# we have only 2 breakpoints set. The response above could have told
# us about 2 breakpoints, but we want to make sure we don't have the
# third one still set in the target
-response = self.dap_server.request_testGetTargetBreakpoints()
-breakpoints = response["body"]["breakpoints"]
+response =
session.send_request(DAPTestGetTargetBreakpointsArgs()).result()
+breakpoints = response.body.breakpoints
self.assertEqual(
len(breakpoints),
len(lines),
-"expect %u source breakpoints" % (len(lines)),
+f"expect {len(lines)} source breakpoints",
)
for breakpoint in breakpoints:
-line = breakpoint["line"]
+line = self.expect_not_none(breakpoint.line)
# Verify the same breakpoints are still set within LLDB by
# making sure the breakpoint ID didn't change
self.assertEqual(
line_to_id[line],
-breakpoint["id"],
+breakpoint.id,
"verify previous breakpoints stayed the same",
)
self.assertIn(line, lines, "line expected in lines array")
-self.assertTrue(breakpoint["verified"], "expect breakpoint still
verified")
+self.assertTrue(breakpoint.verified, "expect breakpoint still
verified")
# Now clear all breakpoints for the source file by passing down an
-# empty lines array
+# empty lines array.
lines = []
-response = self.dap_server.request_setBreakpoints(
-Source.build(path=self.main_path), lines
-)
-breakpoints = response["body"]["breakpoints"]
+response = session.set_source_breakpoints(self.main_path, lines)
+breakpoints = response.body.breakpoints
self.assertEqual(
len(breakpoints),
len(lines),
-"expect %u source breakpoints" % (len(lines)),
+f"expect {len(lines)} source breakpoints",
)
# Verify with the target that all breakpoints have been cleared
-response = self.dap_server.request_testGetTargetBreakpoints()
-breakpoints = response["body"]["breakpoints"]
+response =
session.send_request(DAPTestGetTargetBreakpointsArgs()).result()
DrSergei wrote:
Maybe we can create helper method to send this request
https://github.com/llvm/llvm-project/pull/208166
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate lldb-dap tests in `lldb-dap/breakpoint` (PR #208166)
@@ -114,91 +100,64 @@ def test_logmessage_advanced(self):
logMessage_prefix
+ "{int y = 0; if (i % 3 == 0) { y = i + 3;} else {y = i * 3;} y}"
)
-[loop_breakpoint_id, post_loop_breakpoint_id] =
self.set_source_breakpoints(
+[_, post_loop_breakpoint_id] = session.resolve_source_breakpoints(
self.main_path,
-[loop_line, after_loop_line],
-[{"logMessage": logMessage}, {}],
+[
+SourceBreakpoint(before_loop_line, logMessage=logMessage),
+SourceBreakpoint(after_loop_line),
+],
)
-# Continue to trigger the breakpoint with log messages
-self.dap_server.request_continue()
-
-# Verify we hit the breakpoint after loop line
-self.verify_breakpoint_hit([post_loop_breakpoint_id])
-
-output = self.get_console()
-lines = output.splitlines()
-logMessage_output = []
-for line in lines:
-if line.startswith(logMessage_prefix):
-logMessage_output.append(line)
-
-# Verify logMessage count
-loop_count = 10
-self.assertEqual(len(logMessage_output), loop_count)
-
-# Verify log message match
+post_loop_stop =
session.continue_to_breakpoint(post_loop_breakpoint_id)
+captured = session.collect_console(after=initial_stop,
until=post_loop_stop)
+logMessage_output = [
+line
+for line in captured.seen_texts.splitlines()
+if line.startswith(logMessage_prefix)
+]
DrSergei wrote:
I see some repetions of this pattern, maybe we can create helper function to do
this work
https://github.com/llvm/llvm-project/pull/208166
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate lldb-dap tests in `lldb-dap/breakpoint` (PR #208166)
https://github.com/DrSergei approved this pull request. LGTM Feel free to ignore my comments https://github.com/llvm/llvm-project/pull/208166 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate lldb-dap tests in `lldb-dap/breakpoint` (PR #208166)
https://github.com/da-viper updated
https://github.com/llvm/llvm-project/pull/208166
>From e7d4d3948291bd0310dd0423af8063e7ea45c0a6 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike
Date: Tue, 7 Jul 2026 17:30:40 +0100
Subject: [PATCH 1/2] [lldb-dap] Migrate lldb-dap tests in
`lldb-dap/breakpoint`
migrate breakpointLocations, logpoints, setBreakpoints
exceptionBreakpoints and functionBreakpoints test
---
.../breakpoint/TestDAP_breakpointLocations.py | 121 ++---
.../lldb-dap/breakpoint/TestDAP_logpoints.py | 310 +---
.../breakpoint/TestDAP_setBreakpoints.py | 477 +-
.../TestDAP_setExceptionBreakpoints.py| 35 +-
.../TestDAP_setFunctionBreakpoints.py | 189 ---
5 files changed, 531 insertions(+), 601 deletions(-)
diff --git
a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
index 1fe5f8b9e2adc..f97b4b403b063 100644
--- a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
@@ -2,88 +2,77 @@
Test lldb-dap breakpointLocations request
"""
-
-import dap_server
-import shutil
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-import lldbdap_testcase
import os
+from lldbsuite.test.decorators import (
+skipIfTargetDoesNotSupportSharedLibraries,
+skipIfWindows,
+)
+from lldbsuite.test.lldbtest import line_number
+from lldbsuite.test.tools.lldb_dap.dap_types import BreakpointLocation,
LaunchArgs
+from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase
-@skipIfTargetDoesNotSupportSharedLibraries()
-class TestDAP_breakpointLocations(lldbdap_testcase.DAPTestCaseBase):
-def setUp(self):
-lldbdap_testcase.DAPTestCaseBase.setUp(self)
-
-self.main_basename = "main-copy.cpp"
-self.main_path =
os.path.realpath(self.getBuildArtifact(self.main_basename))
+@skipIfTargetDoesNotSupportSharedLibraries()
+class TestDAP_breakpointLocations(DAPTestCaseBase):
@skipIfWindows
def test_column_breakpoints(self):
"""Test retrieving the available breakpoint locations."""
program = self.getBuildArtifact("a.out")
-self.build_and_launch(program, stopOnEntry=True)
-loop_line = line_number(self.main_path, "// break loop")
-self.dap_server.request_continue()
+session = self.build_and_create_session()
+main_path = os.path.realpath(self.getBuildArtifact("main-copy.cpp"))
-# Ask for the breakpoint locations based only on the line number
-response = self.dap_server.request_breakpointLocations(
-self.main_path, loop_line
-)
-self.assertTrue(response["success"])
-self.assertEqual(
-response["body"]["breakpoints"],
-[
-{"line": loop_line, "column": 9},
-{"line": loop_line, "column": 13},
-{"line": loop_line, "column": 20},
-{"line": loop_line, "column": 23},
-{"line": loop_line, "column": 25},
-{"line": loop_line, "column": 34},
-{"line": loop_line, "column": 37},
-{"line": loop_line, "column": 39},
-{"line": loop_line, "column": 51},
-],
-)
+process_event = session.launch(LaunchArgs(program, stopOnEntry=True))
+session.verify_stopped_on_entry(after=process_event)
-# Ask for the breakpoint locations for a column range
-response = self.dap_server.request_breakpointLocations(
-self.main_path,
-loop_line,
-column=24,
-end_column=46,
-)
-self.assertTrue(response["success"])
-self.assertEqual(
-response["body"]["breakpoints"],
-[
-{"line": loop_line, "column": 25},
-{"line": loop_line, "column": 34},
-{"line": loop_line, "column": 37},
-{"line": loop_line, "column": 39},
-],
+# Ask for the breakpoint locations based only on the line number.
+loop_line = line_number(main_path, "// break loop")
+response = session.get_breakpoint_locations(main_path, loop_line)
+breakpoint_locations = response.body.breakpoints
+
+expected_locations = [
+BreakpointLocation(line=loop_line, column=9),
+BreakpointLocation(line=loop_line, column=13),
+BreakpointLocation(line=loop_line, column=20),
+BreakpointLocation(line=loop_line, column=23),
+BreakpointLocation(line=loop_line, column=25),
+BreakpointLocation(line=loop_line, column=34),
+BreakpointLocation(line=loop_line, column=37),
+BreakpointLocation(line=loop_line, column=39),
+BreakpointLocation(line
[Lldb-commits] [lldb] [lldb-dap] Migrate lldb-dap tests in `lldb-dap/breakpoint` (PR #208166)
llvmorg-github-actions[bot] wrote:
@llvm/pr-subscribers-lldb
Author: Ebuka Ezike (da-viper)
Changes
migrate breakpointLocations, logpoints, setBreakpoints exceptionBreakpoints and
functionBreakpoints test
---
Patch is 65.93 KiB, truncated to 20.00 KiB below, full version:
https://github.com/llvm/llvm-project/pull/208166.diff
5 Files Affected:
- (modified)
lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py (+55-66)
- (modified) lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_logpoints.py
(+123-187)
- (modified) lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py
(+240-237)
- (modified)
lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setExceptionBreakpoints.py
(+22-13)
- (modified)
lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setFunctionBreakpoints.py
(+91-98)
``diff
diff --git
a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
index 1fe5f8b9e2adc..f97b4b403b063 100644
--- a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
@@ -2,88 +2,77 @@
Test lldb-dap breakpointLocations request
"""
-
-import dap_server
-import shutil
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-import lldbdap_testcase
import os
+from lldbsuite.test.decorators import (
+skipIfTargetDoesNotSupportSharedLibraries,
+skipIfWindows,
+)
+from lldbsuite.test.lldbtest import line_number
+from lldbsuite.test.tools.lldb_dap.dap_types import BreakpointLocation,
LaunchArgs
+from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase
-@skipIfTargetDoesNotSupportSharedLibraries()
-class TestDAP_breakpointLocations(lldbdap_testcase.DAPTestCaseBase):
-def setUp(self):
-lldbdap_testcase.DAPTestCaseBase.setUp(self)
-
-self.main_basename = "main-copy.cpp"
-self.main_path =
os.path.realpath(self.getBuildArtifact(self.main_basename))
+@skipIfTargetDoesNotSupportSharedLibraries()
+class TestDAP_breakpointLocations(DAPTestCaseBase):
@skipIfWindows
def test_column_breakpoints(self):
"""Test retrieving the available breakpoint locations."""
program = self.getBuildArtifact("a.out")
-self.build_and_launch(program, stopOnEntry=True)
-loop_line = line_number(self.main_path, "// break loop")
-self.dap_server.request_continue()
+session = self.build_and_create_session()
+main_path = os.path.realpath(self.getBuildArtifact("main-copy.cpp"))
-# Ask for the breakpoint locations based only on the line number
-response = self.dap_server.request_breakpointLocations(
-self.main_path, loop_line
-)
-self.assertTrue(response["success"])
-self.assertEqual(
-response["body"]["breakpoints"],
-[
-{"line": loop_line, "column": 9},
-{"line": loop_line, "column": 13},
-{"line": loop_line, "column": 20},
-{"line": loop_line, "column": 23},
-{"line": loop_line, "column": 25},
-{"line": loop_line, "column": 34},
-{"line": loop_line, "column": 37},
-{"line": loop_line, "column": 39},
-{"line": loop_line, "column": 51},
-],
-)
+process_event = session.launch(LaunchArgs(program, stopOnEntry=True))
+session.verify_stopped_on_entry(after=process_event)
-# Ask for the breakpoint locations for a column range
-response = self.dap_server.request_breakpointLocations(
-self.main_path,
-loop_line,
-column=24,
-end_column=46,
-)
-self.assertTrue(response["success"])
-self.assertEqual(
-response["body"]["breakpoints"],
-[
-{"line": loop_line, "column": 25},
-{"line": loop_line, "column": 34},
-{"line": loop_line, "column": 37},
-{"line": loop_line, "column": 39},
-],
+# Ask for the breakpoint locations based only on the line number.
+loop_line = line_number(main_path, "// break loop")
+response = session.get_breakpoint_locations(main_path, loop_line)
+breakpoint_locations = response.body.breakpoints
+
+expected_locations = [
+BreakpointLocation(line=loop_line, column=9),
+BreakpointLocation(line=loop_line, column=13),
+BreakpointLocation(line=loop_line, column=20),
+BreakpointLocation(line=loop_line, column=23),
+BreakpointLocation(line=loop_line, column=25),
+BreakpointLocation(line=loop_line, column=34),
+BreakpointLocation(line=loop_line, column=37),
+Breakpoi
[Lldb-commits] [lldb] [lldb-dap] Migrate lldb-dap tests in `lldb-dap/breakpoint` (PR #208166)
https://github.com/da-viper created
https://github.com/llvm/llvm-project/pull/208166
migrate breakpointLocations, logpoints, setBreakpoints exceptionBreakpoints and
functionBreakpoints test
>From e7d4d3948291bd0310dd0423af8063e7ea45c0a6 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike
Date: Tue, 7 Jul 2026 17:30:40 +0100
Subject: [PATCH] [lldb-dap] Migrate lldb-dap tests in `lldb-dap/breakpoint`
migrate breakpointLocations, logpoints, setBreakpoints
exceptionBreakpoints and functionBreakpoints test
---
.../breakpoint/TestDAP_breakpointLocations.py | 121 ++---
.../lldb-dap/breakpoint/TestDAP_logpoints.py | 310 +---
.../breakpoint/TestDAP_setBreakpoints.py | 477 +-
.../TestDAP_setExceptionBreakpoints.py| 35 +-
.../TestDAP_setFunctionBreakpoints.py | 189 ---
5 files changed, 531 insertions(+), 601 deletions(-)
diff --git
a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
index 1fe5f8b9e2adc..f97b4b403b063 100644
--- a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
@@ -2,88 +2,77 @@
Test lldb-dap breakpointLocations request
"""
-
-import dap_server
-import shutil
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-import lldbdap_testcase
import os
+from lldbsuite.test.decorators import (
+skipIfTargetDoesNotSupportSharedLibraries,
+skipIfWindows,
+)
+from lldbsuite.test.lldbtest import line_number
+from lldbsuite.test.tools.lldb_dap.dap_types import BreakpointLocation,
LaunchArgs
+from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase
-@skipIfTargetDoesNotSupportSharedLibraries()
-class TestDAP_breakpointLocations(lldbdap_testcase.DAPTestCaseBase):
-def setUp(self):
-lldbdap_testcase.DAPTestCaseBase.setUp(self)
-
-self.main_basename = "main-copy.cpp"
-self.main_path =
os.path.realpath(self.getBuildArtifact(self.main_basename))
+@skipIfTargetDoesNotSupportSharedLibraries()
+class TestDAP_breakpointLocations(DAPTestCaseBase):
@skipIfWindows
def test_column_breakpoints(self):
"""Test retrieving the available breakpoint locations."""
program = self.getBuildArtifact("a.out")
-self.build_and_launch(program, stopOnEntry=True)
-loop_line = line_number(self.main_path, "// break loop")
-self.dap_server.request_continue()
+session = self.build_and_create_session()
+main_path = os.path.realpath(self.getBuildArtifact("main-copy.cpp"))
-# Ask for the breakpoint locations based only on the line number
-response = self.dap_server.request_breakpointLocations(
-self.main_path, loop_line
-)
-self.assertTrue(response["success"])
-self.assertEqual(
-response["body"]["breakpoints"],
-[
-{"line": loop_line, "column": 9},
-{"line": loop_line, "column": 13},
-{"line": loop_line, "column": 20},
-{"line": loop_line, "column": 23},
-{"line": loop_line, "column": 25},
-{"line": loop_line, "column": 34},
-{"line": loop_line, "column": 37},
-{"line": loop_line, "column": 39},
-{"line": loop_line, "column": 51},
-],
-)
+process_event = session.launch(LaunchArgs(program, stopOnEntry=True))
+session.verify_stopped_on_entry(after=process_event)
-# Ask for the breakpoint locations for a column range
-response = self.dap_server.request_breakpointLocations(
-self.main_path,
-loop_line,
-column=24,
-end_column=46,
-)
-self.assertTrue(response["success"])
-self.assertEqual(
-response["body"]["breakpoints"],
-[
-{"line": loop_line, "column": 25},
-{"line": loop_line, "column": 34},
-{"line": loop_line, "column": 37},
-{"line": loop_line, "column": 39},
-],
+# Ask for the breakpoint locations based only on the line number.
+loop_line = line_number(main_path, "// break loop")
+response = session.get_breakpoint_locations(main_path, loop_line)
+breakpoint_locations = response.body.breakpoints
+
+expected_locations = [
+BreakpointLocation(line=loop_line, column=9),
+BreakpointLocation(line=loop_line, column=13),
+BreakpointLocation(line=loop_line, column=20),
+BreakpointLocation(line=loop_line, column=23),
+BreakpointLocation(line=loop_line, column=25),
+BreakpointLocation(line=loop_line, column=34),
+BreakpointLocation(line=loop_line, column
