Skip to content

Commit 3b3b9ba

Browse files
committed
[lldb/Commands] Fix outdated breakpoint command add help string
Update the some examples in the help string for `breakpoint command add`. Python breakpoint commands have different output than what's shown in the help string. Notes: * Removed an example containing an inner function, as it seems more about a Python technique than about `command script add` * Updated `print x` to `print(x)` to be python 2/3 agnostic Differential Revision: https://reviews.llvm.org/D87807
1 parent 6950db3 commit 3b3b9ba

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

lldb/source/Commands/CommandObjectBreakpointCommand.cpp

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,16 @@ Example Python one-line breakpoint command:
141141
142142
(lldb) breakpoint command add -s python 1
143143
Enter your Python command(s). Type 'DONE' to end.
144-
> print "Hit this breakpoint!"
145-
> DONE
144+
def function (frame, bp_loc, internal_dict):
145+
"""frame: the lldb.SBFrame for the location at which you stopped
146+
bp_loc: an lldb.SBBreakpointLocation for the breakpoint location information
147+
internal_dict: an LLDB support object not to be used"""
148+
print("Hit this breakpoint!")
149+
DONE
146150
147151
As a convenience, this also works for a short Python one-liner:
148152
149-
(lldb) breakpoint command add -s python 1 -o 'import time; print time.asctime()'
153+
(lldb) breakpoint command add -s python 1 -o 'import time; print(time.asctime())'
150154
(lldb) run
151155
Launching '.../a.out' (x86_64)
152156
(lldb) Fri Sep 10 12:17:45 2010
@@ -164,21 +168,14 @@ Example multiple line Python breakpoint command:
164168
165169
(lldb) breakpoint command add -s p 1
166170
Enter your Python command(s). Type 'DONE' to end.
167-
> global bp_count
168-
> bp_count = bp_count + 1
169-
> print "Hit this breakpoint " + repr(bp_count) + " times!"
170-
> DONE
171-
172-
Example multiple line Python breakpoint command, using function definition:
173-
174-
(lldb) breakpoint command add -s python 1
175-
Enter your Python command(s). Type 'DONE' to end.
176-
> def breakpoint_output (bp_no):
177-
> out_string = "Hit breakpoint number " + repr (bp_no)
178-
> print out_string
179-
> return True
180-
> breakpoint_output (1)
181-
> DONE
171+
def function (frame, bp_loc, internal_dict):
172+
"""frame: the lldb.SBFrame for the location at which you stopped
173+
bp_loc: an lldb.SBBreakpointLocation for the breakpoint location information
174+
internal_dict: an LLDB support object not to be used"""
175+
global bp_count
176+
bp_count = bp_count + 1
177+
print("Hit this breakpoint " + repr(bp_count) + " times!")
178+
DONE
182179
183180
)"
184181
"In this case, since there is a reference to a global variable, \

0 commit comments

Comments
 (0)