Author: Jason Molenda Date: 2023-09-21T14:50:34-07:00 New Revision: 35e3939cb06d19942a30fd39f1416f49a7b982a4
URL: https://github.com/llvm/llvm-project/commit/35e3939cb06d19942a30fd39f1416f49a7b982a4 DIFF: https://github.com/llvm/llvm-project/commit/35e3939cb06d19942a30fd39f1416f49a7b982a4.diff LOG: watch set expression's default type was wrong with new modify type `watch set expression` was passing the OptionGroupWatchpoint enum in to Target where the LLDB_WATCH_TYPE_* bitfield was expected. Modify matched READ|WRITE and resulted in a test failure in TestWatchTaggedAddress.py. David temporarily changed the test to expect this incorrect output; this fixes the bug and updates the test case to test it for correctness again. Added: Modified: lldb/source/Commands/CommandObjectWatchpoint.cpp lldb/test/API/commands/watchpoints/watch_tagged_addr/TestWatchTaggedAddress.py Removed: ################################################################################ diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp index 83c2fb824bb9d3d..dc5be0da43f5e62 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -1133,7 +1133,23 @@ class CommandObjectWatchpointSetExpression : public CommandObjectRaw { size = target->GetArchitecture().GetAddressByteSize(); // Now it's time to create the watchpoint. - uint32_t watch_type = m_option_watchpoint.watch_type; + uint32_t watch_type; + switch (m_option_watchpoint.watch_type) { + case OptionGroupWatchpoint::eWatchRead: + watch_type = LLDB_WATCH_TYPE_READ; + break; + case OptionGroupWatchpoint::eWatchWrite: + watch_type = LLDB_WATCH_TYPE_WRITE; + break; + case OptionGroupWatchpoint::eWatchModify: + watch_type = LLDB_WATCH_TYPE_MODIFY; + break; + case OptionGroupWatchpoint::eWatchReadWrite: + watch_type = LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE; + break; + default: + watch_type = LLDB_WATCH_TYPE_MODIFY; + } // Fetch the type from the value object, the type of the watched object is // the pointee type diff --git a/lldb/test/API/commands/watchpoints/watch_tagged_addr/TestWatchTaggedAddress.py b/lldb/test/API/commands/watchpoints/watch_tagged_addr/TestWatchTaggedAddress.py index 336938082d83536..9d9c04912d7df9e 100644 --- a/lldb/test/API/commands/watchpoints/watch_tagged_addr/TestWatchTaggedAddress.py +++ b/lldb/test/API/commands/watchpoints/watch_tagged_addr/TestWatchTaggedAddress.py @@ -96,7 +96,7 @@ def test_watch_set_on_tagged_ptr(self): self.expect( "watchpoint set expression -s 4 -- tagged_ptr", WATCHPOINT_CREATED, - substrs=["Watchpoint created", "size = 4", "type = rw"], + substrs=["Watchpoint created", "size = 4", "type = m"], ) self.verify_watch_hits() _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits