[Lldb-commits] [PATCH] D108831: [lldb] [gdb-remote] Add x86_64 pseudo-registers when using gdbserver

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 27 10:08:25 PDT 2021


mgorny created this revision.
mgorny added reviewers: krytarowski, jasonmolenda, JDevlieghere, labath, emaste.
Herald added a subscriber: pengfei.
mgorny requested review of this revision.

Add a pre- and post-finalize hooks to GDBRemoteRegisterContext that add
missing pseudo-register on x86_64.  This is necessary since -- unlike
lldb-server -- gdbserver does not include pseudo-registers in its target
definitions.  Both hooks are implemented in a separate file for x86_64,
and can be easily defined for other architectures.

The pre-finalize hook checks whether appropriate x86_64 pseudo-registers
are defined (e.g. the EAX, AX, AH, AL, MMi registers, etc.).  If they
are not, it defines them referring to the full registers via value_regs
field.

Then, the already-present logic in the finalize function sets
appropriate offsets based on the value_regs linking.  The exception to
that are the AH..DH registers which carry the offsets of AL..DL at this
point due to the limitation of value_regs logic.

Finally, the post-finalize hook takes care of adjusting the offsets
of AH..DH registers.  While technically this could be resolved via some
generic logic in RegisterInfo, given it applies only to a 4 very
specific registers, it seemed cleaner not to require global LLDB changes
and instead perform the fixup in a hook.


https://reviews.llvm.org/D108831

Files:
  lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext_x86_64.cpp
  lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108831.369129.patch
Type: text/x-patch
Size: 10357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210827/43de3e1c/attachment.bin>


More information about the lldb-commits mailing list