[Lldb-commits] [lldb] r151305 - /lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp

Johnny Chen johnny.chen at apple.com
Thu Feb 23 15:40:58 PST 2012


Author: johnny
Date: Thu Feb 23 17:40:58 2012
New Revision: 151305

URL: http://llvm.org/viewvc/llvm-project?rev=151305&view=rev
Log:
Add comments about address word offset and the calculation of byte address select mask for WCR.

Modified:
    lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp

Modified: lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp?rev=151305&r1=151304&r2=151305&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp Thu Feb 23 17:40:58 2012
@@ -2329,6 +2329,22 @@
     // We can only watch up to four bytes that follow a 4 byte aligned address
     // per watchpoint register pair. Since we can only watch until the next 4
     // byte boundary, we need to make sure we can properly encode this.
+
+    // addr_word_offset = addr % 4, i.e, is in set([0, 1, 2, 3])
+    //
+    //     +---+---+---+---+
+    //     | 0 | 1 | 2 | 3 |
+    //     +---+---+---+---+
+    //     ^
+    //     |
+    // word address (4-byte aligned) = addr & 0xFFFFFFFC => goes into WVR
+    //
+    // examples:
+    // 1. addr_word_offset = 1, size = 1 to watch a uint_8 => byte_mask = (0b0001 << 1) = 0b0010
+    // 2. addr_word_offset = 2, size = 2 to watch a uint_16 => byte_mask = (0b0011 << 2) = 0b1100
+    //
+    // where byte_mask goes into WCR[8:5]
+
     uint32_t addr_word_offset = addr % 4;
     DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchMachARM::EnableHardwareWatchpoint() - addr_word_offset = 0x%8.8x", addr_word_offset);
 
@@ -2348,10 +2364,10 @@
         for (i=0; i<num_hw_watchpoints; ++i)
         {
             if ((m_state.dbg.__wcr[i] & WCR_ENABLE) == 0)
-                break; // We found an available hw breakpoint slot (in i)
+                break; // We found an available hw watchpoint slot (in i)
         }
 
-        // See if we found an available hw breakpoint slot above
+        // See if we found an available hw watchpoint slot above
         if (i < num_hw_watchpoints)
         {
             // Make the byte_mask into a valid Byte Address Select mask





More information about the lldb-commits mailing list