Skip to content

Commit c98ec8b

Browse files
committed
[lldb-dap] add review changes
1 parent 4c0bd99 commit c98ec8b

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,27 @@ def test_disassemble(self):
1616
program = self.getBuildArtifact("a.out")
1717
self.build_and_launch(program)
1818
source = "main.c"
19-
self.set_source_breakpoints(source, [line_number(source, "// breakpoint 1")])
19+
bp_line_no = line_number(source, "// breakpoint 1")
20+
self.set_source_breakpoints(source, [bp_line_no])
2021
self.continue_to_next_stop()
2122

2223
insts_with_bp, pc_with_bp_assembly = self.disassemble(frameIndex=0)
24+
self.assertIn("location", pc_with_bp_assembly, "Source location missing.")
25+
self.assertEqual(
26+
pc_with_bp_assembly["line"], bp_line_no, "Expects the same line number"
27+
)
2328
no_bp = self.set_source_breakpoints(source, [])
24-
self.assertEqual(len(no_bp), 0, "expect no breakpoints.")
29+
self.assertEqual(len(no_bp), 0, "Expects no breakpoints.")
2530
self.assertIn(
2631
"instruction", pc_with_bp_assembly, "Assembly instruction missing."
2732
)
2833

29-
# the disassembly instructions should be the same even if there is a breakpoint;
3034
insts_no_bp, pc_no_bp_assembly = self.disassemble(frameIndex=0)
35+
self.assertIn("location", pc_no_bp_assembly, "Source location missing.")
36+
self.assertEqual(
37+
pc_with_bp_assembly["line"], bp_line_no, "Expects the same line number"
38+
)
39+
# the disassembly instructions should be the same with breakpoint and no breakpoint;
3140
self.assertDictEqual(
3241
insts_with_bp,
3342
insts_no_bp,

lldb/test/API/tools/lldb-dap/disassemble/main.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ int compare_ints(const void *a, const void *b) {
66
int arg1 = *(const int *)a;
77
int arg2 = *(const int *)b;
88

9-
// breakpoint 1
10-
11-
if (arg1 < arg2)
9+
if (arg1 < arg2) // breakpoint 1
1210
return -1;
1311
if (arg1 > arg2)
1412
return 1;

0 commit comments

Comments
 (0)