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