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