Back to index

cell-binutils  2.17cvs20070401
debug.h
Go to the documentation of this file.
00001 /* debug.h -- Describe generic debugging information.
00002    Copyright 1995, 1996, 2002, 2003 Free Software Foundation, Inc.
00003    Written by Ian Lance Taylor <ian@cygnus.com>.
00004 
00005    This file is part of GNU Binutils.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software
00019    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
00020    02110-1301, USA.  */
00021 
00022 #ifndef DEBUG_H
00023 #define DEBUG_H
00024 
00025 /* This header file describes a generic debugging information format.
00026    We may eventually have readers which convert different formats into
00027    this generic format, and writers which write it out.  The initial
00028    impetus for this was writing a converter from stabs to HP IEEE-695
00029    debugging format.  */
00030 
00031 /* Different kinds of types.  */
00032 
00033 enum debug_type_kind
00034 {
00035   /* Not used.  */
00036   DEBUG_KIND_ILLEGAL,
00037   /* Indirect via a pointer.  */
00038   DEBUG_KIND_INDIRECT,
00039   /* Void.  */
00040   DEBUG_KIND_VOID,
00041   /* Integer.  */
00042   DEBUG_KIND_INT,
00043   /* Floating point.  */
00044   DEBUG_KIND_FLOAT,
00045   /* Complex.  */
00046   DEBUG_KIND_COMPLEX,
00047   /* Boolean.  */
00048   DEBUG_KIND_BOOL,
00049   /* Struct.  */
00050   DEBUG_KIND_STRUCT,
00051   /* Union.  */
00052   DEBUG_KIND_UNION,
00053   /* Class.  */
00054   DEBUG_KIND_CLASS,
00055   /* Union class (can this really happen?).  */
00056   DEBUG_KIND_UNION_CLASS,
00057   /* Enumeration type.  */
00058   DEBUG_KIND_ENUM,
00059   /* Pointer.  */
00060   DEBUG_KIND_POINTER,
00061   /* Function.  */
00062   DEBUG_KIND_FUNCTION,
00063   /* Reference.  */
00064   DEBUG_KIND_REFERENCE,
00065   /* Range.  */
00066   DEBUG_KIND_RANGE,
00067   /* Array.  */
00068   DEBUG_KIND_ARRAY,
00069   /* Set.  */
00070   DEBUG_KIND_SET,
00071   /* Based pointer.  */
00072   DEBUG_KIND_OFFSET,
00073   /* Method.  */
00074   DEBUG_KIND_METHOD,
00075   /* Const qualified type.  */
00076   DEBUG_KIND_CONST,
00077   /* Volatile qualified type.  */
00078   DEBUG_KIND_VOLATILE,
00079   /* Named type.  */
00080   DEBUG_KIND_NAMED,
00081   /* Tagged type.  */
00082   DEBUG_KIND_TAGGED
00083 };
00084 
00085 /* Different kinds of variables.  */
00086 
00087 enum debug_var_kind
00088 {
00089   /* Not used.  */
00090   DEBUG_VAR_ILLEGAL,
00091   /* A global variable.  */
00092   DEBUG_GLOBAL,
00093   /* A static variable.  */
00094   DEBUG_STATIC,
00095   /* A local static variable.  */
00096   DEBUG_LOCAL_STATIC,
00097   /* A local variable.  */
00098   DEBUG_LOCAL,
00099   /* A register variable.  */
00100   DEBUG_REGISTER
00101 };
00102 
00103 /* Different kinds of function parameters.  */
00104 
00105 enum debug_parm_kind
00106 {
00107   /* Not used.  */
00108   DEBUG_PARM_ILLEGAL,
00109   /* A stack based parameter.  */
00110   DEBUG_PARM_STACK,
00111   /* A register parameter.  */
00112   DEBUG_PARM_REG,
00113   /* A stack based reference parameter.  */
00114   DEBUG_PARM_REFERENCE,
00115   /* A register reference parameter.  */
00116   DEBUG_PARM_REF_REG
00117 };
00118 
00119 /* Different kinds of visibility.  */
00120 
00121 enum debug_visibility
00122 {
00123   /* A public field (e.g., a field in a C struct).  */
00124   DEBUG_VISIBILITY_PUBLIC,
00125   /* A protected field.  */
00126   DEBUG_VISIBILITY_PROTECTED,
00127   /* A private field.  */
00128   DEBUG_VISIBILITY_PRIVATE,
00129   /* A field which should be ignored.  */
00130   DEBUG_VISIBILITY_IGNORE
00131 };
00132 
00133 /* A type.  */
00134 
00135 typedef struct debug_type *debug_type;
00136 
00137 #define DEBUG_TYPE_NULL ((debug_type) NULL)
00138 
00139 /* A field in a struct or union.  */
00140 
00141 typedef struct debug_field *debug_field;
00142 
00143 #define DEBUG_FIELD_NULL ((debug_field) NULL)
00144 
00145 /* A base class for an object.  */
00146 
00147 typedef struct debug_baseclass *debug_baseclass;
00148 
00149 #define DEBUG_BASECLASS_NULL ((debug_baseclass) NULL)
00150 
00151 /* A method of an object.  */
00152 
00153 typedef struct debug_method *debug_method;
00154 
00155 #define DEBUG_METHOD_NULL ((debug_method) NULL)
00156 
00157 /* The arguments to a method function of an object.  These indicate
00158    which method to run.  */
00159 
00160 typedef struct debug_method_variant *debug_method_variant;
00161 
00162 #define DEBUG_METHOD_VARIANT_NULL ((debug_method_variant) NULL)
00163 
00164 /* This structure is passed to debug_write.  It holds function
00165    pointers that debug_write will call based on the accumulated
00166    debugging information.  */
00167 
00168 struct debug_write_fns
00169 {
00170   /* This is called at the start of each new compilation unit with the
00171      name of the main file in the new unit.  */
00172   bfd_boolean (*start_compilation_unit) (void *, const char *);
00173 
00174   /* This is called at the start of each source file within a
00175      compilation unit, before outputting any global information for
00176      that file.  The argument is the name of the file.  */
00177   bfd_boolean (*start_source) (void *, const char *);
00178 
00179   /* Each writer must keep a stack of types.  */
00180 
00181   /* Push an empty type onto the type stack.  This type can appear if
00182      there is a reference to a type which is never defined.  */
00183   bfd_boolean (*empty_type) (void *);
00184 
00185   /* Push a void type onto the type stack.  */
00186   bfd_boolean (*void_type) (void *);
00187 
00188   /* Push an integer type onto the type stack, given the size and
00189      whether it is unsigned.  */
00190   bfd_boolean (*int_type) (void *, unsigned int, bfd_boolean);
00191 
00192   /* Push a floating type onto the type stack, given the size.  */
00193   bfd_boolean (*float_type) (void *, unsigned int);
00194 
00195   /* Push a complex type onto the type stack, given the size.  */
00196   bfd_boolean (*complex_type) (void *, unsigned int);
00197 
00198   /* Push a bfd_boolean type onto the type stack, given the size.  */
00199   bfd_boolean (*bool_type) (void *, unsigned int);
00200 
00201   /* Push an enum type onto the type stack, given the tag, a NULL
00202      terminated array of names and the associated values.  If there is
00203      no tag, the tag argument will be NULL.  If this is an undefined
00204      enum, the names and values arguments will be NULL.  */
00205   bfd_boolean (*enum_type)
00206     (void *, const char *, const char **, bfd_signed_vma *);
00207 
00208   /* Pop the top type on the type stack, and push a pointer to that
00209      type onto the type stack.  */
00210   bfd_boolean (*pointer_type) (void *);
00211 
00212   /* Push a function type onto the type stack.  The second argument
00213      indicates the number of argument types that have been pushed onto
00214      the stack.  If the number of argument types is passed as -1, then
00215      the argument types of the function are unknown, and no types have
00216      been pushed onto the stack.  The third argument is TRUE if the
00217      function takes a variable number of arguments.  The return type
00218      of the function is pushed onto the type stack below the argument
00219      types, if any.  */
00220   bfd_boolean (*function_type) (void *, int, bfd_boolean);
00221 
00222   /* Pop the top type on the type stack, and push a reference to that
00223      type onto the type stack.  */
00224   bfd_boolean (*reference_type) (void *);
00225 
00226   /* Pop the top type on the type stack, and push a range of that type
00227      with the given lower and upper bounds onto the type stack.  */
00228   bfd_boolean (*range_type) (void *, bfd_signed_vma, bfd_signed_vma);
00229 
00230   /* Push an array type onto the type stack.  The top type on the type
00231      stack is the range, and the next type on the type stack is the
00232      element type.  These should be popped before the array type is
00233      pushed.  The arguments are the lower bound, the upper bound, and
00234      whether the array is a string.  */
00235   bfd_boolean (*array_type)
00236     (void *, bfd_signed_vma, bfd_signed_vma, bfd_boolean);
00237 
00238   /* Pop the top type on the type stack, and push a set of that type
00239      onto the type stack.  The argument indicates whether this set is
00240      a bitstring.  */
00241   bfd_boolean (*set_type) (void *, bfd_boolean);
00242 
00243   /* Push an offset type onto the type stack.  The top type on the
00244      type stack is the target type, and the next type on the type
00245      stack is the base type.  These should be popped before the offset
00246      type is pushed.  */
00247   bfd_boolean (*offset_type) (void *);
00248 
00249   /* Push a method type onto the type stack.  If the second argument
00250      is TRUE, the top type on the stack is the class to which the
00251      method belongs; otherwise, the class must be determined by the
00252      class to which the method is attached.  The third argument is the
00253      number of argument types; these are pushed onto the type stack in
00254      reverse order (the first type popped is the last argument to the
00255      method).  A value of -1 for the third argument means that no
00256      argument information is available.  The fourth argument is TRUE
00257      if the function takes a variable number of arguments.  The next
00258      type on the type stack below the domain and the argument types is
00259      the return type of the method.  All these types must be popped,
00260      and then the method type must be pushed.  */
00261   bfd_boolean (*method_type) (void *, bfd_boolean, int, bfd_boolean);
00262 
00263   /* Pop the top type off the type stack, and push a const qualified
00264      version of that type onto the type stack.  */
00265   bfd_boolean (*const_type) (void *);
00266 
00267   /* Pop the top type off the type stack, and push a volatile
00268      qualified version of that type onto the type stack.  */
00269   bfd_boolean (*volatile_type) (void *);
00270 
00271   /* Start building a struct.  This is followed by calls to the
00272      struct_field function, and finished by a call to the
00273      end_struct_type function.  The second argument is the tag; this
00274      will be NULL if there isn't one.  If the second argument is NULL,
00275      the third argument is a constant identifying this struct for use
00276      with tag_type.  The fourth argument is TRUE for a struct, FALSE
00277      for a union.  The fifth argument is the size.  If this is an
00278      undefined struct or union, the size will be 0 and struct_field
00279      will not be called before end_struct_type is called.  */
00280   bfd_boolean (*start_struct_type)
00281     (void *, const char *, unsigned int, bfd_boolean, unsigned int);
00282 
00283   /* Add a field to the struct type currently being built.  The type
00284      of the field should be popped off the type stack.  The arguments
00285      are the name, the bit position, the bit size (may be zero if the
00286      field is not packed), and the visibility.  */
00287   bfd_boolean (*struct_field)
00288     (void *, const char *, bfd_vma, bfd_vma, enum debug_visibility);
00289 
00290   /* Finish building a struct, and push it onto the type stack.  */
00291   bfd_boolean (*end_struct_type) (void *);
00292 
00293   /* Start building a class.  This is followed by calls to several
00294      functions: struct_field, class_static_member, class_baseclass,
00295      class_start_method, class_method_variant,
00296      class_static_method_variant, and class_end_method.  The class is
00297      finished by a call to end_class_type.  The first five arguments
00298      are the same as for start_struct_type.  The sixth argument is
00299      TRUE if there is a virtual function table; if there is, the
00300      seventh argument is TRUE if the virtual function table can be
00301      found in the type itself, and is FALSE if the type of the object
00302      holding the virtual function table should be popped from the type
00303      stack.  */
00304   bfd_boolean (*start_class_type)
00305     (void *, const char *, unsigned int, bfd_boolean, unsigned int,
00306      bfd_boolean, bfd_boolean);
00307 
00308   /* Add a static member to the class currently being built.  The
00309      arguments are the field name, the physical name, and the
00310      visibility.  The type must be popped off the type stack.  */
00311   bfd_boolean (*class_static_member)
00312     (void *, const char *, const char *, enum debug_visibility);
00313 
00314   /* Add a baseclass to the class currently being built.  The type of
00315      the baseclass must be popped off the type stack.  The arguments
00316      are the bit position, whether the class is virtual, and the
00317      visibility.  */
00318   bfd_boolean (*class_baseclass)
00319     (void *, bfd_vma, bfd_boolean, enum debug_visibility);
00320 
00321   /* Start adding a method to the class currently being built.  This
00322      is followed by calls to class_method_variant and
00323      class_static_method_variant to describe different variants of the
00324      method which take different arguments.  The method is finished
00325      with a call to class_end_method.  The argument is the method
00326      name.  */
00327   bfd_boolean (*class_start_method) (void *, const char *);
00328 
00329   /* Describe a variant to the class method currently being built.
00330      The type of the variant must be popped off the type stack.  The
00331      second argument is the physical name of the function.  The
00332      following arguments are the visibility, whether the variant is
00333      const, whether the variant is volatile, the offset in the virtual
00334      function table, and whether the context is on the type stack
00335      (below the variant type).  */
00336   bfd_boolean (*class_method_variant)
00337     (void *, const char *, enum debug_visibility, bfd_boolean,
00338      bfd_boolean, bfd_vma, bfd_boolean);
00339 
00340   /* Describe a static variant to the class method currently being
00341      built.  The arguments are the same as for class_method_variant,
00342      except that the last two arguments are omitted.  The type of the
00343      variant must be popped off the type stack.  */
00344   bfd_boolean (*class_static_method_variant)
00345     (void *, const char *, enum debug_visibility, bfd_boolean,
00346      bfd_boolean);
00347 
00348   /* Finish describing a class method.  */
00349   bfd_boolean (*class_end_method) (void *);
00350 
00351   /* Finish describing a class, and push it onto the type stack.  */
00352   bfd_boolean (*end_class_type) (void *);
00353 
00354   /* Push a type on the stack which was given a name by an earlier
00355      call to typdef.  */
00356   bfd_boolean (*typedef_type) (void *, const char *);
00357 
00358   /* Push a tagged type on the stack which was defined earlier.  If
00359      the second argument is not NULL, the type was defined by a call
00360      to tag.  If the second argument is NULL, the type was defined by
00361      a call to start_struct_type or start_class_type with a tag of
00362      NULL and the number of the third argument.  Either way, the
00363      fourth argument is the tag kind.  Note that this may be called
00364      for a struct (class) being defined, in between the call to
00365      start_struct_type (start_class_type) and the call to
00366      end_struct_type (end_class_type).  */
00367   bfd_boolean (*tag_type)
00368     (void *, const char *, unsigned int, enum debug_type_kind);
00369 
00370   /* Pop the type stack, and typedef it to the given name.  */
00371   bfd_boolean (*typdef) (void *, const char *);
00372 
00373   /* Pop the type stack, and declare it as a tagged struct or union or
00374      enum or whatever.  The tag passed down here is redundant, since
00375      was also passed when enum_type, start_struct_type, or
00376      start_class_type was called.  */
00377   bfd_boolean (*tag) (void *, const char *);
00378 
00379   /* This is called to record a named integer constant.  */
00380   bfd_boolean (*int_constant) (void *, const char *, bfd_vma);
00381 
00382   /* This is called to record a named floating point constant.  */
00383   bfd_boolean (*float_constant) (void *, const char *, double);
00384 
00385   /* This is called to record a typed integer constant.  The type is
00386      popped off the type stack.  */
00387   bfd_boolean (*typed_constant) (void *, const char *, bfd_vma);
00388 
00389   /* This is called to record a variable.  The type is popped off the
00390      type stack.  */
00391   bfd_boolean (*variable)
00392     (void *, const char *, enum debug_var_kind, bfd_vma);
00393 
00394   /* Start writing out a function.  The return type must be popped off
00395      the stack.  The bfd_boolean is TRUE if the function is global.  This
00396      is followed by calls to function_parameter, followed by block
00397      information.  */
00398   bfd_boolean (*start_function) (void *, const char *, bfd_boolean);
00399 
00400   /* Record a function parameter for the current function.  The type
00401      must be popped off the stack.  */
00402   bfd_boolean (*function_parameter)
00403     (void *, const char *, enum debug_parm_kind, bfd_vma);
00404 
00405   /* Start writing out a block.  There is at least one top level block
00406      per function.  Blocks may be nested.  The argument is the
00407      starting address of the block.  */
00408   bfd_boolean (*start_block) (void *, bfd_vma);
00409 
00410   /* Finish writing out a block.  The argument is the ending address
00411      of the block.  */
00412   bfd_boolean (*end_block) (void *, bfd_vma);
00413 
00414   /* Finish writing out a function.  */
00415   bfd_boolean (*end_function) (void *);
00416 
00417   /* Record line number information for the current compilation unit.  */
00418   bfd_boolean (*lineno) (void *, const char *, unsigned long, bfd_vma);
00419 };
00420 
00421 /* Exported functions.  */
00422 
00423 /* The first argument to most of these functions is a handle.  This
00424    handle is returned by the debug_init function.  The purpose of the
00425    handle is to permit the debugging routines to not use static
00426    variables, and hence to be reentrant.  This would be useful for a
00427    program which wanted to handle two executables simultaneously.  */
00428 
00429 /* Return a debugging handle.  */
00430 
00431 extern void *debug_init (void);
00432 
00433 /* Set the source filename.  This implicitly starts a new compilation
00434    unit.  */
00435 
00436 extern bfd_boolean debug_set_filename (void *, const char *);
00437 
00438 /* Change source files to the given file name.  This is used for
00439    include files in a single compilation unit.  */
00440 
00441 extern bfd_boolean debug_start_source (void *, const char *);
00442 
00443 /* Record a function definition.  This implicitly starts a function
00444    block.  The debug_type argument is the type of the return value.
00445    The bfd_boolean indicates whether the function is globally visible.
00446    The bfd_vma is the address of the start of the function.  Currently
00447    the parameter types are specified by calls to
00448    debug_record_parameter.  */
00449 
00450 extern bfd_boolean debug_record_function
00451   (void *, const char *, debug_type, bfd_boolean, bfd_vma);
00452 
00453 /* Record a parameter for the current function.  */
00454 
00455 extern bfd_boolean debug_record_parameter
00456   (void *, const char *, debug_type, enum debug_parm_kind, bfd_vma);
00457 
00458 /* End a function definition.  The argument is the address where the
00459    function ends.  */
00460 
00461 extern bfd_boolean debug_end_function (void *, bfd_vma);
00462 
00463 /* Start a block in a function.  All local information will be
00464    recorded in this block, until the matching call to debug_end_block.
00465    debug_start_block and debug_end_block may be nested.  The argument
00466    is the address at which this block starts.  */
00467 
00468 extern bfd_boolean debug_start_block (void *, bfd_vma);
00469 
00470 /* Finish a block in a function.  This matches the call to
00471    debug_start_block.  The argument is the address at which this block
00472    ends.  */
00473 
00474 extern bfd_boolean debug_end_block (void *, bfd_vma);
00475 
00476 /* Associate a line number in the current source file with a given
00477    address.  */
00478 
00479 extern bfd_boolean debug_record_line (void *, unsigned long, bfd_vma);
00480 
00481 /* Start a named common block.  This is a block of variables that may
00482    move in memory.  */
00483 
00484 extern bfd_boolean debug_start_common_block (void *, const char *);
00485 
00486 /* End a named common block.  */
00487 
00488 extern bfd_boolean debug_end_common_block (void *, const char *);
00489 
00490 /* Record a named integer constant.  */
00491 
00492 extern bfd_boolean debug_record_int_const (void *, const char *, bfd_vma);
00493 
00494 /* Record a named floating point constant.  */
00495 
00496 extern bfd_boolean debug_record_float_const (void *, const char *, double);
00497 
00498 /* Record a typed constant with an integral value.  */
00499 
00500 extern bfd_boolean debug_record_typed_const
00501   (void *, const char *, debug_type, bfd_vma);
00502 
00503 /* Record a label.  */
00504 
00505 extern bfd_boolean debug_record_label
00506   (void *, const char *, debug_type, bfd_vma);
00507 
00508 /* Record a variable.  */
00509 
00510 extern bfd_boolean debug_record_variable
00511   (void *, const char *, debug_type, enum debug_var_kind, bfd_vma);
00512 
00513 /* Make an indirect type.  The first argument is a pointer to the
00514    location where the real type will be placed.  The second argument
00515    is the type tag, if there is one; this may be NULL; the only
00516    purpose of this argument is so that debug_get_type_name can return
00517    something useful.  This function may be used when a type is
00518    referenced before it is defined.  */
00519 
00520 extern debug_type debug_make_indirect_type
00521   (void *, debug_type *, const char *);
00522 
00523 /* Make a void type.  */
00524 
00525 extern debug_type debug_make_void_type (void *);
00526 
00527 /* Make an integer type of a given size.  The bfd_boolean argument is TRUE
00528    if the integer is unsigned.  */
00529 
00530 extern debug_type debug_make_int_type (void *, unsigned int, bfd_boolean);
00531 
00532 /* Make a floating point type of a given size.  FIXME: On some
00533    platforms, like an Alpha, you probably need to be able to specify
00534    the format.  */
00535 
00536 extern debug_type debug_make_float_type (void *, unsigned int);
00537 
00538 /* Make a boolean type of a given size.  */
00539 
00540 extern debug_type debug_make_bool_type (void *, unsigned int);
00541 
00542 /* Make a complex type of a given size.  */
00543 
00544 extern debug_type debug_make_complex_type (void *, unsigned int);
00545 
00546 /* Make a structure type.  The second argument is TRUE for a struct,
00547    FALSE for a union.  The third argument is the size of the struct.
00548    The fourth argument is a NULL terminated array of fields.  */
00549 
00550 extern debug_type debug_make_struct_type
00551   (void *, bfd_boolean, bfd_vma, debug_field *);
00552 
00553 /* Make an object type.  The first three arguments after the handle
00554    are the same as for debug_make_struct_type.  The next arguments are
00555    a NULL terminated array of base classes, a NULL terminated array of
00556    methods, the type of the object holding the virtual function table
00557    if it is not this object, and a bfd_boolean which is TRUE if this
00558    object has its own virtual function table.  */
00559 
00560 extern debug_type debug_make_object_type
00561   (void *, bfd_boolean, bfd_vma, debug_field *, debug_baseclass *,
00562    debug_method *, debug_type, bfd_boolean);
00563 
00564 /* Make an enumeration type.  The arguments are a null terminated
00565    array of strings, and an array of corresponding values.  */
00566 
00567 extern debug_type debug_make_enum_type
00568   (void *, const char **, bfd_signed_vma *);
00569 
00570 /* Make a pointer to a given type.  */
00571 
00572 extern debug_type debug_make_pointer_type (void *, debug_type);
00573 
00574 /* Make a function type.  The second argument is the return type.  The
00575    third argument is a NULL terminated array of argument types.  The
00576    fourth argument is TRUE if the function takes a variable number of
00577    arguments.  If the third argument is NULL, then the argument types
00578    are unknown.  */
00579 
00580 extern debug_type debug_make_function_type
00581   (void *, debug_type, debug_type *, bfd_boolean);
00582 
00583 /* Make a reference to a given type.  */
00584 
00585 extern debug_type debug_make_reference_type (void *, debug_type);
00586 
00587 /* Make a range of a given type from a lower to an upper bound.  */
00588 
00589 extern debug_type debug_make_range_type
00590   (void *, debug_type, bfd_signed_vma, bfd_signed_vma);
00591 
00592 /* Make an array type.  The second argument is the type of an element
00593    of the array.  The third argument is the type of a range of the
00594    array.  The fourth and fifth argument are the lower and upper
00595    bounds, respectively (if the bounds are not known, lower should be
00596    0 and upper should be -1).  The sixth argument is TRUE if this
00597    array is actually a string, as in C.  */
00598 
00599 extern debug_type debug_make_array_type
00600   (void *, debug_type, debug_type, bfd_signed_vma, bfd_signed_vma,
00601    bfd_boolean);
00602 
00603 /* Make a set of a given type.  For example, a Pascal set type.  The
00604    bfd_boolean argument is TRUE if this set is actually a bitstring, as in
00605    CHILL.  */
00606 
00607 extern debug_type debug_make_set_type (void *, debug_type, bfd_boolean);
00608 
00609 /* Make a type for a pointer which is relative to an object.  The
00610    second argument is the type of the object to which the pointer is
00611    relative.  The third argument is the type that the pointer points
00612    to.  */
00613 
00614 extern debug_type debug_make_offset_type (void *, debug_type, debug_type);
00615 
00616 /* Make a type for a method function.  The second argument is the
00617    return type.  The third argument is the domain.  The fourth
00618    argument is a NULL terminated array of argument types.  The fifth
00619    argument is TRUE if the function takes a variable number of
00620    arguments, in which case the array of argument types indicates the
00621    types of the first arguments.  The domain and the argument array
00622    may be NULL, in which case this is a stub method and that
00623    information is not available.  Stabs debugging uses this, and gets
00624    the argument types from the mangled name.  */
00625 
00626 extern debug_type debug_make_method_type
00627   (void *, debug_type, debug_type, debug_type *, bfd_boolean);
00628 
00629 /* Make a const qualified version of a given type.  */
00630 
00631 extern debug_type debug_make_const_type (void *, debug_type);
00632 
00633 /* Make a volatile qualified version of a given type.  */
00634 
00635 extern debug_type debug_make_volatile_type (void *, debug_type);
00636 
00637 /* Make an undefined tagged type.  For example, a struct which has
00638    been mentioned, but not defined.  */
00639 
00640 extern debug_type debug_make_undefined_tagged_type
00641   (void *, const char *, enum debug_type_kind);
00642 
00643 /* Make a base class for an object.  The second argument is the base
00644    class type.  The third argument is the bit position of this base
00645    class in the object.  The fourth argument is whether this is a
00646    virtual class.  The fifth argument is the visibility of the base
00647    class.  */
00648 
00649 extern debug_baseclass debug_make_baseclass
00650   (void *, debug_type, bfd_vma, bfd_boolean, enum debug_visibility);
00651 
00652 /* Make a field for a struct.  The second argument is the name.  The
00653    third argument is the type of the field.  The fourth argument is
00654    the bit position of the field.  The fifth argument is the size of
00655    the field (it may be zero).  The sixth argument is the visibility
00656    of the field.  */
00657 
00658 extern debug_field debug_make_field
00659   (void *, const char *, debug_type, bfd_vma, bfd_vma, enum debug_visibility);
00660 
00661 /* Make a static member of an object.  The second argument is the
00662    name.  The third argument is the type of the member.  The fourth
00663    argument is the physical name of the member (i.e., the name as a
00664    global variable).  The fifth argument is the visibility of the
00665    member.  */
00666 
00667 extern debug_field debug_make_static_member
00668   (void *, const char *, debug_type, const char *, enum debug_visibility);
00669 
00670 /* Make a method.  The second argument is the name, and the third
00671    argument is a NULL terminated array of method variants.  Each
00672    method variant is a method with this name but with different
00673    argument types.  */
00674 
00675 extern debug_method debug_make_method
00676   (void *, const char *, debug_method_variant *);
00677 
00678 /* Make a method variant.  The second argument is the physical name of
00679    the function.  The third argument is the type of the function,
00680    probably constructed by debug_make_method_type.  The fourth
00681    argument is the visibility.  The fifth argument is whether this is
00682    a const function.  The sixth argument is whether this is a volatile
00683    function.  The seventh argument is the index in the virtual
00684    function table, if any.  The eighth argument is the virtual
00685    function context.  */
00686 
00687 extern debug_method_variant debug_make_method_variant
00688   (void *, const char *, debug_type, enum debug_visibility, bfd_boolean,
00689    bfd_boolean, bfd_vma, debug_type);
00690 
00691 /* Make a static method argument.  The arguments are the same as for
00692    debug_make_method_variant, except that the last two are omitted
00693    since a static method can not also be virtual.  */
00694 
00695 extern debug_method_variant debug_make_static_method_variant
00696   (void *, const char *, debug_type, enum debug_visibility, bfd_boolean,
00697    bfd_boolean);
00698 
00699 /* Name a type.  This returns a new type with an attached name.  */
00700 
00701 extern debug_type debug_name_type (void *, const char *, debug_type);
00702 
00703 /* Give a tag to a type, such as a struct or union.  This returns a
00704    new type with an attached tag.  */
00705 
00706 extern debug_type debug_tag_type (void *, const char *, debug_type);
00707 
00708 /* Record the size of a given type.  */
00709 
00710 extern bfd_boolean debug_record_type_size (void *, debug_type, unsigned int);
00711 
00712 /* Find a named type.  */
00713 
00714 extern debug_type debug_find_named_type (void *, const char *);
00715 
00716 /* Find a tagged type.  */
00717 
00718 extern debug_type debug_find_tagged_type
00719   (void *, const char *, enum debug_type_kind);
00720 
00721 /* Get the kind of a type.  */
00722 
00723 extern enum debug_type_kind debug_get_type_kind (void *, debug_type);
00724 
00725 /* Get the name of a type.  */
00726 
00727 extern const char *debug_get_type_name (void *, debug_type);
00728 
00729 /* Get the size of a type.  */
00730 
00731 extern bfd_vma debug_get_type_size (void *, debug_type);
00732 
00733 /* Get the return type of a function or method type.  */
00734 
00735 extern debug_type debug_get_return_type (void *, debug_type);
00736 
00737 /* Get the NULL terminated array of parameter types for a function or
00738    method type (actually, parameter types are not currently stored for
00739    function types).  This may be used to determine whether a method
00740    type is a stub method or not.  The last argument points to a
00741    bfd_boolean which is set to TRUE if the function takes a variable
00742    number of arguments.  */
00743 
00744 extern const debug_type *debug_get_parameter_types
00745   (void *, debug_type, bfd_boolean *);
00746 
00747 /* Get the target type of a pointer or reference or const or volatile
00748    type.  */
00749 
00750 extern debug_type debug_get_target_type (void *, debug_type);
00751 
00752 /* Get the NULL terminated array of fields for a struct, union, or
00753    class.  */
00754 
00755 extern const debug_field *debug_get_fields (void *, debug_type);
00756 
00757 /* Get the type of a field.  */
00758 
00759 extern debug_type debug_get_field_type (void *, debug_field);
00760 
00761 /* Get the name of a field.  */
00762 
00763 extern const char *debug_get_field_name (void *, debug_field);
00764 
00765 /* Get the bit position of a field within the containing structure.
00766    If the field is a static member, this will return (bfd_vma) -1.  */
00767 
00768 extern bfd_vma debug_get_field_bitpos (void *, debug_field);
00769 
00770 /* Get the bit size of a field.  If the field is a static member, this
00771    will return (bfd_vma) -1.  */
00772 
00773 extern bfd_vma debug_get_field_bitsize (void *, debug_field);
00774 
00775 /* Get the visibility of a field.  */
00776 
00777 extern enum debug_visibility debug_get_field_visibility (void *, debug_field);
00778 
00779 /* Get the physical name of a field, if it is a static member.  If the
00780    field is not a static member, this will return NULL.  */
00781 
00782 extern const char *debug_get_field_physname (void *, debug_field);
00783 
00784 /* Write out the recorded debugging information.  This takes a set of
00785    function pointers which are called to do the actual writing.  The
00786    first void * is the debugging handle.  The second void * is a handle
00787    which is passed to the functions.  */
00788 
00789 extern bfd_boolean debug_write
00790   (void *, const struct debug_write_fns *, void *);
00791 
00792 #endif /* DEBUG_H */