This is an archive of the discontinued LLVM Phabricator instance.

[LLDB][NFC] Fix LLDB_WATCH_TYPE_IS_VALID macro
ClosedPublic

Authored by fixathon on Aug 2 2022, 1:42 AM.

Details

Summary

LLDB_WATCH_TYPE_IS_VALID would always return true when validating watchpoint type
by using bitwise-or instead of bitwise-and to apply validation flags.

Diff Detail

Event Timeline

fixathon created this revision.Aug 2 2022, 1:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2022, 1:42 AM
fixathon requested review of this revision.Aug 2 2022, 1:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2022, 1:42 AM
DavidSpickett added a subscriber: DavidSpickett.

Sometimes you wonder how anything works :)

I looked at the places this is used and I don't see a way to reach them from the API without the type already being LLDB_WATCH_TYPE_READ or LLDB_WATCH_TYPE_WRITE. It's checked in lldb/source/Target/Target.cpp:CreateWatchpoint but there's no way to fail that check using existing calls, only direct from C++. So adding a test for this isn't possible.

LGTM.

DavidSpickett accepted this revision.Aug 2 2022, 2:46 AM
This revision is now accepted and ready to land.Aug 2 2022, 2:46 AM
This revision was automatically updated to reflect the committed changes.