A breakpoint doesn’t necessarily have a file & line number.  Remember that 
breakpoints in lldb really are “search kernels” - called “Resolvers" and one 
breakpoint’s resolver can match any number of locations in code.  As an extreme 
instance “break set -r .*” will match many many functions…  So the breakpoint 
itself doesn’t have a meaningful file and line number.

Only breakpoint locations have a single address, and thus a well-determined 
file & line number.  

Moreover, even for a breakpoint that uses a file & line number based resolver, 
the resolved location’s file & line may not match the ones specified in the 
breakpoint.  Unless you set —exact when setting the breakpoint, we move 
breakpoints from lines that contain no code to the nearest one that does 
contain code.  

So a breakpoint’s notion of file and line if it even exists is not helpful in 
the task “find all the breakpoints that will stop when code from this given 
file & line are executed.  Only the breakpoint locations know that.

Jim



> On Apr 8, 2020, at 10:15 AM, Tom Weaver via lldb-dev 
> <lldb-dev@lists.llvm.org> wrote:
> 
> I've been trying to get at the file path, line and column information of a 
> break point via the python API but have been struggling.
> 
> given the following method :
> 
> def do_thing_with_bp_in_file_on_line(file_path, line_no):
>   ... do something with breakpoints on line_no in file at file_path
> 
> what would be the best way to find the break points that match the file_path 
> and line number so I can act on them?
> 
> I've tried iterating through them and checking the file path and line number 
> of one of a break points SBBreakpointLocation and drilling down the file spec 
> and line entry information to compare with the parameters, but this seems 
> long winded and has a bunch of assumptions baked into it.
> 
> Is there a more canonical way of doing this?
> 
> thanks in advance,
> Tom W
> _______________________________________________
> lldb-dev mailing list
> lldb-dev@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

_______________________________________________
lldb-dev mailing list
lldb-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

Reply via email to