1 //===-- DynamicRegisterInfo.h -----------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef lldb_DynamicRegisterInfo_h_ 11 #define lldb_DynamicRegisterInfo_h_ 12 13 // C Includes 14 // C++ Includes 15 #include <map> 16 #include <vector> 17 18 // Other libraries and framework includes 19 // Project includes 20 #include "lldb/Utility/ConstString.h" 21 #include "lldb/Utility/StructuredData.h" 22 #include "lldb/lldb-private.h" 23 24 class DynamicRegisterInfo { 25 public: 26 DynamicRegisterInfo(); 27 28 DynamicRegisterInfo(const lldb_private::StructuredData::Dictionary &dict, 29 const lldb_private::ArchSpec &arch); 30 31 virtual ~DynamicRegisterInfo(); 32 33 size_t SetRegisterInfo(const lldb_private::StructuredData::Dictionary &dict, 34 const lldb_private::ArchSpec &arch); 35 36 void AddRegister(lldb_private::RegisterInfo ®_info, 37 lldb_private::ConstString ®_name, 38 lldb_private::ConstString ®_alt_name, 39 lldb_private::ConstString &set_name); 40 41 void Finalize(const lldb_private::ArchSpec &arch); 42 43 size_t GetNumRegisters() const; 44 45 size_t GetNumRegisterSets() const; 46 47 size_t GetRegisterDataByteSize() const; 48 49 const lldb_private::RegisterInfo *GetRegisterInfoAtIndex(uint32_t i) const; 50 51 lldb_private::RegisterInfo *GetRegisterInfoAtIndex(uint32_t i); 52 53 const lldb_private::RegisterSet *GetRegisterSet(uint32_t i) const; 54 55 uint32_t GetRegisterSetIndexByName(lldb_private::ConstString &set_name, 56 bool can_create); 57 58 uint32_t ConvertRegisterKindToRegisterNumber(uint32_t kind, 59 uint32_t num) const; 60 61 void Dump() const; 62 63 void Clear(); 64 65 protected: 66 //------------------------------------------------------------------ 67 // Classes that inherit from DynamicRegisterInfo can see and modify these 68 //------------------------------------------------------------------ 69 typedef std::vector<lldb_private::RegisterInfo> reg_collection; 70 typedef std::vector<lldb_private::RegisterSet> set_collection; 71 typedef std::vector<uint32_t> reg_num_collection; 72 typedef std::vector<reg_num_collection> set_reg_num_collection; 73 typedef std::vector<lldb_private::ConstString> name_collection; 74 typedef std::map<uint32_t, reg_num_collection> reg_to_regs_map; 75 typedef std::vector<uint8_t> dwarf_opcode; 76 typedef std::map<uint32_t, dwarf_opcode> dynamic_reg_size_map; 77 78 lldb_private::RegisterInfo * 79 GetRegisterInfo(const lldb_private::ConstString ®_name); 80 81 reg_collection m_regs; 82 set_collection m_sets; 83 set_reg_num_collection m_set_reg_nums; 84 name_collection m_set_names; 85 reg_to_regs_map m_value_regs_map; 86 reg_to_regs_map m_invalidate_regs_map; 87 dynamic_reg_size_map m_dynamic_reg_size_map; 88 size_t m_reg_data_byte_size; // The number of bytes required to store all 89 // registers 90 bool m_finalized; 91 }; 92 93 #endif // lldb_DynamicRegisterInfo_h_ 94