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
23class NativeProcessLinux;
24
25class NativeRegisterContextLinux_loongarch64
26 : public NativeRegisterContextLinux,
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 void *GetGPRBuffer() override { return &m_gpr; }
66
67 void *GetFPRBuffer() override { return &m_fpr; }
68
69 size_t GetGPRSize() const override { return GetRegisterInfo().GetGPRSize(); }
70
71 size_t GetFPRSize() override { return GetRegisterInfo().GetFPRSize(); }
72
73private:
74 bool m_gpr_is_valid;
75 bool m_fpu_is_valid;
76 bool m_refresh_hwdebug_info;
77
79
81
82 bool IsGPR(unsigned reg) const;
83
84 bool IsFPR(unsigned reg) const;
85
86 uint32_t CalculateFprOffset(const RegisterInfo *reg_info) const;
87
88 const RegisterInfoPOSIX_loongarch64 &GetRegisterInfo() const;
89
90 llvm::Error ReadHardwareDebugInfo() override;
91
92 llvm::Error WriteHardwareDebugRegs(DREGType hwbType) override;
93};
94
95} // namespace process_linux
96} // namespace lldb_private
97
98#endif // #ifndef lldb_NativeRegisterContextLinux_loongarch64_h
99
100#endif // defined(__loongarch__) && __loongarch_grlen == 64
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:336
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
Definition: lldb-forward.h:337