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