Skip to content

Commit ceeb08b

Browse files
committed
Revert "[lldb-dap] Support column breakpoints (llvm#113787)"
This reverts commit 4f48a81. The newly added test was failing on the public macOS Arm64 bots: ``` ====================================================================== FAIL: test_column_breakpoints (TestDAP_breakpointLocations.TestDAP_setBreakpoints) Test retrieving the available breakpoint locations. ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py", line 77, in test_column_breakpoints self.assertEqual( AssertionError: Lists differ: [{'co[70 chars]e': 41}, {'column': 3, 'line': 42}, {'column': 18, 'line': 42}] != [{'co[70 chars]e': 42}, {'column': 18, 'line': 42}] First differing element 2: {'column': 3, 'line': 41} {'column': 3, 'line': 42} First list contains 1 additional elements. First extra element 4: {'column': 18, 'line': 42} [{'column': 39, 'line': 40}, {'column': 51, 'line': 40}, - {'column': 3, 'line': 41}, {'column': 3, 'line': 42}, {'column': 18, 'line': 42}] Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang ---------------------------------------------------------------------- Ran 1 test in 1.554s FAILED (failures=1) ```
1 parent dcd6207 commit ceeb08b

File tree

7 files changed

+82
-418
lines changed

7 files changed

+82
-418
lines changed

lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -612,28 +612,6 @@ def request_attach(
612612
command_dict = {"command": "attach", "type": "request", "arguments": args_dict}
613613
return self.send_recv(command_dict)
614614

615-
def request_breakpointLocations(
616-
self, file_path, line, end_line=None, column=None, end_column=None
617-
):
618-
(dir, base) = os.path.split(file_path)
619-
source_dict = {"name": base, "path": file_path}
620-
args_dict = {}
621-
args_dict["source"] = source_dict
622-
if line is not None:
623-
args_dict["line"] = line
624-
if end_line is not None:
625-
args_dict["endLine"] = end_line
626-
if column is not None:
627-
args_dict["column"] = column
628-
if end_column is not None:
629-
args_dict["endColumn"] = end_column
630-
command_dict = {
631-
"command": "breakpointLocations",
632-
"type": "request",
633-
"arguments": args_dict,
634-
}
635-
return self.send_recv(command_dict)
636-
637615
def request_configurationDone(self):
638616
command_dict = {
639617
"command": "configurationDone",
@@ -873,8 +851,6 @@ def request_next(self, threadId, granularity="statement"):
873851
def request_stepIn(self, threadId, targetId, granularity="statement"):
874852
if self.exit_status is not None:
875853
raise ValueError("request_stepIn called after process exited")
876-
if threadId is None:
877-
threadId = self.get_thread_id()
878854
args_dict = {
879855
"threadId": threadId,
880856
"targetId": targetId,
@@ -935,14 +911,18 @@ def request_setBreakpoints(self, file_path, line_array, data=None):
935911
breakpoint_data = data[i]
936912
bp = {"line": line}
937913
if breakpoint_data is not None:
938-
if breakpoint_data.get("condition"):
914+
if "condition" in breakpoint_data and breakpoint_data["condition"]:
939915
bp["condition"] = breakpoint_data["condition"]
940-
if breakpoint_data.get("hitCondition"):
916+
if (
917+
"hitCondition" in breakpoint_data
918+
and breakpoint_data["hitCondition"]
919+
):
941920
bp["hitCondition"] = breakpoint_data["hitCondition"]
942-
if breakpoint_data.get("logMessage"):
921+
if (
922+
"logMessage" in breakpoint_data
923+
and breakpoint_data["logMessage"]
924+
):
943925
bp["logMessage"] = breakpoint_data["logMessage"]
944-
if breakpoint_data.get("column"):
945-
bp["column"] = breakpoint_data["column"]
946926
breakpoints.append(bp)
947927
args_dict["breakpoints"] = breakpoints
948928

lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,9 @@ def set_global(self, name, value, id=None):
238238
def stepIn(
239239
self, threadId=None, targetId=None, waitForStop=True, granularity="statement"
240240
):
241-
response = self.dap_server.request_stepIn(
241+
self.dap_server.request_stepIn(
242242
threadId=threadId, targetId=targetId, granularity=granularity
243243
)
244-
self.assertTrue(response["success"])
245244
if waitForStop:
246245
return self.dap_server.wait_for_stopped()
247246
return None

lldb/test/API/tools/lldb-dap/breakpoint/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ main-copy.cpp: main.cpp
1616
# The following shared library will be used to test breakpoints under dynamic loading
1717
libother: other-copy.c
1818
"$(MAKE)" -f $(MAKEFILE_RULES) \
19-
DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other
19+
DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other

lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py

Lines changed: 0 additions & 85 deletions
This file was deleted.

lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py

Lines changed: 68 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,20 @@ def test_set_and_clear(self):
125125
# Set 3 breakpoints and verify that they got set correctly
126126
response = self.dap_server.request_setBreakpoints(self.main_path, lines)
127127
line_to_id = {}
128-
breakpoints = response["body"]["breakpoints"]
129-
self.assertEqual(
130-
len(breakpoints),
131-
len(lines),
132-
"expect %u source breakpoints" % (len(lines)),
133-
)
134-
for index, breakpoint in enumerate(breakpoints):
135-
line = breakpoint["line"]
136-
self.assertEqual(line, lines[index])
137-
# Store the "id" of the breakpoint that was set for later
138-
line_to_id[line] = breakpoint["id"]
139-
self.assertTrue(breakpoint["verified"], "expect breakpoint verified")
128+
if response:
129+
breakpoints = response["body"]["breakpoints"]
130+
self.assertEqual(
131+
len(breakpoints),
132+
len(lines),
133+
"expect %u source breakpoints" % (len(lines)),
134+
)
135+
for breakpoint, index in zip(breakpoints, range(len(lines))):
136+
line = breakpoint["line"]
137+
self.assertTrue(line, lines[index])
138+
# Store the "id" of the breakpoint that was set for later
139+
line_to_id[line] = breakpoint["id"]
140+
self.assertIn(line, lines, "line expected in lines array")
141+
self.assertTrue(breakpoint["verified"], "expect breakpoint verified")
140142

141143
# There is no breakpoint delete packet, clients just send another
142144
# setBreakpoints packet with the same source file with fewer lines.
@@ -149,66 +151,75 @@ def test_set_and_clear(self):
149151
# Set 2 breakpoints and verify that the previous breakpoints that were
150152
# set above are still set.
151153
response = self.dap_server.request_setBreakpoints(self.main_path, lines)
152-
breakpoints = response["body"]["breakpoints"]
153-
self.assertEqual(
154-
len(breakpoints),
155-
len(lines),
156-
"expect %u source breakpoints" % (len(lines)),
157-
)
158-
for index, breakpoint in enumerate(breakpoints):
159-
line = breakpoint["line"]
160-
self.assertEqual(line, lines[index])
161-
# Verify the same breakpoints are still set within LLDB by
162-
# making sure the breakpoint ID didn't change
154+
if response:
155+
breakpoints = response["body"]["breakpoints"]
163156
self.assertEqual(
164-
line_to_id[line],
165-
breakpoint["id"],
166-
"verify previous breakpoints stayed the same",
157+
len(breakpoints),
158+
len(lines),
159+
"expect %u source breakpoints" % (len(lines)),
167160
)
168-
self.assertTrue(breakpoint["verified"], "expect breakpoint still verified")
161+
for breakpoint, index in zip(breakpoints, range(len(lines))):
162+
line = breakpoint["line"]
163+
self.assertTrue(line, lines[index])
164+
# Verify the same breakpoints are still set within LLDB by
165+
# making sure the breakpoint ID didn't change
166+
self.assertEqual(
167+
line_to_id[line],
168+
breakpoint["id"],
169+
"verify previous breakpoints stayed the same",
170+
)
171+
self.assertIn(line, lines, "line expected in lines array")
172+
self.assertTrue(
173+
breakpoint["verified"], "expect breakpoint still verified"
174+
)
169175

170176
# Now get the full list of breakpoints set in the target and verify
171177
# we have only 2 breakpoints set. The response above could have told
172178
# us about 2 breakpoints, but we want to make sure we don't have the
173179
# third one still set in the target
174180
response = self.dap_server.request_testGetTargetBreakpoints()
175-
breakpoints = response["body"]["breakpoints"]
176-
self.assertEqual(
177-
len(breakpoints),
178-
len(lines),
179-
"expect %u source breakpoints" % (len(lines)),
180-
)
181-
for breakpoint in breakpoints:
182-
line = breakpoint["line"]
183-
# Verify the same breakpoints are still set within LLDB by
184-
# making sure the breakpoint ID didn't change
181+
if response:
182+
breakpoints = response["body"]["breakpoints"]
185183
self.assertEqual(
186-
line_to_id[line],
187-
breakpoint["id"],
188-
"verify previous breakpoints stayed the same",
184+
len(breakpoints),
185+
len(lines),
186+
"expect %u source breakpoints" % (len(lines)),
189187
)
190-
self.assertIn(line, lines, "line expected in lines array")
191-
self.assertTrue(breakpoint["verified"], "expect breakpoint still verified")
188+
for breakpoint in breakpoints:
189+
line = breakpoint["line"]
190+
# Verify the same breakpoints are still set within LLDB by
191+
# making sure the breakpoint ID didn't change
192+
self.assertEqual(
193+
line_to_id[line],
194+
breakpoint["id"],
195+
"verify previous breakpoints stayed the same",
196+
)
197+
self.assertIn(line, lines, "line expected in lines array")
198+
self.assertTrue(
199+
breakpoint["verified"], "expect breakpoint still verified"
200+
)
192201

193202
# Now clear all breakpoints for the source file by passing down an
194203
# empty lines array
195204
lines = []
196205
response = self.dap_server.request_setBreakpoints(self.main_path, lines)
197-
breakpoints = response["body"]["breakpoints"]
198-
self.assertEqual(
199-
len(breakpoints),
200-
len(lines),
201-
"expect %u source breakpoints" % (len(lines)),
202-
)
206+
if response:
207+
breakpoints = response["body"]["breakpoints"]
208+
self.assertEqual(
209+
len(breakpoints),
210+
len(lines),
211+
"expect %u source breakpoints" % (len(lines)),
212+
)
203213

204214
# Verify with the target that all breakpoints have been cleared
205215
response = self.dap_server.request_testGetTargetBreakpoints()
206-
breakpoints = response["body"]["breakpoints"]
207-
self.assertEqual(
208-
len(breakpoints),
209-
len(lines),
210-
"expect %u source breakpoints" % (len(lines)),
211-
)
216+
if response:
217+
breakpoints = response["body"]["breakpoints"]
218+
self.assertEqual(
219+
len(breakpoints),
220+
len(lines),
221+
"expect %u source breakpoints" % (len(lines)),
222+
)
212223

213224
# Now set a breakpoint again in the same source file and verify it
214225
# was added.
@@ -270,11 +281,12 @@ def test_clear_breakpoints_unset_breakpoints(self):
270281
self.assertEqual(
271282
len(breakpoints), len(lines), "expect %u source breakpoints" % (len(lines))
272283
)
273-
for index, breakpoint in enumerate(breakpoints):
284+
for breakpoint, index in zip(breakpoints, range(len(lines))):
274285
line = breakpoint["line"]
275-
self.assertEqual(line, lines[index])
286+
self.assertTrue(line, lines[index])
276287
# Store the "id" of the breakpoint that was set for later
277288
line_to_id[line] = breakpoint["id"]
289+
self.assertIn(line, lines, "line expected in lines array")
278290
self.assertTrue(breakpoint["verified"], "expect breakpoint verified")
279291

280292
# Now clear all breakpoints for the source file by not setting the
@@ -344,49 +356,3 @@ def test_functionality(self):
344356
self.continue_to_breakpoints(breakpoint_ids)
345357
i = int(self.dap_server.get_local_variable_value("i"))
346358
self.assertEqual(i, 7, "i != 7 showing post hitCondition hits every time")
347-
348-
@skipIfWindows
349-
def test_column_breakpoints(self):
350-
"""Test setting multiple breakpoints in the same line at different columns."""
351-
loop_line = line_number("main.cpp", "// break loop")
352-
353-
program = self.getBuildArtifact("a.out")
354-
self.build_and_launch(program)
355-
356-
# Set two breakpoints on the loop line at different columns.
357-
columns = [13, 39]
358-
response = self.dap_server.request_setBreakpoints(
359-
self.main_path, [loop_line, loop_line], list({"column": c} for c in columns)
360-
)
361-
362-
# Verify the breakpoints were set correctly
363-
breakpoints = response["body"]["breakpoints"]
364-
breakpoint_ids = []
365-
self.assertEqual(
366-
len(breakpoints),
367-
len(columns),
368-
"expect %u source breakpoints" % (len(columns)),
369-
)
370-
for index, breakpoint in enumerate(breakpoints):
371-
self.assertEqual(breakpoint["line"], loop_line)
372-
self.assertEqual(breakpoint["column"], columns[index])
373-
self.assertTrue(breakpoint["verified"], "expect breakpoint verified")
374-
breakpoint_ids.append(breakpoint["id"])
375-
376-
# Continue to the first breakpoint,
377-
self.continue_to_breakpoints([breakpoint_ids[0]])
378-
379-
# We should have stopped right before the call to `twelve`.
380-
# Step into and check we are inside `twelve`.
381-
self.stepIn()
382-
func_name = self.get_stackFrames()[0]["name"]
383-
self.assertEqual(func_name, "twelve(int)")
384-
385-
# Continue to the second breakpoint.
386-
self.continue_to_breakpoints([breakpoint_ids[1]])
387-
388-
# We should have stopped right before the call to `fourteen`.
389-
# Step into and check we are inside `fourteen`.
390-
self.stepIn()
391-
func_name = self.get_stackFrames()[0]["name"]
392-
self.assertEqual(func_name, "a::fourteen(int)")

lldb/tools/lldb-dap/DAP.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848

4949
namespace lldb_dap {
5050

51-
typedef llvm::DenseMap<std::pair<uint32_t, uint32_t>, SourceBreakpoint>
52-
SourceBreakpointMap;
51+
typedef llvm::DenseMap<uint32_t, SourceBreakpoint> SourceBreakpointMap;
5352
typedef llvm::StringMap<FunctionBreakpoint> FunctionBreakpointMap;
5453
typedef llvm::DenseMap<lldb::addr_t, InstructionBreakpoint>
5554
InstructionBreakpointMap;

0 commit comments

Comments
 (0)