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