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
16
17#include <asm/ptrace.h>
18
19namespace lldb_private {
20namespace process_linux {
21
22class NativeProcessLinux;
23
24class NativeRegisterContextLinux_loongarch64
25 : public NativeRegisterContextLinux {
26public:
27 NativeRegisterContextLinux_loongarch64(
28 const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
29 std::unique_ptr<RegisterInfoPOSIX_loongarch64> register_info_up);
30
31 uint32_t GetRegisterSetCount() const override;
32
33 uint32_t GetUserRegisterCount() const override;
34
35 const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
36
37 Status ReadRegister(const RegisterInfo *reg_info,
38 RegisterValue &reg_value) override;
39
40 Status WriteRegister(const RegisterInfo *reg_info,
41 const RegisterValue &reg_value) override;
42
43 Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override;
44
45 Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
46
47 void InvalidateAllRegisters() override;
48
49 std::vector<uint32_t>
50 GetExpeditedRegisters(ExpeditedRegs expType) const override;
51
52 bool RegisterOffsetIsDynamic() const override { return true; }
53
54protected:
55 Status ReadGPR() override;
56
57 Status WriteGPR() override;
58
59 Status ReadFPR() override;
60
61 Status WriteFPR() override;
62
63 void *GetGPRBuffer() override { return &m_gpr; }
64
65 void *GetFPRBuffer() override { return &m_fpr; }
66
67 size_t GetGPRSize() const override { return GetRegisterInfo().GetGPRSize(); }
68
69 size_t GetFPRSize() override { return GetRegisterInfo().GetFPRSize(); }
70
71private:
72 bool m_gpr_is_valid;
73 bool m_fpu_is_valid;
74
76
78
79 bool IsGPR(unsigned reg) const;
80
81 bool IsFPR(unsigned reg) const;
82
83 uint32_t CalculateFprOffset(const RegisterInfo *reg_info) const;
84
85 const RegisterInfoPOSIX_loongarch64 &GetRegisterInfo() const;
86};
87
88} // namespace process_linux
89} // namespace lldb_private
90
91#endif // #ifndef lldb_NativeRegisterContextLinux_loongarch64_h
92
93#endif // defined(__loongarch__) && __loongarch_grlen == 64
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:328
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
Definition: lldb-forward.h:329