Skip to content

Commit 0ce6d56

Browse files
authored
Fix a typo in "breakpoint add file" and add a test (#171206)
lldbutil.run_to_line_breakpoint had usages that set column breakpoints, so I thought there was coverage of that on the command-line, but actually all the `run_to` utilities use the SB API's, and there weren't any tests of setting file line & column breakpoint through `run_break_set`. So I missed that I had typed the column option `c` - that's taken by `--command`. This patch fixes that typo and adds a CLI test for file + line + column.
1 parent 2ab198f commit 0ce6d56

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

lldb/source/Commands/CommandObjectBreakpoint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ class CommandObjectBreakpointAddFile : public CommandObjectParsed {
767767
m_cur_value.SetLine(line_num);
768768
}
769769
break;
770-
case 'c':
770+
case 'u':
771771
uint32_t column_num;
772772
if (option_arg.getAsInteger(0, column_num))
773773
error = Status::FromError(

lldb/test/API/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,25 @@ def testBreakpointByLineAndColumn(self):
2727
in_then |= b_loc.GetColumn() == 50
2828
self.assertTrue(in_then)
2929

30+
def testBreakpointByLineAndColumnUsingCLI(self):
31+
self.build()
32+
src_file = lldb.SBFileSpec("main.cpp")
33+
line = (
34+
line_number("main.cpp", "At the beginning of a function name (col:50)") + 1
35+
) # Next line after comment
36+
target, process, _, _ = lldbutil.run_to_source_breakpoint(self, "This is a random comment", src_file)
37+
bkpt_no = lldbutil.run_break_set_by_file_and_line(self, "main.cpp", line, "--column 50")
38+
breakpoint = target.FindBreakpointByID(bkpt_no)
39+
threads = lldbutil.continue_to_breakpoint(process, breakpoint)
40+
self.assertEqual(len(threads), 1, "Stopped at our breakpoint")
41+
self.expect("fr v did_call", substrs=["1"])
42+
in_then = False
43+
for i in range(breakpoint.GetNumLocations()):
44+
b_loc = breakpoint.GetLocationAtIndex(i).GetAddress().GetLineEntry()
45+
self.assertEqual(b_loc.GetLine(), line)
46+
in_then |= b_loc.GetColumn() == 50
47+
self.assertTrue(in_then)
48+
3049
## Skip gcc version less 7.1 since it doesn't support -gcolumn-info
3150
@skipIf(compiler="gcc", compiler_version=["<", "7.1"])
3251
def testBreakpointByLine(self):

0 commit comments

Comments
 (0)