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