[Lldb-commits] [PATCH] D21164: Improve watchpoint error reporting specially for arm/aarch64 targets

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 20 15:30:39 PDT 2016

clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Seems like CheckIfWatchpointsExhausted() inside Target.cpp works for some targets, but not all of them. Seems like this functionality should be pushed down into RegisterContext to do this right. For now this is OK, but we should file a bug to track fixing this correctly so that multiple watchpoints can share a single hardware watchpoint when possible.

Comment at: source/Target/Target.cpp:714
@@ -713,2 +713,3 @@
         uint32_t num_current_watchpoints = target->GetWatchpointList().GetSize();
+        if (num_supported_hardware_watchpoints == 0)
This logic isn't necessarily correct. If we have the ability to watch N bytes at a time with a single hardware watchpoint, we might have 1 hardware watchpoint that is able to watch multiple things. So for code like:

char buffer[8] = ...;

then we watch "buffer[1]" and "buffer[7]", we could actually have 2 watchpoints but only use 1 hardware watchpoint. We really should be allowing each process plug-in to try and set the watchpoint and return the correct error instead of generically trying to catch _anything_ at the target level. So it seems like this code should be removed and moved into RegisterContext and allow each register context plug-in to respond correctly as only the it will know what can be done.


More information about the lldb-commits mailing list