LLDB mainline
DynamicRegisterInfo.h
Go to the documentation of this file.
1//===-- DynamicRegisterInfo.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_TARGET_DYNAMICREGISTERINFO_H
10#define LLDB_TARGET_DYNAMICREGISTERINFO_H
11
12#include <map>
13#include <vector>
14
19#include "lldb/lldb-private.h"
20
21namespace lldb_private {
22class Stream;
23
25public:
44
48
49
50 static std::unique_ptr<DynamicRegisterInfo>
51 Create(const StructuredData::Dictionary &dict, const ArchSpec &arch);
52
53 virtual ~DynamicRegisterInfo() = default;
54
57
59 const lldb_private::ArchSpec &arch);
60
61 size_t SetRegisterInfo(std::vector<Register> &&regs,
62 const lldb_private::ArchSpec &arch);
63
64 size_t GetNumRegisters() const;
65
66 size_t GetNumRegisterSets() const;
67
68 size_t GetRegisterDataByteSize() const;
69
71
72 const lldb_private::RegisterSet *GetRegisterSet(uint32_t i) const;
73
74 uint32_t ConvertRegisterKindToRegisterNumber(uint32_t kind,
75 uint32_t num) const;
76
78 uint32_t num) const;
79
80 void Dump(Stream &s) const;
81
82 void Clear();
83
84 bool IsReconfigurable();
85
87 GetRegisterInfo(llvm::StringRef reg_name) const;
88
89 typedef std::vector<lldb_private::RegisterInfo> reg_collection;
90 typedef llvm::iterator_range<reg_collection::const_iterator>
92 typedef llvm::iterator_range<reg_collection::iterator> reg_collection_range;
93
94 template <typename T> T registers() = delete;
95
96 template <typename T> T registers() const = delete;
97
98 void ConfigureOffsets();
99
100protected:
101 // Classes that inherit from DynamicRegisterInfo can see and modify these
102 typedef std::vector<lldb_private::RegisterSet> set_collection;
103 typedef std::vector<uint32_t> reg_num_collection;
104 typedef std::vector<reg_num_collection> set_reg_num_collection;
105 typedef std::map<uint32_t, reg_num_collection> reg_to_regs_map;
106 typedef std::map<uint32_t, uint32_t> reg_offset_map;
107
108 llvm::Expected<uint32_t> ByteOffsetFromSlice(uint32_t index,
109 llvm::StringRef slice_str,
110 lldb::ByteOrder byte_order);
111 llvm::Expected<uint32_t> ByteOffsetFromComposite(
112 uint32_t index, lldb_private::StructuredData::Array &composite_reg_list,
113 lldb::ByteOrder byte_order);
114 llvm::Expected<uint32_t> ByteOffsetFromRegInfoDict(
115 uint32_t index, lldb_private::StructuredData::Dictionary &reg_info_dict,
116 lldb::ByteOrder byte_order);
117
118 void MoveFrom(DynamicRegisterInfo &&info);
119
120 void Finalize(const lldb_private::ArchSpec &arch);
121
128 size_t m_reg_data_byte_size = 0u; // The number of bytes required to store
129 // all registers
130 bool m_finalized = false;
132};
133
134template <>
139
140template <>
145
146template <>
151
152void addSupplementaryRegister(std::vector<DynamicRegisterInfo::Register> &regs,
153 DynamicRegisterInfo::Register new_reg_info);
154
155} // namespace lldb_private
156
157#endif // LLDB_TARGET_DYNAMICREGISTERINFO_H
An architecture specification class.
Definition ArchSpec.h:32
A uniqued constant string class.
Definition ConstString.h:40
size_t SetRegisterInfo(const lldb_private::StructuredData::Dictionary &dict, const lldb_private::ArchSpec &arch)
std::vector< uint32_t > reg_num_collection
std::map< uint32_t, uint32_t > reg_offset_map
llvm::iterator_range< reg_collection::const_iterator > reg_collection_const_range
llvm::iterator_range< reg_collection::iterator > reg_collection_range
std::vector< reg_num_collection > set_reg_num_collection
const lldb_private::RegisterSet * GetRegisterSet(uint32_t i) const
const lldb_private::RegisterInfo * GetRegisterInfoAtIndex(uint32_t i) const
uint32_t ConvertRegisterKindToRegisterNumber(uint32_t kind, uint32_t num) const
static std::unique_ptr< DynamicRegisterInfo > Create(const StructuredData::Dictionary &dict, const ArchSpec &arch)
DynamicRegisterInfo(DynamicRegisterInfo &)=default
std::map< uint32_t, reg_num_collection > reg_to_regs_map
virtual ~DynamicRegisterInfo()=default
llvm::Expected< uint32_t > ByteOffsetFromComposite(uint32_t index, lldb_private::StructuredData::Array &composite_reg_list, lldb::ByteOrder byte_order)
void Finalize(const lldb_private::ArchSpec &arch)
void MoveFrom(DynamicRegisterInfo &&info)
llvm::Expected< uint32_t > ByteOffsetFromSlice(uint32_t index, llvm::StringRef slice_str, lldb::ByteOrder byte_order)
std::vector< lldb_private::RegisterSet > set_collection
const lldb_private::RegisterInfo * GetRegisterInfo(uint32_t kind, uint32_t num) const
DynamicRegisterInfo & operator=(DynamicRegisterInfo &)=default
std::vector< lldb_private::RegisterInfo > reg_collection
llvm::Expected< uint32_t > ByteOffsetFromRegInfoDict(uint32_t index, lldb_private::StructuredData::Dictionary &reg_info_dict, lldb::ByteOrder byte_order)
A stream class that can stream formatted output to a file.
Definition Stream.h:28
#define LLDB_INVALID_INDEX32
#define LLDB_INVALID_REGNUM
A class that represents a running process on the host machine.
void addSupplementaryRegister(std::vector< DynamicRegisterInfo::Register > &regs, DynamicRegisterInfo::Register new_reg_info)
Format
Display format definitions.
Encoding
Register encoding definitions.
@ eEncodingUint
unsigned integer
ByteOrder
Byte ordering definitions.
Every register is described in detail including its name, alternate name (optional),...
Registers are grouped into register sets.