summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2012-02-23 23:40:58 +0000
committerJohnny Chen <johnny.chen@apple.com>2012-02-23 23:40:58 +0000
commit6476fad6695f91bd0a4c886bb902ec69fd3c81cc (patch)
tree8ae9831671e471067b23c8c886f8d834d35315db /lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
parentb8cbe9cb4f332ba845980160329cd2001714f708 (diff)
downloadbcm5719-llvm-6476fad6695f91bd0a4c886bb902ec69fd3c81cc.tar.gz
bcm5719-llvm-6476fad6695f91bd0a4c886bb902ec69fd3c81cc.zip
Add comments about address word offset and the calculation of byte address select mask for WCR.
llvm-svn: 151305
Diffstat (limited to 'lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp')
-rw-r--r--lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp b/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
index 4c931424c15..5a1b999408c 100644
--- a/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
@@ -2329,6 +2329,22 @@ DNBArchMachARM::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool
// 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 @@ DNBArchMachARM::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool
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
OpenPOWER on IntegriCloud