LLDB mainline
NativeRegisterContextLinux_loongarch64.h
Go to the documentation of this file.
1//===-- NativeRegisterContextLinux_loongarch64.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(__loongarch__) && __loongarch_grlen == 64
10
11#ifndef lldb_NativeRegisterContextLinux_loongarch64_h
12#define lldb_NativeRegisterContextLinux_loongarch64_h
13
17
18#include <asm/ptrace.h>
19
20namespace lldb_private {
21namespace process_linux {
22
24
25class NativeRegisterContextLinux_loongarch64
27 public NativeRegisterContextDBReg_loongarch {
28public:
29 NativeRegisterContextLinux_loongarch64(
30 const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
31 std::unique_ptr<RegisterInfoPOSIX_loongarch64> register_info_up);
32
33 uint32_t GetRegisterSetCount() const override;
34
35 uint32_t GetUserRegisterCount() const override;
36
37 const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
38
39 Status ReadRegister(const RegisterInfo *reg_info,
40 RegisterValue &reg_value) override;
41
42 Status WriteRegister(const RegisterInfo *reg_info,
43 const RegisterValue &reg_value) override;
44
45 Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override;
46
47 Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
48
49 void InvalidateAllRegisters() override;
50
51 std::vector<uint32_t>
52 GetExpeditedRegisters(ExpeditedRegs expType) const override;
53
54 bool RegisterOffsetIsDynamic() const override { return true; }
55
56protected:
57 Status ReadGPR() override;
58
59 Status WriteGPR() override;
60
61 Status ReadFPR() override;
62
63 Status WriteFPR() override;
64
65 Status ReadLSX();
66
67 Status WriteLSX();
68
69 Status ReadLASX();
70
71 Status WriteLASX();
72
73 void *GetGPRBuffer() override { return &m_gpr; }
74
75 void *GetFPRBuffer() override { return &m_fpr; }
76
77 size_t GetGPRSize() const override { return GetRegisterInfo().GetGPRSize(); }
78
79 size_t GetFPRSize() override { return GetRegisterInfo().GetFPRSize(); }
80
81private:
82 bool m_gpr_is_valid;
83 bool m_fpu_is_valid;
84 bool m_lsx_is_valid;
85 bool m_lasx_is_valid;
86 bool m_refresh_hwdebug_info;
87
88 RegisterInfoPOSIX_loongarch64::GPR m_gpr;
89 RegisterInfoPOSIX_loongarch64::FPR m_fpr;
90 RegisterInfoPOSIX_loongarch64::LSX m_lsx;
91 RegisterInfoPOSIX_loongarch64::LASX m_lasx;
92
93 bool IsGPR(unsigned reg) const;
94
95 bool IsFPR(unsigned reg) const;
96
97 bool IsLSX(unsigned reg) const;
98
99 bool IsLASX(unsigned reg) const;
100
101 uint32_t CalculateFprOffset(const RegisterInfo *reg_info) const;
102
103 uint32_t CalculateLsxOffset(const RegisterInfo *reg_info) const;
104
105 uint32_t CalculateLasxOffset(const RegisterInfo *reg_info) const;
106
107 const RegisterInfoPOSIX_loongarch64 &GetRegisterInfo() const;
108
109 llvm::Error ReadHardwareDebugInfo() override;
110
111 llvm::Error WriteHardwareDebugRegs(DREGType hwbType) override;
112};
113
114} // namespace process_linux
115} // namespace lldb_private
116
117#endif // #ifndef lldb_NativeRegisterContextLinux_loongarch64_h
118
119#endif // defined(__loongarch__) && __loongarch_grlen == 64
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