Page MenuHomePhabricator

[lldb] CommandObjectThreadUntil should set breakpoint at either on exact or the nearest subsequent line number but not on all the subsequent line numbers
AcceptedPublic

Authored by ramana-nvr on Aug 5 2018, 3:53 AM.

Details

Reviewers
jingham
Summary

The requirements for "thread until <line number>" are:

a) If any code contributed by <line number> or the nearest subsequent of <line number> is executed before leaving the function, stop
b) If you end up leaving the function w/o triggering (a), then stop

In case of (a), since the <line number> may have multiple entries in the line table and the compiler might have scheduled/moved the relevant code across, and the lldb does not know the control flow, set breakpoints on all the line table entries of best match of <line number> i.e. exact or the nearest subsequent line.

Along with the above, currently, CommandObjectThreadUntil is also setting the breakpoints on all the subsequent line numbers after the best match and this latter part is wrong.

This issue is discussed at http://lists.llvm.org/pipermail/lldb-dev/2018-August/013979.html.

Diff Detail

Event Timeline

ramana-nvr created this revision.Aug 5 2018, 3:53 AM

This implementation forces an extra lookup when the line number slides. For instance, if there were only one line match, but it was not exact, you're going to look up the exact address, fail, then look it up with exact = false.

Wouldn't it be more efficient to look with exact = false first, then reset the line you are looking for to whatever you got back, and continue with the exact=true search you do for the other line numbers.

ramana-nvr updated this revision to Diff 159517.Aug 7 2018, 8:41 AM

Yes, updated the patch accordingly.

jingham accepted this revision.Aug 7 2018, 10:04 AM

That looks good. Thanks for cleaning this up!

This revision is now accepted and ready to land.Aug 7 2018, 10:04 AM

I do not have the commit permission. Could someone help commit this patch?

davide added a subscriber: davide.Oct 3 2018, 10:33 PM

I'll commit this for you, but I might ask if you can try adding a test first?