[Lldb-commits] [PATCH] D24610: LLDB Arm Watchpoints: Use single hardware watchpoint slot to watch multiple bytes where possible

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 16 11:47:08 PDT 2016


zturner added a subscriber: zturner.

================
Comment at: packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c:23
@@ +22,3 @@
+    {
+        printf("About to write byteArray[%d] ...\n", i); // About to write byteArray
+
----------------
What's up with all the double spaced source code?  Is this intentional?

================
Comment at: source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp:513-521
@@ -513,1 +512,11 @@
+
+  // Find out how many bytes we need to watch after 4-byte alignment boundary.
+  uint8_t watch_size = (addr & 0x03) + size;
+
+  // We cannot watch zero or more than 4 bytes after 4-byte alignment boundary.
+  if (size == 0 || watch_size > 4)
+    return LLDB_INVALID_INDEX32;
+
+  // Strip away last two bits of address for byte/half-word/word selection.
+  addr &= ~((lldb::addr_t)3);
 
----------------
This block of code is a bit confusing to me.  Is this equivalent to:

```
lldb::addr_t start = llvm::alignDown(addr, 4);
lldb::addr_t end = addr + size;
if (start == end || (end-start)>4)
  return LLDB_INVALID_INDEX32;
```


https://reviews.llvm.org/D24610





More information about the lldb-commits mailing list