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