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 <vector>
16 
17 // Other libraries and framework includes
18 // Project includes
19 #include "lldb/lldb-private.h"
20 #include "lldb/Core/ConstString.h"
21 
22 class DynamicRegisterInfo
23 {
24 public:
25     DynamicRegisterInfo ();
26 
27     DynamicRegisterInfo (const lldb_private::PythonDictionary &dict);
28 
29     virtual
30     ~DynamicRegisterInfo ();
31 
32     size_t
33     SetRegisterInfo (const lldb_private::PythonDictionary &dict);
34 
35     void
36     AddRegister (lldb_private::RegisterInfo &reg_info,
37                  lldb_private::ConstString &reg_name,
38                  lldb_private::ConstString &reg_alt_name,
39                  lldb_private::ConstString &set_name);
40 
41     void
42     Finalize ();
43 
44     size_t
45     GetNumRegisters() const;
46 
47     size_t
48     GetNumRegisterSets() const;
49 
50     size_t
51     GetRegisterDataByteSize() const;
52 
53     const lldb_private::RegisterInfo *
54     GetRegisterInfoAtIndex (uint32_t i) const;
55 
56     const lldb_private::RegisterSet *
57     GetRegisterSet (uint32_t i) const;
58 
59     uint32_t
60     GetRegisterSetIndexByName (lldb_private::ConstString &set_name, bool can_create);
61 
62     uint32_t
63     ConvertRegisterKindToRegisterNumber (uint32_t kind, uint32_t num) const;
64 
65     void
66     Clear();
67 
68 protected:
69     //------------------------------------------------------------------
70     // Classes that inherit from DynamicRegisterInfo can see and modify these
71     //------------------------------------------------------------------
72     typedef std::vector <lldb_private::RegisterInfo> reg_collection;
73     typedef std::vector <lldb_private::RegisterSet> set_collection;
74     typedef std::vector <uint32_t> reg_num_collection;
75     typedef std::vector <reg_num_collection> set_reg_num_collection;
76     typedef std::vector <lldb_private::ConstString> name_collection;
77 
78     reg_collection m_regs;
79     set_collection m_sets;
80     set_reg_num_collection m_set_reg_nums;
81     name_collection m_set_names;
82     size_t m_reg_data_byte_size;   // The number of bytes required to store all registers
83 };
84 
85 #endif  // lldb_DynamicRegisterInfo_h_
86