LLDB mainline
NativeRegisterContextLinux_arm.h
Go to the documentation of this file.
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-exception
6//
7//===----------------------------------------------------------------------===//
8
9#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
10
11#ifndef lldb_NativeRegisterContextLinux_arm_h
12#define lldb_NativeRegisterContextLinux_arm_h
13
18
19namespace lldb_private {
20namespace process_linux {
21
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 &reg_value) override;
38
39 Status WriteRegister(const RegisterInfo *reg_info,
40 const RegisterValue &reg_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#endif
83
84 uint32_t CalculateFprOffset(const RegisterInfo *reg_info) const;
85
86 RegisterInfoPOSIX_arm &GetRegisterInfo() const;
87};
88
89} // namespace process_linux
90} // namespace lldb_private
91
92#endif // #ifndef lldb_NativeRegisterContextLinux_arm_h
93
94#endif // defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
Manages communication with the inferior (debugee) process.
Status WriteHardwareDebugRegs(int hwbType, ::pid_t tid, uint32_t max_supported, const std::array< NativeRegisterContextDBReg::DREG, 16 > &regs)
Status ReadHardwareDebugInfo(::pid_t tid, uint32_t &max_hwp_supported, uint32_t &max_hbp_supported)
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP