This is an archive of the discontinued LLVM Phabricator instance.

[dexter] Remove unnecessary double check on conditional breakpoints
ClosedPublic

Authored by Orlando on Apr 28 2021, 1:29 AM.

Details

Summary

Remove the ConditionalController._conditional_met method. This was missed in the recent ConditionalController refactor (D98699). We don't need to check that the conditions for a conditional breakpoint have been met because DebuggerBase.get_triggered_breakpoint_ids returns the set of ids for breakpoints which have been triggered.

To get the "triggered breakpoints" from lldb we use GetStopReasonDataCount and GetStopReasonDataAtIndex. It seems that these functions count all breakpoints associated with the location which lldb has stopped at, regardless of their condition. i.e. Even if we have two breakpoints at the same source location that have mutually exclusive conditions, both will be found this way when either condition is true. To get around this, we store a map of breakpoint {id: condition} _breakpoint_conditions and evaluate the conditions of the triggered breakpoints to filter the set down to those which are unconditional or have a condition which evaluates to true.

Essentially we are just moving the condition double check from a general debugger controller into the lldb specific wrapper. This tidy up will help make upcoming patches simpler.

All the lit tests pass on linux (with lldb), and I've tested this on windows (with vs2017) manually as the lit tests for DexLimitSteps are currently unsupported on windows.

Diff Detail

Event Timeline

Orlando requested review of this revision.Apr 28 2021, 1:29 AM
Orlando created this revision.
Orlando edited the summary of this revision. (Show Details)Apr 28 2021, 1:36 AM

One small query, otherwise lgtm.

debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py
160

Are 'id' and 'bp.GetID()' the same thing?

Orlando added inline comments.May 5 2021, 3:25 AM
debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py
160

Yes that's right.

chrisjackson added inline comments.May 5 2021, 6:20 AM
debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py
160

In that case, would it make more sense to stick to 'id' rather than call GetID()? Apologies, I should have made it clear this is what I desired in the first comment.

Orlando updated this revision to Diff 343311.May 6 2021, 12:26 AM

+ Replace two GetID() calls with id in delete_breakpoint.

Orlando marked 2 inline comments as done.May 6 2021, 12:26 AM
chrisjackson accepted this revision.May 6 2021, 7:59 AM
This revision is now accepted and ready to land.May 6 2021, 7:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 17 2021, 1:03 AM