[Lldb-commits] [PATCH] D11902: Fix LLGS to enable read type watchpoints

Muhammad Omair Javaid via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 10 05:34:12 PDT 2015


omjavaid created this revision.
omjavaid added reviewers: tberghammer, clayborg.
omjavaid added a subscriber: lldb-commits.

LLGS was forcing lldb to use only write or read+write type watchpoints.

This patch fixes this behavior to enable read, write and read+write types of watchpoints.

Note: On x86_64 read watchpoints still dont work and they are disabled by NativeRegisterContextLinux_x86. We ll need to revisit this later because all three types of watchpoints should also work on x86.

http://reviews.llvm.org/D11902

Files:
  source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp

Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -2227,6 +2227,7 @@
 
     bool want_breakpoint = true;
     bool want_hardware = false;
+    uint32_t watch_flags;
 
     const GDBStoppointType stoppoint_type =
         GDBStoppointType(packet.GetS32 (eStoppointInvalid));
@@ -2237,10 +2238,13 @@
         case eBreakpointHardware:
             want_hardware = true;  want_breakpoint = true;  break;
         case eWatchpointWrite:
+            watch_flags = 1;
             want_hardware = true;  want_breakpoint = false; break;
         case eWatchpointRead:
+            watch_flags = 2;
             want_hardware = true;  want_breakpoint = false; break;
         case eWatchpointReadWrite:
+            watch_flags = 3;
             want_hardware = true;  want_breakpoint = false; break;
         case eStoppointInvalid:
             return SendIllFormedResponse(packet, "Z packet had invalid software/hardware specifier");
@@ -2280,11 +2284,6 @@
     }
     else
     {
-        uint32_t watch_flags =
-            stoppoint_type == eWatchpointWrite
-            ? 0x1  // Write
-            : 0x3; // ReadWrite
-
         // Try to set the watchpoint.
         const Error error = m_debugged_process_sp->SetWatchpoint (
                 addr, size, watch_flags, want_hardware);
Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
===================================================================
--- source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
+++ source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
@@ -1018,6 +1018,9 @@
     if (wp_index >= NumSupportedHardwareWatchpoints())
         return Error ("Watchpoint index out of range");
 
+    if (watch_flags == 0x2)
+        return Error ("Read watchpoints currently unsupported on x86_64 architecture");
+
     if (watch_flags != 0x1 && watch_flags != 0x3)
         return Error ("Invalid read/write bits for watchpoint");
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11902.31658.patch
Type: text/x-patch
Size: 2195 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150810/1515f320/attachment.bin>


More information about the lldb-commits mailing list