[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
parent
76257422
Please register or sign in to comment