95 lines · c
1//===-- NativeRegisterContextLinux_arm.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(__arm__) || defined(__arm64__) || defined(__aarch64__)10 11#ifndef lldb_NativeRegisterContextLinux_arm_h12#define lldb_NativeRegisterContextLinux_arm_h13 14#include "Plugins/Process/Linux/NativeRegisterContextLinux.h"15#include "Plugins/Process/Utility/NativeRegisterContextDBReg_arm.h"16#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm.h"17#include "Plugins/Process/Utility/lldb-arm-register-enums.h"18 19namespace lldb_private {20namespace process_linux {21 22class NativeProcessLinux;23 24class NativeRegisterContextLinux_arm : public NativeRegisterContextLinux,25 public NativeRegisterContextDBReg_arm {26public:27 NativeRegisterContextLinux_arm(const ArchSpec &target_arch,28 NativeThreadProtocol &native_thread);29 30 uint32_t GetRegisterSetCount() const override;31 32 const RegisterSet *GetRegisterSet(uint32_t set_index) const override;33 34 uint32_t GetUserRegisterCount() const override;35 36 Status ReadRegister(const RegisterInfo *reg_info,37 RegisterValue ®_value) override;38 39 Status WriteRegister(const RegisterInfo *reg_info,40 const RegisterValue ®_value) override;41 42 Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override;43 44 Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;45 46protected:47 Status DoReadRegisterValue(uint32_t offset, const char *reg_name,48 uint32_t size, RegisterValue &value) override;49 50 Status DoWriteRegisterValue(uint32_t offset, const char *reg_name,51 const RegisterValue &value) override;52 53 Status ReadGPR() override;54 55 Status WriteGPR() override;56 57 Status ReadFPR() override;58 59 Status WriteFPR() override;60 61 void *GetGPRBuffer() override { return &m_gpr_arm; }62 63 void *GetFPRBuffer() override { return &m_fpr; }64 65 size_t GetFPRSize() override { return sizeof(m_fpr); }66 67private:68 uint32_t m_gpr_arm[k_num_gpr_registers_arm];69 RegisterInfoPOSIX_arm::FPU m_fpr;70 71 bool m_refresh_hwdebug_info;72 73 bool IsGPR(unsigned reg) const;74 75 bool IsFPR(unsigned reg) const;76 77 llvm::Error ReadHardwareDebugInfo() override;78 79 llvm::Error WriteHardwareDebugRegs(DREGType hwbType) override;80#ifdef __arm__81 llvm::Error WriteHardwareDebugReg(DREGType hwbType, int hwb_index);82#endif83 84 uint32_t CalculateFprOffset(const RegisterInfo *reg_info) const;85 86 RegisterInfoPOSIX_arm &GetRegisterInfo() const;87};88 89} // namespace process_linux90} // namespace lldb_private91 92#endif // #ifndef lldb_NativeRegisterContextLinux_arm_h93 94#endif // defined(__arm__) || defined(__arm64__) || defined(__aarch64__)95