[Lldb-commits] [PATCH] D89874: [lldb] Unify x86 watchpoint implementation on Linux and NetBSD (and future FreeBSD plugin) [WIP]

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 21 05:49:39 PDT 2020


mgorny created this revision.
mgorny added a reviewer: labath.
Herald added subscribers: pengfei, krytarowski.
mgorny requested review of this revision.

This is a WIP on unifying the x86 watchpoint implementation that is used on Linux and NetBSD. For the initial version, I've copied the code from NetBSD and tested it on Linux. Both my minimal testing worked and I didn't see any change in `check-lldb`.

The NetBSD implementation differs from Linux:

1. Uses `ReadRegister()` instead of `ReadRegisterRaw()`. I don't think that's a problem, might be a little less optimized but shouldn't matter.
2. Uses global watchpoint bit rather than local (local don't work correctly on NetBSD). If you prefer staying with global bit, I can trivially abstract that out.
3. Clears DR6 on adding new watchpoint with a different address, rather than on clearing it. This is necessary since LLDB clears and readds watchpoint on every hit, on all threads. This prevented the NetBSD plugin from correctly detecting serialized watchpoint hits (since DR6 was cleared on other threads that were still pending).


https://reviews.llvm.org/D89874

Files:
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
  lldb/source/Plugins/Process/Utility/CMakeLists.txt
  lldb/source/Plugins/Process/Utility/WatchpointMixin_x86.cpp
  lldb/source/Plugins/Process/Utility/WatchpointMixin_x86.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89874.299649.patch
Type: text/x-patch
Size: 23198 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201021/96e81b82/attachment-0001.bin>


More information about the lldb-commits mailing list