LLDB mainline
GDBRemoteRegisterContext.h
Go to the documentation of this file.
1//===-- GDBRemoteRegisterContext.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#ifndef LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTEREGISTERCONTEXT_H
10#define LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTEREGISTERCONTEXT_H
11
12#include <vector>
13
19#include "lldb/lldb-private.h"
20
22
23class StringExtractor;
24
25namespace lldb_private {
26namespace process_gdb_remote {
27
28class ThreadGDBRemote;
29class ProcessGDBRemote;
30class GDBRemoteDynamicRegisterInfo;
31
32typedef std::shared_ptr<GDBRemoteDynamicRegisterInfo>
34
36public:
38
39 ~GDBRemoteDynamicRegisterInfo() override = default;
40
42 void UpdateARM64SMERegistersInfos(uint64_t svg);
43};
44
46public:
47 GDBRemoteRegisterContext(ThreadGDBRemote &thread, uint32_t concrete_frame_idx,
49 bool read_all_at_once, bool write_all_at_once);
50
52
53 void InvalidateAllRegisters() override;
54
55 size_t GetRegisterCount() override;
56
57 const RegisterInfo *GetRegisterInfoAtIndex(size_t reg) override;
58
59 size_t GetRegisterSetCount() override;
60
61 const RegisterSet *GetRegisterSet(size_t reg_set) override;
62
63 bool ReadRegister(const RegisterInfo *reg_info,
64 RegisterValue &value) override;
65
66 bool WriteRegister(const RegisterInfo *reg_info,
67 const RegisterValue &value) override;
68
70
71 bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
72
73 bool ReadAllRegisterValues(RegisterCheckpoint &reg_checkpoint) override;
74
75 bool
76 WriteAllRegisterValues(const RegisterCheckpoint &reg_checkpoint) override;
77
79 uint32_t num) override;
80
81 bool RegisterWriteCausesReconfigure(const llvm::StringRef name) override;
82
83 bool ReconfigureRegisterInfo() override;
84
85protected:
86 friend class ThreadGDBRemote;
87
88 bool ReadRegisterBytes(const RegisterInfo *reg_info);
89
90 bool WriteRegisterBytes(const RegisterInfo *reg_info, DataExtractor &data,
91 uint32_t data_offset);
92
93 bool PrivateSetRegisterValue(uint32_t reg, llvm::ArrayRef<uint8_t> data);
94
95 bool PrivateSetRegisterValue(uint32_t reg, uint64_t val);
96
97 void SetAllRegisterValid(bool b);
98
99 bool GetRegisterIsValid(uint32_t reg) const {
100 assert(reg < m_reg_valid.size());
101 if (reg < m_reg_valid.size())
102 return m_reg_valid[reg];
103 return false;
104 }
105
106 void SetRegisterIsValid(const RegisterInfo *reg_info, bool valid) {
107 if (reg_info)
109 valid);
110 }
111
112 void SetRegisterIsValid(uint32_t reg, bool valid) {
113 assert(reg < m_reg_valid.size());
114 if (reg < m_reg_valid.size())
115 m_reg_valid[reg] = valid;
116 }
117
119 std::vector<bool> m_reg_valid;
124
125private:
126 // Helper function for ReadRegisterBytes().
127 bool GetPrimordialRegister(const RegisterInfo *reg_info,
129 // Helper function for WriteRegisterBytes().
130 bool SetPrimordialRegister(const RegisterInfo *reg_info,
132
136};
137
138} // namespace process_gdb_remote
139} // namespace lldb_private
140
141#endif // LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTEREGISTERCONTEXT_H
An data extractor class.
Definition: DataExtractor.h:48
const RegisterInfo * GetRegisterInfoAtIndex(size_t reg) override
const RegisterSet * GetRegisterSet(size_t reg_set) override
const GDBRemoteRegisterContext & operator=(const GDBRemoteRegisterContext &)=delete
bool RegisterWriteCausesReconfigure(const llvm::StringRef name) override
GDBRemoteRegisterContext(const GDBRemoteRegisterContext &)=delete
bool WriteRegisterBytes(const RegisterInfo *reg_info, DataExtractor &data, uint32_t data_offset)
bool PrivateSetRegisterValue(uint32_t reg, llvm::ArrayRef< uint8_t > data)
bool ReadRegister(const RegisterInfo *reg_info, RegisterValue &value) override
bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override
bool WriteRegister(const RegisterInfo *reg_info, const RegisterValue &value) override
bool ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override
void SetRegisterIsValid(const RegisterInfo *reg_info, bool valid)
bool SetPrimordialRegister(const RegisterInfo *reg_info, GDBRemoteCommunicationClient &gdb_comm)
uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override
Convert from a given register numbering scheme to the lldb register numbering scheme.
bool GetPrimordialRegister(const RegisterInfo *reg_info, GDBRemoteCommunicationClient &gdb_comm)
std::shared_ptr< GDBRemoteDynamicRegisterInfo > GDBRemoteDynamicRegisterInfoSP
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:334
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
Definition: lldb-forward.h:335
RegisterKind
Register numbering types.
@ eRegisterKindLLDB
lldb's internal register numbers
Every register is described in detail including its name, alternate name (optional),...
uint32_t kinds[lldb::kNumRegisterKinds]
Holds all of the various register numbers for all register kinds.
Registers are grouped into register sets.