Fix read only watchpoints on x86_64
authorTamas Berghammer <tberghammer@google.com>
Wed, 12 Aug 2015 12:22:42 +0000 (12:22 +0000)
committerTamas Berghammer <tberghammer@google.com>
Wed, 12 Aug 2015 12:22:42 +0000 (12:22 +0000)
On x86/x86_64 read only watchpoints aren't supported. Fall back
to read/write watchpoints in that case.

Note: Logic should be added to ignore the watchpoint hit when
occurred because of a write.

llvm-svn: 244742

lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp

index 2ce8220..5abafec 100644 (file)
@@ -1018,8 +1018,10 @@ NativeRegisterContextLinux_x86_64::SetHardwareWatchpointWithIndex(
     if (wp_index >= NumSupportedHardwareWatchpoints())
         return Error ("Watchpoint index out of range");
 
+    // Read only watchpoints aren't supported on x86_64. Fall back to read/write waitchpoints instead.
+    // TODO: Add logic to detect when a write happens and ignore that watchpoint hit.
     if (watch_flags == 0x2)
-        return Error ("Read watchpoints currently unsupported on x86_64 architecture");
+        watch_flags = 0x3;
 
     if (watch_flags != 0x1 && watch_flags != 0x3)
         return Error ("Invalid read/write bits for watchpoint");