87 lines · c
1//===-- NativeRegisterContextFreeBSD_arm64.h --------------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#if defined(__aarch64__)10 11#ifndef lldb_NativeRegisterContextFreeBSD_arm64_h12#define lldb_NativeRegisterContextFreeBSD_arm64_h13 14// clang-format off15#include <sys/types.h>16#include <sys/param.h>17#include <machine/reg.h>18// clang-format on19 20#include "Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD.h"21#include "Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.h"22#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h"23 24#include <array>25 26#if __FreeBSD_version >= 130013927# define LLDB_HAS_FREEBSD_WATCHPOINT 128#endif29 30namespace lldb_private {31namespace process_freebsd {32 33class NativeProcessFreeBSD;34 35class NativeRegisterContextFreeBSD_arm6436 : public NativeRegisterContextFreeBSD,37 public NativeRegisterContextDBReg_arm64 {38public:39 NativeRegisterContextFreeBSD_arm64(const ArchSpec &target_arch,40 NativeThreadFreeBSD &native_thread);41 42 uint32_t GetRegisterSetCount() const override;43 44 uint32_t GetUserRegisterCount() const override;45 46 const RegisterSet *GetRegisterSet(uint32_t set_index) const override;47 48 Status ReadRegister(const RegisterInfo *reg_info,49 RegisterValue ®_value) override;50 51 Status WriteRegister(const RegisterInfo *reg_info,52 const RegisterValue ®_value) override;53 54 Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override;55 56 Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;57 58 llvm::Error59 CopyHardwareWatchpointsFrom(NativeRegisterContextFreeBSD &source) override;60 61private:62 // Due to alignment, FreeBSD reg/fpreg are a few bytes larger than63 // LLDB's GPR/FPU structs. However, all fields have matching offsets64 // and sizes, so we do not have to worry about these (and we have65 // a unittest to assert that).66 std::array<uint8_t, sizeof(reg) + sizeof(fpreg)> m_reg_data;67#ifdef LLDB_HAS_FREEBSD_WATCHPOINT68 dbreg m_dbreg;69 bool m_read_dbreg;70#endif71 72 Status ReadRegisterSet(uint32_t set);73 Status WriteRegisterSet(uint32_t set);74 75 llvm::Error ReadHardwareDebugInfo() override;76 llvm::Error WriteHardwareDebugRegs(DREGType hwbType) override;77 78 RegisterInfoPOSIX_arm64 &GetRegisterInfo() const;79};80 81} // namespace process_freebsd82} // namespace lldb_private83 84#endif // #ifndef lldb_NativeRegisterContextFreeBSD_arm64_h85 86#endif // defined (__aarch64__)87