[all-commits] [llvm/llvm-project] 58abbf: [lldb] [Process/FreeBSDRemote] Access GPR via regi...

Michał Górny via All-commits all-commits at lists.llvm.org
Mon Nov 16 03:20:52 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 58abbf821ce88f4d35cdfa36cdb486e2d56a04e2
      https://github.com/llvm/llvm-project/commit/58abbf821ce88f4d35cdfa36cdb486e2d56a04e2
  Author: Michał Górny <mgorny at moritz.systems>
  Date:   2020-11-16 (Mon, 16 Nov 2020)

  Changed paths:
    M lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
    M lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.h
    M lldb/unittests/Process/CMakeLists.txt
    A lldb/unittests/Process/Utility/CMakeLists.txt
    A lldb/unittests/Process/Utility/RegisterContextFreeBSDTest.cpp

  Log Message:
  -----------
  [lldb] [Process/FreeBSDRemote] Access GPR via reginfo offsets

Read and write registers from m_gpr using offsets from RegisterInfo
rather than explicit switch-case.  This eliminates a lot of redundant
code, and avoids mistakes such as type mismatches seen recently (wrt
segment registers).  The same logic will be extended to other register
sets in the future.

Make m_gpr an uint8_t std::array to ease accesses.  Ideally, we could
avoid including <machine/reg.h> entirely in the future and instead
get the correct GPR size from Utility/RegisterContextFreeBSD_* somehow.

While at it, modify register set logic to use an explicit enum with
llvm::Optional<>, making the code cleaner and at the same time enabling
compiler warnings for unhandled sets.

Since now we're fully relying on 'struct GPR' defined
in Utility/RegisterContextFreeBSD_* being entirely in sync with
the system structure, add unit tests to verify the field offsets
and sizes.

Differential Revision: https://reviews.llvm.org/D91216




More information about the All-commits mailing list