[lldb-dev] lldb fails to hit breakpoint when line maps to multiple addresses

via lldb-dev lldb-dev at lists.llvm.org
Tue Sep 22 18:44:29 PDT 2015


We have a case where a source breakpoint isn't hit because the source line maps
to 2 addresses in the debug info and lldb only sets 1 BP on the first address
which is in a basic block that is rarely executed.  The codegen looks something
like this (in pseudo code):

        some_code
        br lbl2
    lbl1:
        some_more_code
        code_for_line_50_pt1  ; lldb sets BP here but code not executed
    lbl2:
        code_for_line_48
        code_for_line_50_pt2  ; this code is executed
        if (cond) br lbl1

BreakpointResolverFileLine::SearchCallback correctly finds both symbol contexts
for the line.  The symbol contexts have different addresses but the same
lldb_private::Block.  As a result, BreakpointResolver::SetSCMatchesByLine
thinks they are in the same "contiguous range" and removes the 2nd symbol
context.  lldb sets the breakpoint at the 1st address and the user never hits
their breakpoint.

The check for a "contiguous range" in BreakpointResolver::SetSCMatchesByLine
seems wrong.  Is it assuming a Block is actually a basic block (i.e. with no
branches)?  What's supposed to happen here?

Thanks,
-Dawn


More information about the lldb-dev mailing list