A. K.
A. K.

Reputation: 38264

lldb list only those breakpoints with hit count > 0

I have 100s of breakpoints set on a particular library. br list shows all of them and it is painful to scroll through all the breakpoints to find out which ones have hit counts. Is there a way to list only those breakpoints with hit count > 0?

Upvotes: 0

Views: 146

Answers (1)

Jim Ingham
Jim Ingham

Reputation: 27203

break list doesn't have any predicates you can use to filter the listing, but you can make your own filter pretty easily. For instance:

(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> for idx in range(0, lldb.target.num_breakpoints):
...     bkpt = lldb.target.GetBreakpointAtIndex(idx)
...     if bkpt.GetHitCount() > 0: 
...         print(bkpt)
... 

will show you what you want. You can bundle this up into a command if you use it frequently, as shown here:

https://lldb.llvm.org/use/python-reference.html#create-a-new-lldb-command-using-a-python-function

Note, if you do turn this into a command, remember to use the target from the SBExecutionContext you get passed, lldb.target is not available in Python based commands.

Upvotes: 1

Related Questions