[Lldb-commits] [PATCH] D89335: [lldb] Generic support for caching register set reads/writes [WIP]
Michał Górny via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 13 11:06:40 PDT 2020
mgorny created this revision.
mgorny added reviewers: labath, krytarowski, emaste.
Herald added a subscriber: arichardson.
mgorny requested review of this revision.
// This is work-in-progress, submitted to get proposed API reviewed. No actual caching is done yet.
// I am planning to use this for NetBSD and FreeBSD. It will also result in some of the code being deduplicated.
Introduce a new API for caching register set reads and writes
in the generic NativeRegisterContextRegisterInfo class. Use it
in the NetBSD plugin for initial testing.
The implementation provides a generic caching version of ReadRegister()
and WriteRegister() that call virtual methods implemented in actual
NativeRegisterContext* classes. This should not affect existing
implementations since they override ReadRegister() and WriteRegister()
already.
The hook API consists of five methods that need to be implemented
in NativeRegisterContext* classes:
- GetRegisterSetForRegNum() to map register number to a register set number (the latter being opaque to NativeRegisterContextRegisterInfo).
- ReadRegisterSet() and WriteRegisterSet() to respectively read regset into cache and write it back. The actual cache storage is provided by final classes (m_gpr, m_fpr...).
- GetRegisterFromCache() and SetRegisterInCache() to respectively get and update individual register values inside the cache. The implementation of both methods can assume that ReadRegisterSet() has been called to fill the cache, and must not call either ReadRegisterSet() or WriteRegisterSet().
Optionally, the classes can also override:
- FlushRegisterSet() method to control how register sets are flushed, in particular handling overlapping regsets.
The NativeRegisterContextRegisterInfo class maintains state map of cache
for individual regsets, and issues appropriate ReadRegisterSet()
and WriteRegisterSet() calls to maintain it. It includes
a FlushRegisterSets() method that needs to be called whenever the thread
is about to resume execution.
https://reviews.llvm.org/D89335
Files:
lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
lldb/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp
lldb/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89335.297917.patch
Type: text/x-patch
Size: 13032 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201013/6577b546/attachment-0001.bin>
More information about the lldb-commits
mailing list