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_DynamicRegisterInfo_h_
10 #define lldb_DynamicRegisterInfo_h_
11 
12 #include <map>
13 #include <vector>
14 
17 #include "lldb/lldb-private.h"
18 
20 public:
21  DynamicRegisterInfo() = default;
22 
24  const lldb_private::ArchSpec &arch);
25 
26  virtual ~DynamicRegisterInfo() = default;
27 
29  void operator=(DynamicRegisterInfo &) = delete;
30 
33 
35  const lldb_private::ArchSpec &arch);
36 
37  void AddRegister(lldb_private::RegisterInfo &reg_info,
38  lldb_private::ConstString &reg_name,
39  lldb_private::ConstString &reg_alt_name,
40  lldb_private::ConstString &set_name);
41 
42  void Finalize(const lldb_private::ArchSpec &arch);
43 
44  size_t GetNumRegisters() const;
45 
46  size_t GetNumRegisterSets() const;
47 
48  size_t GetRegisterDataByteSize() const;
49 
50  const lldb_private::RegisterInfo *GetRegisterInfoAtIndex(uint32_t i) const;
51 
52  lldb_private::RegisterInfo *GetRegisterInfoAtIndex(uint32_t i);
53 
54  const lldb_private::RegisterSet *GetRegisterSet(uint32_t i) const;
55 
57  bool can_create);
58 
60  uint32_t num) const;
61 
62  void Dump() const;
63 
64  void Clear();
65 
66 protected:
67  // Classes that inherit from DynamicRegisterInfo can see and modify these
68  typedef std::vector<lldb_private::RegisterInfo> reg_collection;
69  typedef std::vector<lldb_private::RegisterSet> set_collection;
70  typedef std::vector<uint32_t> reg_num_collection;
71  typedef std::vector<reg_num_collection> set_reg_num_collection;
72  typedef std::vector<lldb_private::ConstString> name_collection;
73  typedef std::map<uint32_t, reg_num_collection> reg_to_regs_map;
74  typedef std::vector<uint8_t> dwarf_opcode;
75  typedef std::map<uint32_t, dwarf_opcode> dynamic_reg_size_map;
76 
77  const lldb_private::RegisterInfo *
79 
80  void MoveFrom(DynamicRegisterInfo &&info);
81 
82  reg_collection m_regs;
83  set_collection m_sets;
84  set_reg_num_collection m_set_reg_nums;
85  name_collection m_set_names;
86  reg_to_regs_map m_value_regs_map;
87  reg_to_regs_map m_invalidate_regs_map;
88  dynamic_reg_size_map m_dynamic_reg_size_map;
89  size_t m_reg_data_byte_size = 0u; // The number of bytes required to store
90  // all registers
91  bool m_finalized = false;
92 };
93 #endif // lldb_DynamicRegisterInfo_h_
size_t GetNumRegisters() const
std::map< uint32_t, reg_num_collection > reg_to_regs_map
void Finalize(const lldb_private::ArchSpec &arch)
std::vector< lldb_private::RegisterInfo > reg_collection
virtual ~DynamicRegisterInfo()=default
std::vector< reg_num_collection > set_reg_num_collection
dynamic_reg_size_map m_dynamic_reg_size_map
An architecture specification class.
Definition: ArchSpec.h:32
std::map< uint32_t, dwarf_opcode > dynamic_reg_size_map
reg_to_regs_map m_value_regs_map
void AddRegister(lldb_private::RegisterInfo &reg_info, lldb_private::ConstString &reg_name, lldb_private::ConstString &reg_alt_name, lldb_private::ConstString &set_name)
void operator=(DynamicRegisterInfo &)=delete
size_t GetNumRegisterSets() const
void MoveFrom(DynamicRegisterInfo &&info)
uint32_t GetRegisterSetIndexByName(lldb_private::ConstString &set_name, bool can_create)
uint32_t ConvertRegisterKindToRegisterNumber(uint32_t kind, uint32_t num) const
const lldb_private::RegisterSet * GetRegisterSet(uint32_t i) const
std::vector< uint8_t > dwarf_opcode
name_collection m_set_names
size_t SetRegisterInfo(const lldb_private::StructuredData::Dictionary &dict, const lldb_private::ArchSpec &arch)
std::vector< lldb_private::ConstString > name_collection
size_t GetRegisterDataByteSize() const
A uniqued constant string class.
Definition: ConstString.h:38
const lldb_private::RegisterInfo * GetRegisterInfo(lldb_private::ConstString reg_name) const
DynamicRegisterInfo()=default
std::vector< lldb_private::RegisterSet > set_collection
set_reg_num_collection m_set_reg_nums
reg_to_regs_map m_invalidate_regs_map
const lldb_private::RegisterInfo * GetRegisterInfoAtIndex(uint32_t i) const
std::vector< uint32_t > reg_num_collection