]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - binutils/debug.h
Automatic date update in version.in
[thirdparty/binutils-gdb.git] / binutils / debug.h
CommitLineData
252b5132 1/* debug.h -- Describe generic debugging information.
e8e7cf2a 2 Copyright (C) 1995-2025 Free Software Foundation, Inc.
252b5132
RH
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
32866df7 9 the Free Software Foundation; either version 3 of the License, or
252b5132
RH
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
b43b5d5f
NC
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
20 02110-1301, USA. */
252b5132
RH
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
50c2245b 28 impetus for this was writing a converter from stabs to HP IEEE-695
252b5132
RH
29 debugging format. */
30
31/* Different kinds of types. */
32
33enum 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
87enum 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
105enum 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
121enum 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
3f5e193b 135typedef struct debug_type_s *debug_type;
252b5132
RH
136
137#define DEBUG_TYPE_NULL ((debug_type) NULL)
138
139/* A field in a struct or union. */
140
3f5e193b 141typedef struct debug_field_s *debug_field;
252b5132
RH
142
143#define DEBUG_FIELD_NULL ((debug_field) NULL)
144
145/* A base class for an object. */
146
3f5e193b 147typedef struct debug_baseclass_s *debug_baseclass;
252b5132
RH
148
149#define DEBUG_BASECLASS_NULL ((debug_baseclass) NULL)
150
151/* A method of an object. */
152
3f5e193b 153typedef struct debug_method_s *debug_method;
252b5132
RH
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
3f5e193b 160typedef struct debug_method_variant_s *debug_method_variant;
252b5132
RH
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
168struct 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. */
015dc7e1 172 bool (*start_compilation_unit) (void *, const char *);
252b5132
RH
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. */
015dc7e1 177 bool (*start_source) (void *, const char *);
252b5132
RH
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. */
015dc7e1 183 bool (*empty_type) (void *);
252b5132
RH
184
185 /* Push a void type onto the type stack. */
015dc7e1 186 bool (*void_type) (void *);
252b5132
RH
187
188 /* Push an integer type onto the type stack, given the size and
189 whether it is unsigned. */
015dc7e1 190 bool (*int_type) (void *, unsigned int, bool);
252b5132
RH
191
192 /* Push a floating type onto the type stack, given the size. */
015dc7e1 193 bool (*float_type) (void *, unsigned int);
252b5132
RH
194
195 /* Push a complex type onto the type stack, given the size. */
015dc7e1 196 bool (*complex_type) (void *, unsigned int);
252b5132 197
015dc7e1
AM
198 /* Push a bool type onto the type stack, given the size. */
199 bool (*bool_type) (void *, unsigned int);
252b5132
RH
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. */
015dc7e1 205 bool (*enum_type)
2da42df6 206 (void *, const char *, const char **, bfd_signed_vma *);
252b5132
RH
207
208 /* Pop the top type on the type stack, and push a pointer to that
209 type onto the type stack. */
015dc7e1 210 bool (*pointer_type) (void *);
252b5132
RH
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
b34976b6 216 been pushed onto the stack. The third argument is TRUE if the
252b5132
RH
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. */
015dc7e1 220 bool (*function_type) (void *, int, bool);
252b5132
RH
221
222 /* Pop the top type on the type stack, and push a reference to that
223 type onto the type stack. */
015dc7e1 224 bool (*reference_type) (void *);
252b5132
RH
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. */
015dc7e1 228 bool (*range_type) (void *, bfd_signed_vma, bfd_signed_vma);
252b5132
RH
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. */
015dc7e1
AM
235 bool (*array_type)
236 (void *, bfd_signed_vma, bfd_signed_vma, bool);
252b5132
RH
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. */
015dc7e1 241 bool (*set_type) (void *, bool);
252b5132
RH
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. */
015dc7e1 247 bool (*offset_type) (void *);
252b5132
RH
248
249 /* Push a method type onto the type stack. If the second argument
b34976b6 250 is TRUE, the top type on the stack is the class to which the
252b5132
RH
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
b34976b6 256 argument information is available. The fourth argument is TRUE
252b5132
RH
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. */
015dc7e1 261 bool (*method_type) (void *, bool, int, bool);
252b5132
RH
262
263 /* Pop the top type off the type stack, and push a const qualified
264 version of that type onto the type stack. */
015dc7e1 265 bool (*const_type) (void *);
252b5132
RH
266
267 /* Pop the top type off the type stack, and push a volatile
268 qualified version of that type onto the type stack. */
015dc7e1 269 bool (*volatile_type) (void *);
252b5132
RH
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
b34976b6 276 with tag_type. The fourth argument is TRUE for a struct, FALSE
252b5132
RH
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. */
015dc7e1
AM
280 bool (*start_struct_type)
281 (void *, const char *, unsigned int, bool, unsigned int);
252b5132
RH
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. */
015dc7e1 287 bool (*struct_field)
2da42df6 288 (void *, const char *, bfd_vma, bfd_vma, enum debug_visibility);
252b5132
RH
289
290 /* Finish building a struct, and push it onto the type stack. */
015dc7e1 291 bool (*end_struct_type) (void *);
252b5132
RH
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
b34976b6
AM
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
252b5132
RH
302 holding the virtual function table should be popped from the type
303 stack. */
015dc7e1
AM
304 bool (*start_class_type)
305 (void *, const char *, unsigned int, bool, unsigned int, bool, bool);
252b5132
RH
306
307 /* Add a static member to the class currently being built. The
308 arguments are the field name, the physical name, and the
309 visibility. The type must be popped off the type stack. */
015dc7e1 310 bool (*class_static_member)
2da42df6 311 (void *, const char *, const char *, enum debug_visibility);
26044998 312
252b5132
RH
313 /* Add a baseclass to the class currently being built. The type of
314 the baseclass must be popped off the type stack. The arguments
315 are the bit position, whether the class is virtual, and the
316 visibility. */
015dc7e1
AM
317 bool (*class_baseclass)
318 (void *, bfd_vma, bool, enum debug_visibility);
252b5132
RH
319
320 /* Start adding a method to the class currently being built. This
321 is followed by calls to class_method_variant and
322 class_static_method_variant to describe different variants of the
323 method which take different arguments. The method is finished
324 with a call to class_end_method. The argument is the method
325 name. */
015dc7e1 326 bool (*class_start_method) (void *, const char *);
252b5132
RH
327
328 /* Describe a variant to the class method currently being built.
329 The type of the variant must be popped off the type stack. The
330 second argument is the physical name of the function. The
331 following arguments are the visibility, whether the variant is
332 const, whether the variant is volatile, the offset in the virtual
333 function table, and whether the context is on the type stack
334 (below the variant type). */
015dc7e1
AM
335 bool (*class_method_variant)
336 (void *, const char *, enum debug_visibility, bool, bool, bfd_vma, bool);
252b5132
RH
337
338 /* Describe a static variant to the class method currently being
339 built. The arguments are the same as for class_method_variant,
340 except that the last two arguments are omitted. The type of the
341 variant must be popped off the type stack. */
015dc7e1
AM
342 bool (*class_static_method_variant)
343 (void *, const char *, enum debug_visibility, bool, bool);
252b5132
RH
344
345 /* Finish describing a class method. */
015dc7e1 346 bool (*class_end_method) (void *);
252b5132
RH
347
348 /* Finish describing a class, and push it onto the type stack. */
015dc7e1 349 bool (*end_class_type) (void *);
252b5132
RH
350
351 /* Push a type on the stack which was given a name by an earlier
352 call to typdef. */
015dc7e1 353 bool (*typedef_type) (void *, const char *);
252b5132
RH
354
355 /* Push a tagged type on the stack which was defined earlier. If
356 the second argument is not NULL, the type was defined by a call
357 to tag. If the second argument is NULL, the type was defined by
358 a call to start_struct_type or start_class_type with a tag of
359 NULL and the number of the third argument. Either way, the
360 fourth argument is the tag kind. Note that this may be called
361 for a struct (class) being defined, in between the call to
362 start_struct_type (start_class_type) and the call to
363 end_struct_type (end_class_type). */
015dc7e1 364 bool (*tag_type)
2da42df6 365 (void *, const char *, unsigned int, enum debug_type_kind);
252b5132
RH
366
367 /* Pop the type stack, and typedef it to the given name. */
015dc7e1 368 bool (*typdef) (void *, const char *);
252b5132
RH
369
370 /* Pop the type stack, and declare it as a tagged struct or union or
371 enum or whatever. The tag passed down here is redundant, since
372 was also passed when enum_type, start_struct_type, or
373 start_class_type was called. */
015dc7e1 374 bool (*tag) (void *, const char *);
252b5132
RH
375
376 /* This is called to record a named integer constant. */
015dc7e1 377 bool (*int_constant) (void *, const char *, bfd_vma);
252b5132
RH
378
379 /* This is called to record a named floating point constant. */
015dc7e1 380 bool (*float_constant) (void *, const char *, double);
252b5132
RH
381
382 /* This is called to record a typed integer constant. The type is
383 popped off the type stack. */
015dc7e1 384 bool (*typed_constant) (void *, const char *, bfd_vma);
252b5132
RH
385
386 /* This is called to record a variable. The type is popped off the
387 type stack. */
015dc7e1 388 bool (*variable)
2da42df6 389 (void *, const char *, enum debug_var_kind, bfd_vma);
252b5132
RH
390
391 /* Start writing out a function. The return type must be popped off
015dc7e1 392 the stack. The bool is TRUE if the function is global. This
252b5132
RH
393 is followed by calls to function_parameter, followed by block
394 information. */
015dc7e1 395 bool (*start_function) (void *, const char *, bool);
252b5132
RH
396
397 /* Record a function parameter for the current function. The type
398 must be popped off the stack. */
015dc7e1 399 bool (*function_parameter)
2da42df6 400 (void *, const char *, enum debug_parm_kind, bfd_vma);
252b5132
RH
401
402 /* Start writing out a block. There is at least one top level block
403 per function. Blocks may be nested. The argument is the
404 starting address of the block. */
015dc7e1 405 bool (*start_block) (void *, bfd_vma);
252b5132
RH
406
407 /* Finish writing out a block. The argument is the ending address
408 of the block. */
015dc7e1 409 bool (*end_block) (void *, bfd_vma);
252b5132
RH
410
411 /* Finish writing out a function. */
015dc7e1 412 bool (*end_function) (void *);
252b5132
RH
413
414 /* Record line number information for the current compilation unit. */
015dc7e1 415 bool (*lineno) (void *, const char *, unsigned long, bfd_vma);
252b5132
RH
416};
417
418/* Exported functions. */
419
420/* The first argument to most of these functions is a handle. This
421 handle is returned by the debug_init function. The purpose of the
422 handle is to permit the debugging routines to not use static
423 variables, and hence to be reentrant. This would be useful for a
424 program which wanted to handle two executables simultaneously. */
425
426/* Return a debugging handle. */
427
19cacf67
AM
428extern void *debug_init (bfd *);
429
430/* Allocate bytes on the debug handle objalloc memory pool. */
431
432extern void *debug_xalloc (void *, size_t);
433extern void *debug_xzalloc (void *, size_t);
252b5132
RH
434
435/* Set the source filename. This implicitly starts a new compilation
436 unit. */
437
015dc7e1 438extern bool debug_set_filename (void *, const char *);
252b5132
RH
439
440/* Change source files to the given file name. This is used for
441 include files in a single compilation unit. */
442
19cacf67 443extern bool debug_start_source (void *, const char *);
252b5132
RH
444
445/* Record a function definition. This implicitly starts a function
446 block. The debug_type argument is the type of the return value.
015dc7e1 447 The bool indicates whether the function is globally visible.
252b5132
RH
448 The bfd_vma is the address of the start of the function. Currently
449 the parameter types are specified by calls to
450 debug_record_parameter. */
451
015dc7e1
AM
452extern bool debug_record_function
453 (void *, const char *, debug_type, bool, bfd_vma);
252b5132
RH
454
455/* Record a parameter for the current function. */
456
015dc7e1 457extern bool debug_record_parameter
2da42df6 458 (void *, const char *, debug_type, enum debug_parm_kind, bfd_vma);
252b5132
RH
459
460/* End a function definition. The argument is the address where the
461 function ends. */
462
015dc7e1 463extern bool debug_end_function (void *, bfd_vma);
252b5132
RH
464
465/* Start a block in a function. All local information will be
466 recorded in this block, until the matching call to debug_end_block.
467 debug_start_block and debug_end_block may be nested. The argument
468 is the address at which this block starts. */
469
015dc7e1 470extern bool debug_start_block (void *, bfd_vma);
252b5132
RH
471
472/* Finish a block in a function. This matches the call to
473 debug_start_block. The argument is the address at which this block
474 ends. */
475
015dc7e1 476extern bool debug_end_block (void *, bfd_vma);
252b5132
RH
477
478/* Associate a line number in the current source file with a given
479 address. */
480
015dc7e1 481extern bool debug_record_line (void *, unsigned long, bfd_vma);
252b5132
RH
482
483/* Start a named common block. This is a block of variables that may
484 move in memory. */
485
015dc7e1 486extern bool debug_start_common_block (void *, const char *);
252b5132
RH
487
488/* End a named common block. */
489
015dc7e1 490extern bool debug_end_common_block (void *, const char *);
252b5132
RH
491
492/* Record a named integer constant. */
493
015dc7e1 494extern bool debug_record_int_const (void *, const char *, bfd_vma);
252b5132
RH
495
496/* Record a named floating point constant. */
497
015dc7e1 498extern bool debug_record_float_const (void *, const char *, double);
252b5132
RH
499
500/* Record a typed constant with an integral value. */
501
015dc7e1 502extern bool debug_record_typed_const
2da42df6 503 (void *, const char *, debug_type, bfd_vma);
252b5132
RH
504
505/* Record a label. */
506
015dc7e1 507extern bool debug_record_label
2da42df6 508 (void *, const char *, debug_type, bfd_vma);
252b5132
RH
509
510/* Record a variable. */
511
015dc7e1 512extern bool debug_record_variable
2da42df6 513 (void *, const char *, debug_type, enum debug_var_kind, bfd_vma);
252b5132
RH
514
515/* Make an indirect type. The first argument is a pointer to the
516 location where the real type will be placed. The second argument
517 is the type tag, if there is one; this may be NULL; the only
518 purpose of this argument is so that debug_get_type_name can return
519 something useful. This function may be used when a type is
520 referenced before it is defined. */
521
522extern debug_type debug_make_indirect_type
2da42df6 523 (void *, debug_type *, const char *);
252b5132
RH
524
525/* Make a void type. */
526
2da42df6 527extern debug_type debug_make_void_type (void *);
252b5132 528
015dc7e1 529/* Make an integer type of a given size. The bool argument is TRUE
252b5132
RH
530 if the integer is unsigned. */
531
015dc7e1 532extern debug_type debug_make_int_type (void *, unsigned int, bool);
252b5132
RH
533
534/* Make a floating point type of a given size. FIXME: On some
535 platforms, like an Alpha, you probably need to be able to specify
536 the format. */
537
2da42df6 538extern debug_type debug_make_float_type (void *, unsigned int);
252b5132
RH
539
540/* Make a boolean type of a given size. */
541
2da42df6 542extern debug_type debug_make_bool_type (void *, unsigned int);
252b5132
RH
543
544/* Make a complex type of a given size. */
545
2da42df6 546extern debug_type debug_make_complex_type (void *, unsigned int);
252b5132 547
b34976b6
AM
548/* Make a structure type. The second argument is TRUE for a struct,
549 FALSE for a union. The third argument is the size of the struct.
252b5132
RH
550 The fourth argument is a NULL terminated array of fields. */
551
552extern debug_type debug_make_struct_type
015dc7e1 553 (void *, bool, bfd_vma, debug_field *);
252b5132
RH
554
555/* Make an object type. The first three arguments after the handle
556 are the same as for debug_make_struct_type. The next arguments are
557 a NULL terminated array of base classes, a NULL terminated array of
558 methods, the type of the object holding the virtual function table
015dc7e1 559 if it is not this object, and a bool which is TRUE if this
252b5132
RH
560 object has its own virtual function table. */
561
562extern debug_type debug_make_object_type
015dc7e1
AM
563 (void *, bool, bfd_vma, debug_field *, debug_baseclass *,
564 debug_method *, debug_type, bool);
252b5132
RH
565
566/* Make an enumeration type. The arguments are a null terminated
567 array of strings, and an array of corresponding values. */
568
569extern debug_type debug_make_enum_type
2da42df6 570 (void *, const char **, bfd_signed_vma *);
252b5132
RH
571
572/* Make a pointer to a given type. */
573
2da42df6 574extern debug_type debug_make_pointer_type (void *, debug_type);
252b5132
RH
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
b34976b6 578 fourth argument is TRUE if the function takes a variable number of
252b5132
RH
579 arguments. If the third argument is NULL, then the argument types
580 are unknown. */
581
582extern debug_type debug_make_function_type
015dc7e1 583 (void *, debug_type, debug_type *, bool);
252b5132
RH
584
585/* Make a reference to a given type. */
586
2da42df6 587extern debug_type debug_make_reference_type (void *, debug_type);
252b5132
RH
588
589/* Make a range of a given type from a lower to an upper bound. */
590
591extern debug_type debug_make_range_type
2da42df6 592 (void *, debug_type, bfd_signed_vma, bfd_signed_vma);
252b5132
RH
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
b34976b6 598 0 and upper should be -1). The sixth argument is TRUE if this
252b5132
RH
599 array is actually a string, as in C. */
600
601extern debug_type debug_make_array_type
2da42df6 602 (void *, debug_type, debug_type, bfd_signed_vma, bfd_signed_vma,
015dc7e1 603 bool);
252b5132
RH
604
605/* Make a set of a given type. For example, a Pascal set type. The
015dc7e1 606 bool argument is TRUE if this set is actually a bitstring, as in
252b5132
RH
607 CHILL. */
608
015dc7e1 609extern debug_type debug_make_set_type (void *, debug_type, bool);
252b5132
RH
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
2da42df6 616extern debug_type debug_make_offset_type (void *, debug_type, debug_type);
252b5132
RH
617
618/* Make a type for a method function. The second argument is the
619 return type. The third argument is the domain. The fourth
620 argument is a NULL terminated array of argument types. The fifth
b34976b6 621 argument is TRUE if the function takes a variable number of
252b5132
RH
622 arguments, in which case the array of argument types indicates the
623 types of the first arguments. The domain and the argument array
624 may be NULL, in which case this is a stub method and that
625 information is not available. Stabs debugging uses this, and gets
626 the argument types from the mangled name. */
627
628extern debug_type debug_make_method_type
015dc7e1 629 (void *, debug_type, debug_type, debug_type *, bool);
252b5132
RH
630
631/* Make a const qualified version of a given type. */
632
2da42df6 633extern debug_type debug_make_const_type (void *, debug_type);
252b5132
RH
634
635/* Make a volatile qualified version of a given type. */
636
2da42df6 637extern debug_type debug_make_volatile_type (void *, debug_type);
252b5132
RH
638
639/* Make an undefined tagged type. For example, a struct which has
640 been mentioned, but not defined. */
641
642extern debug_type debug_make_undefined_tagged_type
2da42df6 643 (void *, const char *, enum debug_type_kind);
252b5132
RH
644
645/* Make a base class for an object. The second argument is the base
646 class type. The third argument is the bit position of this base
647 class in the object. The fourth argument is whether this is a
648 virtual class. The fifth argument is the visibility of the base
649 class. */
650
651extern debug_baseclass debug_make_baseclass
015dc7e1 652 (void *, debug_type, bfd_vma, bool, enum debug_visibility);
252b5132
RH
653
654/* Make a field for a struct. The second argument is the name. The
655 third argument is the type of the field. The fourth argument is
656 the bit position of the field. The fifth argument is the size of
657 the field (it may be zero). The sixth argument is the visibility
658 of the field. */
659
660extern debug_field debug_make_field
2da42df6 661 (void *, const char *, debug_type, bfd_vma, bfd_vma, enum debug_visibility);
252b5132
RH
662
663/* Make a static member of an object. The second argument is the
664 name. The third argument is the type of the member. The fourth
665 argument is the physical name of the member (i.e., the name as a
666 global variable). The fifth argument is the visibility of the
667 member. */
668
669extern debug_field debug_make_static_member
2da42df6 670 (void *, const char *, debug_type, const char *, enum debug_visibility);
252b5132
RH
671
672/* Make a method. The second argument is the name, and the third
673 argument is a NULL terminated array of method variants. Each
674 method variant is a method with this name but with different
675 argument types. */
676
677extern debug_method debug_make_method
2da42df6 678 (void *, const char *, debug_method_variant *);
252b5132
RH
679
680/* Make a method variant. The second argument is the physical name of
681 the function. The third argument is the type of the function,
682 probably constructed by debug_make_method_type. The fourth
683 argument is the visibility. The fifth argument is whether this is
684 a const function. The sixth argument is whether this is a volatile
685 function. The seventh argument is the index in the virtual
686 function table, if any. The eighth argument is the virtual
687 function context. */
688
689extern debug_method_variant debug_make_method_variant
015dc7e1
AM
690 (void *, const char *, debug_type, enum debug_visibility, bool,
691 bool, bfd_vma, debug_type);
252b5132
RH
692
693/* Make a static method argument. The arguments are the same as for
694 debug_make_method_variant, except that the last two are omitted
695 since a static method can not also be virtual. */
696
697extern debug_method_variant debug_make_static_method_variant
015dc7e1
AM
698 (void *, const char *, debug_type, enum debug_visibility, bool,
699 bool);
252b5132
RH
700
701/* Name a type. This returns a new type with an attached name. */
702
2da42df6 703extern debug_type debug_name_type (void *, const char *, debug_type);
252b5132
RH
704
705/* Give a tag to a type, such as a struct or union. This returns a
706 new type with an attached tag. */
707
2da42df6 708extern debug_type debug_tag_type (void *, const char *, debug_type);
252b5132
RH
709
710/* Record the size of a given type. */
711
015dc7e1 712extern bool debug_record_type_size (void *, debug_type, unsigned int);
252b5132
RH
713
714/* Find a named type. */
715
2da42df6 716extern debug_type debug_find_named_type (void *, const char *);
252b5132
RH
717
718/* Find a tagged type. */
719
720extern debug_type debug_find_tagged_type
2da42df6 721 (void *, const char *, enum debug_type_kind);
252b5132
RH
722
723/* Get the kind of a type. */
724
2da42df6 725extern enum debug_type_kind debug_get_type_kind (void *, debug_type);
252b5132
RH
726
727/* Get the name of a type. */
728
2da42df6 729extern const char *debug_get_type_name (void *, debug_type);
252b5132
RH
730
731/* Get the size of a type. */
732
2da42df6 733extern bfd_vma debug_get_type_size (void *, debug_type);
252b5132
RH
734
735/* Get the return type of a function or method type. */
736
2da42df6 737extern debug_type debug_get_return_type (void *, debug_type);
252b5132
RH
738
739/* Get the NULL terminated array of parameter types for a function or
740 method type (actually, parameter types are not currently stored for
741 function types). This may be used to determine whether a method
742 type is a stub method or not. The last argument points to a
015dc7e1 743 bool which is set to TRUE if the function takes a variable
252b5132
RH
744 number of arguments. */
745
b34976b6 746extern const debug_type *debug_get_parameter_types
015dc7e1 747 (void *, debug_type, bool *);
252b5132
RH
748
749/* Get the target type of a pointer or reference or const or volatile
750 type. */
751
2da42df6 752extern debug_type debug_get_target_type (void *, debug_type);
252b5132
RH
753
754/* Get the NULL terminated array of fields for a struct, union, or
755 class. */
756
2da42df6 757extern const debug_field *debug_get_fields (void *, debug_type);
252b5132
RH
758
759/* Get the type of a field. */
760
2da42df6 761extern debug_type debug_get_field_type (void *, debug_field);
252b5132
RH
762
763/* Get the name of a field. */
764
2da42df6 765extern const char *debug_get_field_name (void *, debug_field);
252b5132
RH
766
767/* Get the bit position of a field within the containing structure.
768 If the field is a static member, this will return (bfd_vma) -1. */
769
2da42df6 770extern bfd_vma debug_get_field_bitpos (void *, debug_field);
252b5132
RH
771
772/* Get the bit size of a field. If the field is a static member, this
773 will return (bfd_vma) -1. */
774
2da42df6 775extern bfd_vma debug_get_field_bitsize (void *, debug_field);
252b5132
RH
776
777/* Get the visibility of a field. */
778
2da42df6 779extern enum debug_visibility debug_get_field_visibility (void *, debug_field);
252b5132
RH
780
781/* Get the physical name of a field, if it is a static member. If the
782 field is not a static member, this will return NULL. */
783
2da42df6 784extern const char *debug_get_field_physname (void *, debug_field);
252b5132
RH
785
786/* Write out the recorded debugging information. This takes a set of
787 function pointers which are called to do the actual writing. The
2da42df6 788 first void * is the debugging handle. The second void * is a handle
252b5132
RH
789 which is passed to the functions. */
790
015dc7e1 791extern bool debug_write
2da42df6 792 (void *, const struct debug_write_fns *, void *);
252b5132
RH
793
794#endif /* DEBUG_H */