This is an archive of the discontinued LLVM Phabricator instance.

[Dexter] Allow Dexter watch commands to specify a range of acceptable FP values
ClosedPublic

Authored by StephenTozer on Apr 27 2022, 2:39 AM.

Details

Summary

This patch adds an optional argument to DexExpectWatchBase, float_range, which defines a +- acceptance range for expected floating point values. If passed, this assumes every expected value to be a floating point value, and an exception will be thrown if this is not the case.

Diff Detail

Event Timeline

StephenTozer created this revision.Apr 27 2022, 2:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2022, 2:39 AM
StephenTozer requested review of this revision.Apr 27 2022, 2:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2022, 2:39 AM
Orlando added inline comments.May 9 2022, 4:26 AM
cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexExpectWatchBase.py
40

It's been a little while since I've looked in this code, am I reading this right - expected_value is the value returned by the debugger?

cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/float_range_watch/float_range_zero.cpp
2–3 ↗(On Diff #425449)

I'm not sure about this feature. What's the benefit of overriding 0.0 rather than just letting it mean zero?

Remove unused "zero range" test.

StephenTozer added inline comments.May 23 2022, 3:04 AM
cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexExpectWatchBase.py
40

Correct, I think the etymology is that it refers to the field of the watch value that we're expecting, i.e. the "value that we have an expectation for". (I do think it's confusing.)

Just to confirm, does this comment:

Remove unused "zero range" test.

mean that the feature I was worried about here:

I'm not sure about this feature. What's the benefit of overriding 0.0 rather than just letting it mean zero?

doesn't exist, and the test was not correct for this iteration of the patch?

Please can you add a test for when the float range is set to 0.0 (easy / common edge case). LGTM with that plus inline comments addressed.

cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexExpectWatchBase.py
40

Thanks for clarifying. It would be great if we're able to improve that name at some point in the future.

51

Should this be <=? Otherwise an exact match with float_range of zero fails, right?

cross-project-tests/debuginfo-tests/dexter/dex/utils/Exceptions.py
11

nit: IF -> if and it's -> its

Orlando added inline comments.May 23 2022, 4:50 AM
cross-project-tests/debuginfo-tests/dexter/dex/utils/Exceptions.py
11

If* and while you're there, removing "instruction" from that sentence works better IMO.

Make some changes to correctly handle the float_range=0.0 case, add tests to cover it, and change comment as requested.

Orlando accepted this revision.Jun 7 2022, 2:17 AM

LGTM!

This revision is now accepted and ready to land.Jun 7 2022, 2:17 AM
jmorse accepted this revision.Jun 8 2022, 6:23 AM

LGTM, with a request for a doc comment

cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexExpectWatchBase.py
40

IMHO: this wants a docustring explaining what it's doing, which as I understand it, is replacing expected_value with a nearby float value, if it's within the float_range, to ensure that it passes an equality comparision. (Writing this down will ease the future readers task).

Update name and add docstring to requested function.

StephenTozer added inline comments.Jun 8 2022, 8:42 AM
cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexExpectWatchBase.py
146

New name + docstring here, since the new revision has messed up line numbers apparently.