diff options
author | Dave Lee <davelee.com@gmail.com> | 2020-09-16 16:40:48 -0700 |
---|---|---|
committer | Dave Lee <davelee.com@gmail.com> | 2020-09-21 10:15:34 -0700 |
commit | 3b3b9ba1c7d89afe4909a42e2a795354bb79e062 (patch) | |
tree | c23250d93d3d7f3c47cc90216e48e9dcc2e97981 /lldb/source/Commands/CommandObjectBreakpointCommand.cpp | |
parent | 6950db36d33d85d18e3241ab6c87494c05ebe0fb (diff) | |
download | llvm-3b3b9ba1c7d89afe4909a42e2a795354bb79e062.zip llvm-3b3b9ba1c7d89afe4909a42e2a795354bb79e062.tar.gz llvm-3b3b9ba1c7d89afe4909a42e2a795354bb79e062.tar.bz2 |
[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
Diffstat (limited to 'lldb/source/Commands/CommandObjectBreakpointCommand.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectBreakpointCommand.cpp | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp index 45df865..792e90f 100644 --- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp @@ -141,12 +141,16 @@ Example Python one-line breakpoint command: (lldb) breakpoint command add -s python 1 Enter your Python command(s). Type 'DONE' to end. -> print "Hit this breakpoint!" -> DONE +def function (frame, bp_loc, internal_dict): + """frame: the lldb.SBFrame for the location at which you stopped + bp_loc: an lldb.SBBreakpointLocation for the breakpoint location information + internal_dict: an LLDB support object not to be used""" + print("Hit this breakpoint!") + DONE As a convenience, this also works for a short Python one-liner: -(lldb) breakpoint command add -s python 1 -o 'import time; print time.asctime()' +(lldb) breakpoint command add -s python 1 -o 'import time; print(time.asctime())' (lldb) run Launching '.../a.out' (x86_64) (lldb) Fri Sep 10 12:17:45 2010 @@ -164,21 +168,14 @@ Example multiple line Python breakpoint command: (lldb) breakpoint command add -s p 1 Enter your Python command(s). Type 'DONE' to end. -> global bp_count -> bp_count = bp_count + 1 -> print "Hit this breakpoint " + repr(bp_count) + " times!" -> DONE - -Example multiple line Python breakpoint command, using function definition: - -(lldb) breakpoint command add -s python 1 -Enter your Python command(s). Type 'DONE' to end. -> def breakpoint_output (bp_no): -> out_string = "Hit breakpoint number " + repr (bp_no) -> print out_string -> return True -> breakpoint_output (1) -> DONE +def function (frame, bp_loc, internal_dict): + """frame: the lldb.SBFrame for the location at which you stopped + bp_loc: an lldb.SBBreakpointLocation for the breakpoint location information + internal_dict: an LLDB support object not to be used""" + global bp_count + bp_count = bp_count + 1 + print("Hit this breakpoint " + repr(bp_count) + " times!") + DONE )" "In this case, since there is a reference to a global variable, \ |