Added a source code files list viewer
[clinton/Virtual-Jaguar-Rx.git] / src / debugger / DBGManager.h
1
2
3 #ifndef __DBGMANAGER_H__
4 #define __DBGMANAGER_H__
5
6
7 typedef enum {
8 DBG_NO_TYPE = 0x0,
9 DBG_ELF = 0x1,
10 DBG_DWARF = 0x2,
11 DBG_ELFDWARF = 0x4,
12 DBG_HWLABEL = 0x8,
13 DBG_END_TYPE
14 }DBGTYPE;
15
16 // Tag based in the DW_TAG_... list from the dwarf.h
17 typedef enum {
18 DBG_NO_TAG = 0x0,
19 DBG_TAG_pointer_type = 0x0f,
20 DBG_TAG_compile_unit = 0x11,
21 DBG_TAG_base_type = 0x24,
22 DBG_TAG_subprogram = 0x2e,
23 DBG_END_TAG
24 }DBGTAG;
25
26 //
27 typedef enum {
28 DBG_TAG_TYPE_structure = 0x1, // structure
29 DBG_TAG_TYPE_pointer = 0x2, // pointer
30 DBG_TAG_TYPE_subrange = 0x4, // (subrange_type?)
31 DBG_TAG_TYPE_array = 0x8, // array type
32 DBG_TAG_TYPE_const = 0x10, // const type
33 DBG_TAG_TYPE_typedef = 0x20, // typedef
34 DBG_TAG_TYPE_enumeration_type = 0x40, // enumeration
35 DBG_TAG_TYPE_subroutine_type = 0x80 // subroutine
36 }DBGTAGTYPE;
37
38 // Encoding based in the DW_ATE_... list from the dwarf.h
39 // Except for the DBG_ATE_ptr
40 typedef enum {
41 DBG_NO_TYPEENCODING,
42 DBG_ATE_address = 0x1, // linear machine address
43 DBG_ATE_boolean = 0x2, // true or false
44 DBG_ATE_complex_float = 0x3, // complex floating-point number
45 DBG_ATE_float = 0x4, // floating-point number
46 DBG_ATE_signed = 0x5, // signed binary integer
47 DBG_ATE_signed_char = 0x6, // signed character
48 DBG_ATE_unsigned = 0x7, // unsigned binary integer
49 DBG_ATE_unsigned_char = 0x8, // unsigned character
50 DBG_ATE_imaginary_float = 0x9, /* DWARF3 */
51 DBG_ATE_packed_decimal = 0xa, /* DWARF3f */
52 DBG_ATE_numeric_string = 0xb, /* DWARF3f */
53 DBG_ATE_edited = 0xc, /* DWARF3f */
54 DBG_ATE_signed_fixed = 0xd, /* DWARF3f */
55 DBG_ATE_unsigned_fixed = 0xe, /* DWARF3f */
56 DBG_ATE_decimal_float = 0xf, /* DWARF3f */
57 DBG_ATE_ptr = 0x10, // Specific to DBG Manager to represent pointer type
58 DBG_END_TYPEENCODING
59 }DBGTYPEENCODING;
60
61 // Encoding based in the DW_OP_... list from the dwarf.h
62 typedef enum {
63 DBG_NO_OP,
64 DBG_OP_addr = 0x03,
65 DBG_OP_deref = 0x06,
66 DBG_OP_const1u = 0x08,
67 DBG_OP_const1s = 0x09,
68 DBG_OP_const2u = 0x0a,
69 DBG_OP_const2s = 0x0b,
70 DBG_OP_const4u = 0x0c,
71 DBG_OP_const4s = 0x0d,
72 DBG_OP_const8u = 0x0e,
73 DBG_OP_const8s = 0x0f,
74 DBG_OP_constu = 0x10,
75 DBG_OP_consts = 0x11,
76 DBG_OP_dup = 0x12,
77 DBG_OP_drop = 0x13,
78 DBG_OP_over = 0x14,
79 DBG_OP_pick = 0x15,
80 DBG_OP_swap = 0x16,
81 DBG_OP_rot = 0x17,
82 DBG_OP_xderef = 0x18,
83 DBG_OP_abs = 0x19,
84 DBG_OP_and = 0x1a,
85 DBG_OP_div = 0x1b,
86 DBG_OP_minus = 0x1c,
87 DBG_OP_mod = 0x1d,
88 DBG_OP_mul = 0x1e,
89 DBG_OP_neg = 0x1f,
90 DBG_OP_not = 0x20,
91 DBG_OP_or = 0x21,
92 DBG_OP_plus = 0x22,
93 DBG_OP_plus_uconst = 0x23,
94 DBG_OP_shl = 0x24,
95 DBG_OP_shr = 0x25,
96 DBG_OP_shra = 0x26,
97 DBG_OP_xor = 0x27,
98 DBG_OP_bra = 0x28,
99 DBG_OP_eq = 0x29,
100 DBG_OP_ge = 0x2a,
101 DBG_OP_gt = 0x2b,
102 DBG_OP_le = 0x2c,
103 DBG_OP_lt = 0x2d,
104 DBG_OP_ne = 0x2e,
105 DBG_OP_skip = 0x2f,
106 DBG_OP_lit0 = 0x30,
107 DBG_OP_lit1 = 0x31,
108 DBG_OP_lit2 = 0x32,
109 DBG_OP_lit3 = 0x33,
110 DBG_OP_lit4 = 0x34,
111 DBG_OP_lit5 = 0x35,
112 DBG_OP_lit6 = 0x36,
113 DBG_OP_lit7 = 0x37,
114 DBG_OP_lit8 = 0x38,
115 DBG_OP_lit9 = 0x39,
116 DBG_OP_lit10 = 0x3a,
117 DBG_OP_lit11 = 0x3b,
118 DBG_OP_lit12 = 0x3c,
119 DBG_OP_lit13 = 0x3d,
120 DBG_OP_lit14 = 0x3e,
121 DBG_OP_lit15 = 0x3f,
122 DBG_OP_lit16 = 0x40,
123 DBG_OP_lit17 = 0x41,
124 DBG_OP_lit18 = 0x42,
125 DBG_OP_lit19 = 0x43,
126 DBG_OP_lit20 = 0x44,
127 DBG_OP_lit21 = 0x45,
128 DBG_OP_lit22 = 0x46,
129 DBG_OP_lit23 = 0x47,
130 DBG_OP_lit24 = 0x48,
131 DBG_OP_lit25 = 0x49,
132 DBG_OP_lit26 = 0x4a,
133 DBG_OP_lit27 = 0x4b,
134 DBG_OP_lit28 = 0x4c,
135 DBG_OP_lit29 = 0x4d,
136 DBG_OP_lit30 = 0x4e,
137 DBG_OP_lit31 = 0x4f,
138 DBG_OP_reg0 = 0x50,
139 DBG_OP_reg1 = 0x51,
140 DBG_OP_reg2 = 0x52,
141 DBG_OP_reg3 = 0x53,
142 DBG_OP_reg4 = 0x54,
143 DBG_OP_reg5 = 0x55,
144 DBG_OP_reg6 = 0x56,
145 DBG_OP_reg7 = 0x57,
146 DBG_OP_reg8 = 0x58,
147 DBG_OP_reg9 = 0x59,
148 DBG_OP_reg10 = 0x5a,
149 DBG_OP_reg11 = 0x5b,
150 DBG_OP_reg12 = 0x5c,
151 DBG_OP_reg13 = 0x5d,
152 DBG_OP_reg14 = 0x5e,
153 DBG_OP_reg15 = 0x5f,
154 DBG_OP_reg16 = 0x60,
155 DBG_OP_reg17 = 0x61,
156 DBG_OP_reg18 = 0x62,
157 DBG_OP_reg19 = 0x63,
158 DBG_OP_reg20 = 0x64,
159 DBG_OP_reg21 = 0x65,
160 DBG_OP_reg22 = 0x66,
161 DBG_OP_reg23 = 0x67,
162 DBG_OP_reg24 = 0x68,
163 DBG_OP_reg25 = 0x69,
164 DBG_OP_reg26 = 0x6a,
165 DBG_OP_reg27 = 0x6b,
166 DBG_OP_reg28 = 0x6c,
167 DBG_OP_reg29 = 0x6d,
168 DBG_OP_reg30 = 0x6e,
169 DBG_OP_reg31 = 0x6f,
170 DBG_OP_breg0 = 0x70,
171 DBG_OP_breg1 = 0x71,
172 DBG_OP_breg2 = 0x72,
173 DBG_OP_breg3 = 0x73,
174 DBG_OP_breg4 = 0x74,
175 DBG_OP_breg5 = 0x75,
176 DBG_OP_breg6 = 0x76,
177 DBG_OP_breg7 = 0x77,
178 DBG_OP_breg8 = 0x78,
179 DBG_OP_breg9 = 0x79,
180 DBG_OP_breg10 = 0x7a,
181 DBG_OP_breg11 = 0x7b,
182 DBG_OP_breg12 = 0x7c,
183 DBG_OP_breg13 = 0x7d,
184 DBG_OP_breg14 = 0x7e,
185 DBG_OP_breg15 = 0x7f,
186 DBG_OP_breg16 = 0x80,
187 DBG_OP_breg17 = 0x81,
188 DBG_OP_breg18 = 0x82,
189 DBG_OP_breg19 = 0x83,
190 DBG_OP_breg20 = 0x84,
191 DBG_OP_breg21 = 0x85,
192 DBG_OP_breg22 = 0x86,
193 DBG_OP_breg23 = 0x87,
194 DBG_OP_breg24 = 0x88,
195 DBG_OP_breg25 = 0x89,
196 DBG_OP_breg26 = 0x8a,
197 DBG_OP_breg27 = 0x8b,
198 DBG_OP_breg28 = 0x8c,
199 DBG_OP_breg29 = 0x8d,
200 DBG_OP_breg30 = 0x8e,
201 DBG_OP_breg31 = 0x8f,
202 DBG_OP_regx = 0x90,
203 DBG_OP_fbreg = 0x91,
204 DBG_OP_bregx = 0x92,
205 DBG_OP_piece = 0x93,
206 DBG_OP_deref_size = 0x94,
207 DBG_OP_xderef_size = 0x95,
208 DBG_OP_nop = 0x96,
209 DBG_OP_push_object_address = 0x97, /* DWARF3 */
210 DBG_OP_call2 = 0x98, /* DWARF3 */
211 DBG_OP_call4 = 0x99, /* DWARF3 */
212 DBG_OP_call_ref = 0x9a, /* DWARF3 */
213 DBG_OP_form_tls_address = 0x9b, /* DWARF3f */
214 DBG_OP_call_frame_cfa = 0x9c, /* DWARF3f */
215 DBG_OP_bit_piece = 0x9d, /* DWARF3f */
216 DBG_OP_implicit_value = 0x9e, /* DWARF4 */
217 DBG_OP_stack_value = 0x9f, /* DWARF4 */
218 DBG_END_OP
219 }
220 DBGOP;
221
222
223 // Internal manager
224 extern void DBGManager_Init(void);
225 extern void DBGManager_SetType(size_t DBGTypeSet);
226 extern size_t DBGManager_GetType(void);
227 extern void DBGManager_Reset(void);
228 extern void DBGManager_Close(void);
229
230 // General manager
231 extern char *DBGManager_GetSymbolNameFromAdr(size_t Adr);
232 extern char *DBGManager_GetFullSourceFilenameFromAdr(size_t Adr, bool *Error);
233 extern size_t DBGManager_GetNumLineFromAdr(size_t Adr, size_t Tag);
234 extern char *DBGManager_GetLineSrcFromAdr(size_t Adr, size_t Tag);
235 extern char *DBGManager_GetLineSrcFromAdrNumLine(size_t Adr, size_t NumLine);
236 extern char *DBGManager_GetLineSrcFromNumLineBaseAdr(size_t Adr, size_t NumLine);
237 extern size_t DBGManager_GetAdrFromSymbolName(char *SymbolName);
238 extern char *DBGManager_GetFunctionName(size_t Adr);
239 extern char *DBGManager_GetVariableValueFromAdr(size_t Adr, size_t TypeEncoding, size_t TypeByteSize);
240 extern size_t DBGManager_GetNbFullSourceFilename(void);
241 extern char *DBGManager_GetNumFullSourceFilename(size_t Index);
242
243 // Global variables manager
244 extern size_t DBGManager_GetNbGlobalVariables(void);
245 extern char *DBGManager_GetGlobalVariableName(size_t Index);
246 extern size_t DBGManager_GetGlobalVariableTypeEncoding(size_t Index);
247 extern char *DBGManager_GetGlobalVariableTypeName(size_t Index);
248 extern size_t DBGManager_GetGlobalVariableTypeByteSize(size_t Index);
249 extern size_t DBGManager_GetGlobalVariableAdr(size_t Index);
250 extern size_t DBGManager_GetGlobalVariableAdrFromName(char *VariableName);
251 extern char *DBGManager_GetGlobalVariableValue(size_t Index);
252 extern size_t DBGManager_GetGlobalVariableTypeTag(size_t Index);
253
254 // Local variables manager
255 extern size_t DBGManager_GetNbLocalVariables(size_t Adr);
256 extern char *DBGManager_GetLocalVariableName(size_t Adr, size_t Index);
257 extern size_t DBGManager_GetLocalVariableTypeEncoding(size_t Adr, size_t Index);
258 extern char *DBGManager_GetLocalVariableTypeName(size_t Adr, size_t Index);
259 extern size_t DBGManager_GetLocalVariableTypeByteSize(size_t Adr, size_t Index);
260 extern size_t DBGManager_GetLocalVariableTypeTag(size_t Adr, size_t Index);
261 extern size_t DBGManager_GetLocalVariableOp(size_t Adr, size_t Index);
262 extern int DBGManager_GetLocalVariableOffset(size_t Adr, size_t Index);
263
264
265 #endif // __DBGMANAGER_H__