Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | /* debug.h -- Describe generic debugging information. |
2 | Copyright (C) 1995, 1996 Free Software Foundation, Inc. | |
3 | Written by Ian Lance Taylor <ian@cygnus.com>. | |
4 | ||
5 | This file is part of GNU Binutils. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
20 | 02111-1307, USA. */ | |
21 | ||
22 | #ifndef DEBUG_H | |
23 | #define DEBUG_H | |
24 | ||
25 | /* This header file describes a generic debugging information format. | |
26 | We may eventually have readers which convert different formats into | |
27 | this generic format, and writers which write it out. The initial | |
28 | impetus for this was writing a convertor from stabs to HP IEEE-695 | |
29 | debugging format. */ | |
30 | ||
31 | /* Different kinds of types. */ | |
32 | ||
33 | enum debug_type_kind | |
34 | { | |
35 | /* Not used. */ | |
36 | DEBUG_KIND_ILLEGAL, | |
37 | /* Indirect via a pointer. */ | |
38 | DEBUG_KIND_INDIRECT, | |
39 | /* Void. */ | |
40 | DEBUG_KIND_VOID, | |
41 | /* Integer. */ | |
42 | DEBUG_KIND_INT, | |
43 | /* Floating point. */ | |
44 | DEBUG_KIND_FLOAT, | |
45 | /* Complex. */ | |
46 | DEBUG_KIND_COMPLEX, | |
47 | /* Boolean. */ | |
48 | DEBUG_KIND_BOOL, | |
49 | /* Struct. */ | |
50 | DEBUG_KIND_STRUCT, | |
51 | /* Union. */ | |
52 | DEBUG_KIND_UNION, | |
53 | /* Class. */ | |
54 | DEBUG_KIND_CLASS, | |
55 | /* Union class (can this really happen?). */ | |
56 | DEBUG_KIND_UNION_CLASS, | |
57 | /* Enumeration type. */ | |
58 | DEBUG_KIND_ENUM, | |
59 | /* Pointer. */ | |
60 | DEBUG_KIND_POINTER, | |
61 | /* Function. */ | |
62 | DEBUG_KIND_FUNCTION, | |
63 | /* Reference. */ | |
64 | DEBUG_KIND_REFERENCE, | |
65 | /* Range. */ | |
66 | DEBUG_KIND_RANGE, | |
67 | /* Array. */ | |
68 | DEBUG_KIND_ARRAY, | |
69 | /* Set. */ | |
70 | DEBUG_KIND_SET, | |
71 | /* Based pointer. */ | |
72 | DEBUG_KIND_OFFSET, | |
73 | /* Method. */ | |
74 | DEBUG_KIND_METHOD, | |
75 | /* Const qualified type. */ | |
76 | DEBUG_KIND_CONST, | |
77 | /* Volatile qualified type. */ | |
78 | DEBUG_KIND_VOLATILE, | |
79 | /* Named type. */ | |
80 | DEBUG_KIND_NAMED, | |
81 | /* Tagged type. */ | |
82 | DEBUG_KIND_TAGGED | |
83 | }; | |
84 | ||
85 | /* Different kinds of variables. */ | |
86 | ||
87 | enum debug_var_kind | |
88 | { | |
89 | /* Not used. */ | |
90 | DEBUG_VAR_ILLEGAL, | |
91 | /* A global variable. */ | |
92 | DEBUG_GLOBAL, | |
93 | /* A static variable. */ | |
94 | DEBUG_STATIC, | |
95 | /* A local static variable. */ | |
96 | DEBUG_LOCAL_STATIC, | |
97 | /* A local variable. */ | |
98 | DEBUG_LOCAL, | |
99 | /* A register variable. */ | |
100 | DEBUG_REGISTER | |
101 | }; | |
102 | ||
103 | /* Different kinds of function parameters. */ | |
104 | ||
105 | enum debug_parm_kind | |
106 | { | |
107 | /* Not used. */ | |
108 | DEBUG_PARM_ILLEGAL, | |
109 | /* A stack based parameter. */ | |
110 | DEBUG_PARM_STACK, | |
111 | /* A register parameter. */ | |
112 | DEBUG_PARM_REG, | |
113 | /* A stack based reference parameter. */ | |
114 | DEBUG_PARM_REFERENCE, | |
115 | /* A register reference parameter. */ | |
116 | DEBUG_PARM_REF_REG | |
117 | }; | |
118 | ||
119 | /* Different kinds of visibility. */ | |
120 | ||
121 | enum debug_visibility | |
122 | { | |
123 | /* A public field (e.g., a field in a C struct). */ | |
124 | DEBUG_VISIBILITY_PUBLIC, | |
125 | /* A protected field. */ | |
126 | DEBUG_VISIBILITY_PROTECTED, | |
127 | /* A private field. */ | |
128 | DEBUG_VISIBILITY_PRIVATE, | |
129 | /* A field which should be ignored. */ | |
130 | DEBUG_VISIBILITY_IGNORE | |
131 | }; | |
132 | ||
133 | /* A type. */ | |
134 | ||
135 | typedef struct debug_type *debug_type; | |
136 | ||
137 | #define DEBUG_TYPE_NULL ((debug_type) NULL) | |
138 | ||
139 | /* A field in a struct or union. */ | |
140 | ||
141 | typedef struct debug_field *debug_field; | |
142 | ||
143 | #define DEBUG_FIELD_NULL ((debug_field) NULL) | |
144 | ||
145 | /* A base class for an object. */ | |
146 | ||
147 | typedef struct debug_baseclass *debug_baseclass; | |
148 | ||
149 | #define DEBUG_BASECLASS_NULL ((debug_baseclass) NULL) | |
150 | ||
151 | /* A method of an object. */ | |
152 | ||
153 | typedef struct debug_method *debug_method; | |
154 | ||
155 | #define DEBUG_METHOD_NULL ((debug_method) NULL) | |
156 | ||
157 | /* The arguments to a method function of an object. These indicate | |
158 | which method to run. */ | |
159 | ||
160 | typedef struct debug_method_variant *debug_method_variant; | |
161 | ||
162 | #define DEBUG_METHOD_VARIANT_NULL ((debug_method_variant) NULL) | |
163 | ||
164 | /* This structure is passed to debug_write. It holds function | |
165 | pointers that debug_write will call based on the accumulated | |
166 | debugging information. */ | |
167 | ||
168 | struct debug_write_fns | |
169 | { | |
170 | /* This is called at the start of each new compilation unit with the | |
171 | name of the main file in the new unit. */ | |
172 | boolean (*start_compilation_unit) PARAMS ((PTR, const char *)); | |
173 | ||
174 | /* This is called at the start of each source file within a | |
175 | compilation unit, before outputting any global information for | |
176 | that file. The argument is the name of the file. */ | |
177 | boolean (*start_source) PARAMS ((PTR, const char *)); | |
178 | ||
179 | /* Each writer must keep a stack of types. */ | |
180 | ||
181 | /* Push an empty type onto the type stack. This type can appear if | |
182 | there is a reference to a type which is never defined. */ | |
183 | boolean (*empty_type) PARAMS ((PTR)); | |
184 | ||
185 | /* Push a void type onto the type stack. */ | |
186 | boolean (*void_type) PARAMS ((PTR)); | |
187 | ||
188 | /* Push an integer type onto the type stack, given the size and | |
189 | whether it is unsigned. */ | |
190 | boolean (*int_type) PARAMS ((PTR, unsigned int, boolean)); | |
191 | ||
192 | /* Push a floating type onto the type stack, given the size. */ | |
193 | boolean (*float_type) PARAMS ((PTR, unsigned int)); | |
194 | ||
195 | /* Push a complex type onto the type stack, given the size. */ | |
196 | boolean (*complex_type) PARAMS ((PTR, unsigned int)); | |
197 | ||
198 | /* Push a boolean type onto the type stack, given the size. */ | |
199 | boolean (*bool_type) PARAMS ((PTR, unsigned int)); | |
200 | ||
201 | /* Push an enum type onto the type stack, given the tag, a NULL | |
202 | terminated array of names and the associated values. If there is | |
203 | no tag, the tag argument will be NULL. If this is an undefined | |
204 | enum, the names and values arguments will be NULL. */ | |
205 | boolean (*enum_type) PARAMS ((PTR, const char *, const char **, | |
206 | bfd_signed_vma *)); | |
207 | ||
208 | /* Pop the top type on the type stack, and push a pointer to that | |
209 | type onto the type stack. */ | |
210 | boolean (*pointer_type) PARAMS ((PTR)); | |
211 | ||
212 | /* Push a function type onto the type stack. The second argument | |
213 | indicates the number of argument types that have been pushed onto | |
214 | the stack. If the number of argument types is passed as -1, then | |
215 | the argument types of the function are unknown, and no types have | |
216 | been pushed onto the stack. The third argument is true if the | |
217 | function takes a variable number of arguments. The return type | |
218 | of the function is pushed onto the type stack below the argument | |
219 | types, if any. */ | |
220 | boolean (*function_type) PARAMS ((PTR, int, boolean)); | |
221 | ||
222 | /* Pop the top type on the type stack, and push a reference to that | |
223 | type onto the type stack. */ | |
224 | boolean (*reference_type) PARAMS ((PTR)); | |
225 | ||
226 | /* Pop the top type on the type stack, and push a range of that type | |
227 | with the given lower and upper bounds onto the type stack. */ | |
228 | boolean (*range_type) PARAMS ((PTR, bfd_signed_vma, bfd_signed_vma)); | |
229 | ||
230 | /* Push an array type onto the type stack. The top type on the type | |
231 | stack is the range, and the next type on the type stack is the | |
232 | element type. These should be popped before the array type is | |
233 | pushed. The arguments are the lower bound, the upper bound, and | |
234 | whether the array is a string. */ | |
235 | boolean (*array_type) PARAMS ((PTR, bfd_signed_vma, bfd_signed_vma, | |
236 | boolean)); | |
237 | ||
238 | /* Pop the top type on the type stack, and push a set of that type | |
239 | onto the type stack. The argument indicates whether this set is | |
240 | a bitstring. */ | |
241 | boolean (*set_type) PARAMS ((PTR, boolean)); | |
242 | ||
243 | /* Push an offset type onto the type stack. The top type on the | |
244 | type stack is the target type, and the next type on the type | |
245 | stack is the base type. These should be popped before the offset | |
246 | type is pushed. */ | |
247 | boolean (*offset_type) PARAMS ((PTR)); | |
248 | ||
249 | /* Push a method type onto the type stack. If the second argument | |
250 | is true, the top type on the stack is the class to which the | |
251 | method belongs; otherwise, the class must be determined by the | |
252 | class to which the method is attached. The third argument is the | |
253 | number of argument types; these are pushed onto the type stack in | |
254 | reverse order (the first type popped is the last argument to the | |
255 | method). A value of -1 for the third argument means that no | |
256 | argument information is available. The fourth argument is true | |
257 | if the function takes a variable number of arguments. The next | |
258 | type on the type stack below the domain and the argument types is | |
259 | the return type of the method. All these types must be popped, | |
260 | and then the method type must be pushed. */ | |
261 | boolean (*method_type) PARAMS ((PTR, boolean, int, boolean)); | |
262 | ||
263 | /* Pop the top type off the type stack, and push a const qualified | |
264 | version of that type onto the type stack. */ | |
265 | boolean (*const_type) PARAMS ((PTR)); | |
266 | ||
267 | /* Pop the top type off the type stack, and push a volatile | |
268 | qualified version of that type onto the type stack. */ | |
269 | boolean (*volatile_type) PARAMS ((PTR)); | |
270 | ||
271 | /* Start building a struct. This is followed by calls to the | |
272 | struct_field function, and finished by a call to the | |
273 | end_struct_type function. The second argument is the tag; this | |
274 | will be NULL if there isn't one. If the second argument is NULL, | |
275 | the third argument is a constant identifying this struct for use | |
276 | with tag_type. The fourth argument is true for a struct, false | |
277 | for a union. The fifth argument is the size. If this is an | |
278 | undefined struct or union, the size will be 0 and struct_field | |
279 | will not be called before end_struct_type is called. */ | |
280 | boolean (*start_struct_type) PARAMS ((PTR, const char *, unsigned int, | |
281 | boolean, unsigned int)); | |
282 | ||
283 | /* Add a field to the struct type currently being built. The type | |
284 | of the field should be popped off the type stack. The arguments | |
285 | are the name, the bit position, the bit size (may be zero if the | |
286 | field is not packed), and the visibility. */ | |
287 | boolean (*struct_field) PARAMS ((PTR, const char *, bfd_vma, bfd_vma, | |
288 | enum debug_visibility)); | |
289 | ||
290 | /* Finish building a struct, and push it onto the type stack. */ | |
291 | boolean (*end_struct_type) PARAMS ((PTR)); | |
292 | ||
293 | /* Start building a class. This is followed by calls to several | |
294 | functions: struct_field, class_static_member, class_baseclass, | |
295 | class_start_method, class_method_variant, | |
296 | class_static_method_variant, and class_end_method. The class is | |
297 | finished by a call to end_class_type. The first five arguments | |
298 | are the same as for start_struct_type. The sixth argument is | |
299 | true if there is a virtual function table; if there is, the | |
300 | seventh argument is true if the virtual function table can be | |
301 | found in the type itself, and is false if the type of the object | |
302 | holding the virtual function table should be popped from the type | |
303 | stack. */ | |
304 | boolean (*start_class_type) PARAMS ((PTR, const char *, unsigned int, | |
305 | boolean, unsigned int, boolean, | |
306 | boolean)); | |
307 | ||
308 | /* Add a static member to the class currently being built. The | |
309 | arguments are the field name, the physical name, and the | |
310 | visibility. The type must be popped off the type stack. */ | |
311 | boolean (*class_static_member) PARAMS ((PTR, const char *, const char *, | |
312 | enum debug_visibility)); | |
313 | ||
314 | /* Add a baseclass to the class currently being built. The type of | |
315 | the baseclass must be popped off the type stack. The arguments | |
316 | are the bit position, whether the class is virtual, and the | |
317 | visibility. */ | |
318 | boolean (*class_baseclass) PARAMS ((PTR, bfd_vma, boolean, | |
319 | enum debug_visibility)); | |
320 | ||
321 | /* Start adding a method to the class currently being built. This | |
322 | is followed by calls to class_method_variant and | |
323 | class_static_method_variant to describe different variants of the | |
324 | method which take different arguments. The method is finished | |
325 | with a call to class_end_method. The argument is the method | |
326 | name. */ | |
327 | boolean (*class_start_method) PARAMS ((PTR, const char *)); | |
328 | ||
329 | /* Describe a variant to the class method currently being built. | |
330 | The type of the variant must be popped off the type stack. The | |
331 | second argument is the physical name of the function. The | |
332 | following arguments are the visibility, whether the variant is | |
333 | const, whether the variant is volatile, the offset in the virtual | |
334 | function table, and whether the context is on the type stack | |
335 | (below the variant type). */ | |
336 | boolean (*class_method_variant) PARAMS ((PTR, const char *, | |
337 | enum debug_visibility, | |
338 | boolean, boolean, | |
339 | bfd_vma, boolean)); | |
340 | ||
341 | /* Describe a static variant to the class method currently being | |
342 | built. The arguments are the same as for class_method_variant, | |
343 | except that the last two arguments are omitted. The type of the | |
344 | variant must be popped off the type stack. */ | |
345 | boolean (*class_static_method_variant) PARAMS ((PTR, const char *, | |
346 | enum debug_visibility, | |
347 | boolean, boolean)); | |
348 | ||
349 | /* Finish describing a class method. */ | |
350 | boolean (*class_end_method) PARAMS ((PTR)); | |
351 | ||
352 | /* Finish describing a class, and push it onto the type stack. */ | |
353 | boolean (*end_class_type) PARAMS ((PTR)); | |
354 | ||
355 | /* Push a type on the stack which was given a name by an earlier | |
356 | call to typdef. */ | |
357 | boolean (*typedef_type) PARAMS ((PTR, const char *)); | |
358 | ||
359 | /* Push a tagged type on the stack which was defined earlier. If | |
360 | the second argument is not NULL, the type was defined by a call | |
361 | to tag. If the second argument is NULL, the type was defined by | |
362 | a call to start_struct_type or start_class_type with a tag of | |
363 | NULL and the number of the third argument. Either way, the | |
364 | fourth argument is the tag kind. Note that this may be called | |
365 | for a struct (class) being defined, in between the call to | |
366 | start_struct_type (start_class_type) and the call to | |
367 | end_struct_type (end_class_type). */ | |
368 | boolean (*tag_type) PARAMS ((PTR, const char *, unsigned int, | |
369 | enum debug_type_kind)); | |
370 | ||
371 | /* Pop the type stack, and typedef it to the given name. */ | |
372 | boolean (*typdef) PARAMS ((PTR, const char *)); | |
373 | ||
374 | /* Pop the type stack, and declare it as a tagged struct or union or | |
375 | enum or whatever. The tag passed down here is redundant, since | |
376 | was also passed when enum_type, start_struct_type, or | |
377 | start_class_type was called. */ | |
378 | boolean (*tag) PARAMS ((PTR, const char *)); | |
379 | ||
380 | /* This is called to record a named integer constant. */ | |
381 | boolean (*int_constant) PARAMS ((PTR, const char *, bfd_vma)); | |
382 | ||
383 | /* This is called to record a named floating point constant. */ | |
384 | boolean (*float_constant) PARAMS ((PTR, const char *, double)); | |
385 | ||
386 | /* This is called to record a typed integer constant. The type is | |
387 | popped off the type stack. */ | |
388 | boolean (*typed_constant) PARAMS ((PTR, const char *, bfd_vma)); | |
389 | ||
390 | /* This is called to record a variable. The type is popped off the | |
391 | type stack. */ | |
392 | boolean (*variable) PARAMS ((PTR, const char *, enum debug_var_kind, | |
393 | bfd_vma)); | |
394 | ||
395 | /* Start writing out a function. The return type must be popped off | |
396 | the stack. The boolean is true if the function is global. This | |
397 | is followed by calls to function_parameter, followed by block | |
398 | information. */ | |
399 | boolean (*start_function) PARAMS ((PTR, const char *, boolean)); | |
400 | ||
401 | /* Record a function parameter for the current function. The type | |
402 | must be popped off the stack. */ | |
403 | boolean (*function_parameter) PARAMS ((PTR, const char *, | |
404 | enum debug_parm_kind, bfd_vma)); | |
405 | ||
406 | /* Start writing out a block. There is at least one top level block | |
407 | per function. Blocks may be nested. The argument is the | |
408 | starting address of the block. */ | |
409 | boolean (*start_block) PARAMS ((PTR, bfd_vma)); | |
410 | ||
411 | /* Finish writing out a block. The argument is the ending address | |
412 | of the block. */ | |
413 | boolean (*end_block) PARAMS ((PTR, bfd_vma)); | |
414 | ||
415 | /* Finish writing out a function. */ | |
416 | boolean (*end_function) PARAMS ((PTR)); | |
417 | ||
418 | /* Record line number information for the current compilation unit. */ | |
419 | boolean (*lineno) PARAMS ((PTR, const char *, unsigned long, bfd_vma)); | |
420 | }; | |
421 | ||
422 | /* Exported functions. */ | |
423 | ||
424 | /* The first argument to most of these functions is a handle. This | |
425 | handle is returned by the debug_init function. The purpose of the | |
426 | handle is to permit the debugging routines to not use static | |
427 | variables, and hence to be reentrant. This would be useful for a | |
428 | program which wanted to handle two executables simultaneously. */ | |
429 | ||
430 | /* Return a debugging handle. */ | |
431 | ||
432 | extern PTR debug_init PARAMS ((void)); | |
433 | ||
434 | /* Set the source filename. This implicitly starts a new compilation | |
435 | unit. */ | |
436 | ||
437 | extern boolean debug_set_filename PARAMS ((PTR, const char *)); | |
438 | ||
439 | /* Change source files to the given file name. This is used for | |
440 | include files in a single compilation unit. */ | |
441 | ||
442 | extern boolean debug_start_source PARAMS ((PTR, const char *)); | |
443 | ||
444 | /* Record a function definition. This implicitly starts a function | |
445 | block. The debug_type argument is the type of the return value. | |
446 | The boolean indicates whether the function is globally visible. | |
447 | The bfd_vma is the address of the start of the function. Currently | |
448 | the parameter types are specified by calls to | |
449 | debug_record_parameter. */ | |
450 | ||
451 | extern boolean debug_record_function | |
452 | PARAMS ((PTR, const char *, debug_type, boolean, bfd_vma)); | |
453 | ||
454 | /* Record a parameter for the current function. */ | |
455 | ||
456 | extern boolean debug_record_parameter | |
457 | PARAMS ((PTR, const char *, debug_type, enum debug_parm_kind, bfd_vma)); | |
458 | ||
459 | /* End a function definition. The argument is the address where the | |
460 | function ends. */ | |
461 | ||
462 | extern boolean debug_end_function PARAMS ((PTR, bfd_vma)); | |
463 | ||
464 | /* Start a block in a function. All local information will be | |
465 | recorded in this block, until the matching call to debug_end_block. | |
466 | debug_start_block and debug_end_block may be nested. The argument | |
467 | is the address at which this block starts. */ | |
468 | ||
469 | extern boolean debug_start_block PARAMS ((PTR, bfd_vma)); | |
470 | ||
471 | /* Finish a block in a function. This matches the call to | |
472 | debug_start_block. The argument is the address at which this block | |
473 | ends. */ | |
474 | ||
475 | extern boolean debug_end_block PARAMS ((PTR, bfd_vma)); | |
476 | ||
477 | /* Associate a line number in the current source file with a given | |
478 | address. */ | |
479 | ||
480 | extern boolean debug_record_line PARAMS ((PTR, unsigned long, bfd_vma)); | |
481 | ||
482 | /* Start a named common block. This is a block of variables that may | |
483 | move in memory. */ | |
484 | ||
485 | extern boolean debug_start_common_block PARAMS ((PTR, const char *)); | |
486 | ||
487 | /* End a named common block. */ | |
488 | ||
489 | extern boolean debug_end_common_block PARAMS ((PTR, const char *)); | |
490 | ||
491 | /* Record a named integer constant. */ | |
492 | ||
493 | extern boolean debug_record_int_const PARAMS ((PTR, const char *, bfd_vma)); | |
494 | ||
495 | /* Record a named floating point constant. */ | |
496 | ||
497 | extern boolean debug_record_float_const PARAMS ((PTR, const char *, double)); | |
498 | ||
499 | /* Record a typed constant with an integral value. */ | |
500 | ||
501 | extern boolean debug_record_typed_const | |
502 | PARAMS ((PTR, const char *, debug_type, bfd_vma)); | |
503 | ||
504 | /* Record a label. */ | |
505 | ||
506 | extern boolean debug_record_label | |
507 | PARAMS ((PTR, const char *, debug_type, bfd_vma)); | |
508 | ||
509 | /* Record a variable. */ | |
510 | ||
511 | extern boolean debug_record_variable | |
512 | PARAMS ((PTR, const char *, debug_type, enum debug_var_kind, bfd_vma)); | |
513 | ||
514 | /* Make an indirect type. The first argument is a pointer to the | |
515 | location where the real type will be placed. The second argument | |
516 | is the type tag, if there is one; this may be NULL; the only | |
517 | purpose of this argument is so that debug_get_type_name can return | |
518 | something useful. This function may be used when a type is | |
519 | referenced before it is defined. */ | |
520 | ||
521 | extern debug_type debug_make_indirect_type | |
522 | PARAMS ((PTR, debug_type *, const char *)); | |
523 | ||
524 | /* Make a void type. */ | |
525 | ||
526 | extern debug_type debug_make_void_type PARAMS ((PTR)); | |
527 | ||
528 | /* Make an integer type of a given size. The boolean argument is true | |
529 | if the integer is unsigned. */ | |
530 | ||
531 | extern debug_type debug_make_int_type PARAMS ((PTR, unsigned int, boolean)); | |
532 | ||
533 | /* Make a floating point type of a given size. FIXME: On some | |
534 | platforms, like an Alpha, you probably need to be able to specify | |
535 | the format. */ | |
536 | ||
537 | extern debug_type debug_make_float_type PARAMS ((PTR, unsigned int)); | |
538 | ||
539 | /* Make a boolean type of a given size. */ | |
540 | ||
541 | extern debug_type debug_make_bool_type PARAMS ((PTR, unsigned int)); | |
542 | ||
543 | /* Make a complex type of a given size. */ | |
544 | ||
545 | extern debug_type debug_make_complex_type PARAMS ((PTR, unsigned int)); | |
546 | ||
547 | /* Make a structure type. The second argument is true for a struct, | |
548 | false for a union. The third argument is the size of the struct. | |
549 | The fourth argument is a NULL terminated array of fields. */ | |
550 | ||
551 | extern debug_type debug_make_struct_type | |
552 | PARAMS ((PTR, boolean, bfd_vma, debug_field *)); | |
553 | ||
554 | /* Make an object type. The first three arguments after the handle | |
555 | are the same as for debug_make_struct_type. The next arguments are | |
556 | a NULL terminated array of base classes, a NULL terminated array of | |
557 | methods, the type of the object holding the virtual function table | |
558 | if it is not this object, and a boolean which is true if this | |
559 | object has its own virtual function table. */ | |
560 | ||
561 | extern debug_type debug_make_object_type | |
562 | PARAMS ((PTR, boolean, bfd_vma, debug_field *, debug_baseclass *, | |
563 | debug_method *, debug_type, boolean)); | |
564 | ||
565 | /* Make an enumeration type. The arguments are a null terminated | |
566 | array of strings, and an array of corresponding values. */ | |
567 | ||
568 | extern debug_type debug_make_enum_type | |
569 | PARAMS ((PTR, const char **, bfd_signed_vma *)); | |
570 | ||
571 | /* Make a pointer to a given type. */ | |
572 | ||
573 | extern debug_type debug_make_pointer_type | |
574 | PARAMS ((PTR, debug_type)); | |
575 | ||
576 | /* Make a function type. The second argument is the return type. The | |
577 | third argument is a NULL terminated array of argument types. The | |
578 | fourth argument is true if the function takes a variable number of | |
579 | arguments. If the third argument is NULL, then the argument types | |
580 | are unknown. */ | |
581 | ||
582 | extern debug_type debug_make_function_type | |
583 | PARAMS ((PTR, debug_type, debug_type *, boolean)); | |
584 | ||
585 | /* Make a reference to a given type. */ | |
586 | ||
587 | extern debug_type debug_make_reference_type PARAMS ((PTR, debug_type)); | |
588 | ||
589 | /* Make a range of a given type from a lower to an upper bound. */ | |
590 | ||
591 | extern debug_type debug_make_range_type | |
592 | PARAMS ((PTR, debug_type, bfd_signed_vma, bfd_signed_vma)); | |
593 | ||
594 | /* Make an array type. The second argument is the type of an element | |
595 | of the array. The third argument is the type of a range of the | |
596 | array. The fourth and fifth argument are the lower and upper | |
597 | bounds, respectively (if the bounds are not known, lower should be | |
598 | 0 and upper should be -1). The sixth argument is true if this | |
599 | array is actually a string, as in C. */ | |
600 | ||
601 | extern debug_type debug_make_array_type | |
602 | PARAMS ((PTR, debug_type, debug_type, bfd_signed_vma, bfd_signed_vma, | |
603 | boolean)); | |
604 | ||
605 | /* Make a set of a given type. For example, a Pascal set type. The | |
606 | boolean argument is true if this set is actually a bitstring, as in | |
607 | CHILL. */ | |
608 | ||
609 | extern debug_type debug_make_set_type PARAMS ((PTR, debug_type, boolean)); | |
610 | ||
611 | /* Make a type for a pointer which is relative to an object. The | |
612 | second argument is the type of the object to which the pointer is | |
613 | relative. The third argument is the type that the pointer points | |
614 | to. */ | |
615 | ||
616 | extern debug_type debug_make_offset_type | |
617 | PARAMS ((PTR, debug_type, debug_type)); | |
618 | ||
619 | /* Make a type for a method function. The second argument is the | |
620 | return type. The third argument is the domain. The fourth | |
621 | argument is a NULL terminated array of argument types. The fifth | |
622 | argument is true if the function takes a variable number of | |
623 | arguments, in which case the array of argument types indicates the | |
624 | types of the first arguments. The domain and the argument array | |
625 | may be NULL, in which case this is a stub method and that | |
626 | information is not available. Stabs debugging uses this, and gets | |
627 | the argument types from the mangled name. */ | |
628 | ||
629 | extern debug_type debug_make_method_type | |
630 | PARAMS ((PTR, debug_type, debug_type, debug_type *, boolean)); | |
631 | ||
632 | /* Make a const qualified version of a given type. */ | |
633 | ||
634 | extern debug_type debug_make_const_type PARAMS ((PTR, debug_type)); | |
635 | ||
636 | /* Make a volatile qualified version of a given type. */ | |
637 | ||
638 | extern debug_type debug_make_volatile_type PARAMS ((PTR, debug_type)); | |
639 | ||
640 | /* Make an undefined tagged type. For example, a struct which has | |
641 | been mentioned, but not defined. */ | |
642 | ||
643 | extern debug_type debug_make_undefined_tagged_type | |
644 | PARAMS ((PTR, const char *, enum debug_type_kind)); | |
645 | ||
646 | /* Make a base class for an object. The second argument is the base | |
647 | class type. The third argument is the bit position of this base | |
648 | class in the object. The fourth argument is whether this is a | |
649 | virtual class. The fifth argument is the visibility of the base | |
650 | class. */ | |
651 | ||
652 | extern debug_baseclass debug_make_baseclass | |
653 | PARAMS ((PTR, debug_type, bfd_vma, boolean, enum debug_visibility)); | |
654 | ||
655 | /* Make a field for a struct. The second argument is the name. The | |
656 | third argument is the type of the field. The fourth argument is | |
657 | the bit position of the field. The fifth argument is the size of | |
658 | the field (it may be zero). The sixth argument is the visibility | |
659 | of the field. */ | |
660 | ||
661 | extern debug_field debug_make_field | |
662 | PARAMS ((PTR, const char *, debug_type, bfd_vma, bfd_vma, | |
663 | enum debug_visibility)); | |
664 | ||
665 | /* Make a static member of an object. The second argument is the | |
666 | name. The third argument is the type of the member. The fourth | |
667 | argument is the physical name of the member (i.e., the name as a | |
668 | global variable). The fifth argument is the visibility of the | |
669 | member. */ | |
670 | ||
671 | extern debug_field debug_make_static_member | |
672 | PARAMS ((PTR, const char *, debug_type, const char *, | |
673 | enum debug_visibility)); | |
674 | ||
675 | /* Make a method. The second argument is the name, and the third | |
676 | argument is a NULL terminated array of method variants. Each | |
677 | method variant is a method with this name but with different | |
678 | argument types. */ | |
679 | ||
680 | extern debug_method debug_make_method | |
681 | PARAMS ((PTR, const char *, debug_method_variant *)); | |
682 | ||
683 | /* Make a method variant. The second argument is the physical name of | |
684 | the function. The third argument is the type of the function, | |
685 | probably constructed by debug_make_method_type. The fourth | |
686 | argument is the visibility. The fifth argument is whether this is | |
687 | a const function. The sixth argument is whether this is a volatile | |
688 | function. The seventh argument is the index in the virtual | |
689 | function table, if any. The eighth argument is the virtual | |
690 | function context. */ | |
691 | ||
692 | extern debug_method_variant debug_make_method_variant | |
693 | PARAMS ((PTR, const char *, debug_type, enum debug_visibility, boolean, | |
694 | boolean, bfd_vma, debug_type)); | |
695 | ||
696 | /* Make a static method argument. The arguments are the same as for | |
697 | debug_make_method_variant, except that the last two are omitted | |
698 | since a static method can not also be virtual. */ | |
699 | ||
700 | extern debug_method_variant debug_make_static_method_variant | |
701 | PARAMS ((PTR, const char *, debug_type, enum debug_visibility, boolean, | |
702 | boolean)); | |
703 | ||
704 | /* Name a type. This returns a new type with an attached name. */ | |
705 | ||
706 | extern debug_type debug_name_type PARAMS ((PTR, const char *, debug_type)); | |
707 | ||
708 | /* Give a tag to a type, such as a struct or union. This returns a | |
709 | new type with an attached tag. */ | |
710 | ||
711 | extern debug_type debug_tag_type PARAMS ((PTR, const char *, debug_type)); | |
712 | ||
713 | /* Record the size of a given type. */ | |
714 | ||
715 | extern boolean debug_record_type_size PARAMS ((PTR, debug_type, unsigned int)); | |
716 | ||
717 | /* Find a named type. */ | |
718 | ||
719 | extern debug_type debug_find_named_type PARAMS ((PTR, const char *)); | |
720 | ||
721 | /* Find a tagged type. */ | |
722 | ||
723 | extern debug_type debug_find_tagged_type | |
724 | PARAMS ((PTR, const char *, enum debug_type_kind)); | |
725 | ||
726 | /* Get the kind of a type. */ | |
727 | ||
728 | extern enum debug_type_kind debug_get_type_kind PARAMS ((PTR, debug_type)); | |
729 | ||
730 | /* Get the name of a type. */ | |
731 | ||
732 | extern const char *debug_get_type_name PARAMS ((PTR, debug_type)); | |
733 | ||
734 | /* Get the size of a type. */ | |
735 | ||
736 | extern bfd_vma debug_get_type_size PARAMS ((PTR, debug_type)); | |
737 | ||
738 | /* Get the return type of a function or method type. */ | |
739 | ||
740 | extern debug_type debug_get_return_type PARAMS ((PTR, debug_type)); | |
741 | ||
742 | /* Get the NULL terminated array of parameter types for a function or | |
743 | method type (actually, parameter types are not currently stored for | |
744 | function types). This may be used to determine whether a method | |
745 | type is a stub method or not. The last argument points to a | |
746 | boolean which is set to true if the function takes a variable | |
747 | number of arguments. */ | |
748 | ||
749 | extern const debug_type *debug_get_parameter_types PARAMS ((PTR, | |
750 | debug_type, | |
751 | boolean *)); | |
752 | ||
753 | /* Get the target type of a pointer or reference or const or volatile | |
754 | type. */ | |
755 | ||
756 | extern debug_type debug_get_target_type PARAMS ((PTR, debug_type)); | |
757 | ||
758 | /* Get the NULL terminated array of fields for a struct, union, or | |
759 | class. */ | |
760 | ||
761 | extern const debug_field *debug_get_fields PARAMS ((PTR, debug_type)); | |
762 | ||
763 | /* Get the type of a field. */ | |
764 | ||
765 | extern debug_type debug_get_field_type PARAMS ((PTR, debug_field)); | |
766 | ||
767 | /* Get the name of a field. */ | |
768 | ||
769 | extern const char *debug_get_field_name PARAMS ((PTR, debug_field)); | |
770 | ||
771 | /* Get the bit position of a field within the containing structure. | |
772 | If the field is a static member, this will return (bfd_vma) -1. */ | |
773 | ||
774 | extern bfd_vma debug_get_field_bitpos PARAMS ((PTR, debug_field)); | |
775 | ||
776 | /* Get the bit size of a field. If the field is a static member, this | |
777 | will return (bfd_vma) -1. */ | |
778 | ||
779 | extern bfd_vma debug_get_field_bitsize PARAMS ((PTR, debug_field)); | |
780 | ||
781 | /* Get the visibility of a field. */ | |
782 | ||
783 | extern enum debug_visibility debug_get_field_visibility | |
784 | PARAMS ((PTR, debug_field)); | |
785 | ||
786 | /* Get the physical name of a field, if it is a static member. If the | |
787 | field is not a static member, this will return NULL. */ | |
788 | ||
789 | extern const char *debug_get_field_physname PARAMS ((PTR, debug_field)); | |
790 | ||
791 | /* Write out the recorded debugging information. This takes a set of | |
792 | function pointers which are called to do the actual writing. The | |
793 | first PTR is the debugging handle. The second PTR is a handle | |
794 | which is passed to the functions. */ | |
795 | ||
796 | extern boolean debug_write PARAMS ((PTR, const struct debug_write_fns *, PTR)); | |
797 | ||
798 | #endif /* DEBUG_H */ |