133965Sjdp/* debug.h -- Describe generic debugging information. 2130561Sobrien Copyright 1995, 1996, 2002, 2003 Free Software Foundation, Inc. 333965Sjdp Written by Ian Lance Taylor <ian@cygnus.com>. 433965Sjdp 533965Sjdp This file is part of GNU Binutils. 633965Sjdp 733965Sjdp This program is free software; you can redistribute it and/or modify 833965Sjdp it under the terms of the GNU General Public License as published by 933965Sjdp the Free Software Foundation; either version 2 of the License, or 1033965Sjdp (at your option) any later version. 1133965Sjdp 1233965Sjdp This program is distributed in the hope that it will be useful, 1333965Sjdp but WITHOUT ANY WARRANTY; without even the implied warranty of 1433965Sjdp MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1533965Sjdp GNU General Public License for more details. 1633965Sjdp 1733965Sjdp You should have received a copy of the GNU General Public License 1833965Sjdp along with this program; if not, write to the Free Software 19218822Sdim Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 20218822Sdim 02110-1301, USA. */ 2133965Sjdp 2233965Sjdp#ifndef DEBUG_H 2333965Sjdp#define DEBUG_H 2433965Sjdp 2533965Sjdp/* This header file describes a generic debugging information format. 2633965Sjdp We may eventually have readers which convert different formats into 2733965Sjdp this generic format, and writers which write it out. The initial 28130561Sobrien impetus for this was writing a converter from stabs to HP IEEE-695 2933965Sjdp debugging format. */ 3033965Sjdp 3133965Sjdp/* Different kinds of types. */ 3233965Sjdp 3333965Sjdpenum debug_type_kind 3433965Sjdp{ 3533965Sjdp /* Not used. */ 3633965Sjdp DEBUG_KIND_ILLEGAL, 3733965Sjdp /* Indirect via a pointer. */ 3833965Sjdp DEBUG_KIND_INDIRECT, 3933965Sjdp /* Void. */ 4033965Sjdp DEBUG_KIND_VOID, 4133965Sjdp /* Integer. */ 4233965Sjdp DEBUG_KIND_INT, 4333965Sjdp /* Floating point. */ 4433965Sjdp DEBUG_KIND_FLOAT, 4533965Sjdp /* Complex. */ 4633965Sjdp DEBUG_KIND_COMPLEX, 4733965Sjdp /* Boolean. */ 4833965Sjdp DEBUG_KIND_BOOL, 4933965Sjdp /* Struct. */ 5033965Sjdp DEBUG_KIND_STRUCT, 5133965Sjdp /* Union. */ 5233965Sjdp DEBUG_KIND_UNION, 5333965Sjdp /* Class. */ 5433965Sjdp DEBUG_KIND_CLASS, 5533965Sjdp /* Union class (can this really happen?). */ 5633965Sjdp DEBUG_KIND_UNION_CLASS, 5733965Sjdp /* Enumeration type. */ 5833965Sjdp DEBUG_KIND_ENUM, 5933965Sjdp /* Pointer. */ 6033965Sjdp DEBUG_KIND_POINTER, 6133965Sjdp /* Function. */ 6233965Sjdp DEBUG_KIND_FUNCTION, 6333965Sjdp /* Reference. */ 6433965Sjdp DEBUG_KIND_REFERENCE, 6533965Sjdp /* Range. */ 6633965Sjdp DEBUG_KIND_RANGE, 6733965Sjdp /* Array. */ 6833965Sjdp DEBUG_KIND_ARRAY, 6933965Sjdp /* Set. */ 7033965Sjdp DEBUG_KIND_SET, 7133965Sjdp /* Based pointer. */ 7233965Sjdp DEBUG_KIND_OFFSET, 7333965Sjdp /* Method. */ 7433965Sjdp DEBUG_KIND_METHOD, 7533965Sjdp /* Const qualified type. */ 7633965Sjdp DEBUG_KIND_CONST, 7733965Sjdp /* Volatile qualified type. */ 7833965Sjdp DEBUG_KIND_VOLATILE, 7933965Sjdp /* Named type. */ 8033965Sjdp DEBUG_KIND_NAMED, 8133965Sjdp /* Tagged type. */ 8233965Sjdp DEBUG_KIND_TAGGED 8333965Sjdp}; 8433965Sjdp 8533965Sjdp/* Different kinds of variables. */ 8633965Sjdp 8733965Sjdpenum debug_var_kind 8833965Sjdp{ 8933965Sjdp /* Not used. */ 9033965Sjdp DEBUG_VAR_ILLEGAL, 9133965Sjdp /* A global variable. */ 9233965Sjdp DEBUG_GLOBAL, 9333965Sjdp /* A static variable. */ 9433965Sjdp DEBUG_STATIC, 9533965Sjdp /* A local static variable. */ 9633965Sjdp DEBUG_LOCAL_STATIC, 9733965Sjdp /* A local variable. */ 9833965Sjdp DEBUG_LOCAL, 9933965Sjdp /* A register variable. */ 10033965Sjdp DEBUG_REGISTER 10133965Sjdp}; 10233965Sjdp 10333965Sjdp/* Different kinds of function parameters. */ 10433965Sjdp 10533965Sjdpenum debug_parm_kind 10633965Sjdp{ 10733965Sjdp /* Not used. */ 10833965Sjdp DEBUG_PARM_ILLEGAL, 10933965Sjdp /* A stack based parameter. */ 11033965Sjdp DEBUG_PARM_STACK, 11133965Sjdp /* A register parameter. */ 11233965Sjdp DEBUG_PARM_REG, 11333965Sjdp /* A stack based reference parameter. */ 11433965Sjdp DEBUG_PARM_REFERENCE, 11533965Sjdp /* A register reference parameter. */ 11633965Sjdp DEBUG_PARM_REF_REG 11733965Sjdp}; 11833965Sjdp 11933965Sjdp/* Different kinds of visibility. */ 12033965Sjdp 12133965Sjdpenum debug_visibility 12233965Sjdp{ 12333965Sjdp /* A public field (e.g., a field in a C struct). */ 12433965Sjdp DEBUG_VISIBILITY_PUBLIC, 12533965Sjdp /* A protected field. */ 12633965Sjdp DEBUG_VISIBILITY_PROTECTED, 12733965Sjdp /* A private field. */ 12833965Sjdp DEBUG_VISIBILITY_PRIVATE, 12933965Sjdp /* A field which should be ignored. */ 13033965Sjdp DEBUG_VISIBILITY_IGNORE 13133965Sjdp}; 13233965Sjdp 13333965Sjdp/* A type. */ 13433965Sjdp 13533965Sjdptypedef struct debug_type *debug_type; 13633965Sjdp 13733965Sjdp#define DEBUG_TYPE_NULL ((debug_type) NULL) 13833965Sjdp 13933965Sjdp/* A field in a struct or union. */ 14033965Sjdp 14133965Sjdptypedef struct debug_field *debug_field; 14233965Sjdp 14333965Sjdp#define DEBUG_FIELD_NULL ((debug_field) NULL) 14433965Sjdp 14533965Sjdp/* A base class for an object. */ 14633965Sjdp 14733965Sjdptypedef struct debug_baseclass *debug_baseclass; 14833965Sjdp 14933965Sjdp#define DEBUG_BASECLASS_NULL ((debug_baseclass) NULL) 15033965Sjdp 15133965Sjdp/* A method of an object. */ 15233965Sjdp 15333965Sjdptypedef struct debug_method *debug_method; 15433965Sjdp 15533965Sjdp#define DEBUG_METHOD_NULL ((debug_method) NULL) 15633965Sjdp 15733965Sjdp/* The arguments to a method function of an object. These indicate 15833965Sjdp which method to run. */ 15933965Sjdp 16033965Sjdptypedef struct debug_method_variant *debug_method_variant; 16133965Sjdp 16233965Sjdp#define DEBUG_METHOD_VARIANT_NULL ((debug_method_variant) NULL) 16333965Sjdp 16433965Sjdp/* This structure is passed to debug_write. It holds function 16533965Sjdp pointers that debug_write will call based on the accumulated 16633965Sjdp debugging information. */ 16733965Sjdp 16833965Sjdpstruct debug_write_fns 16933965Sjdp{ 17033965Sjdp /* This is called at the start of each new compilation unit with the 17133965Sjdp name of the main file in the new unit. */ 172130561Sobrien bfd_boolean (*start_compilation_unit) (void *, const char *); 17333965Sjdp 17433965Sjdp /* This is called at the start of each source file within a 17533965Sjdp compilation unit, before outputting any global information for 17633965Sjdp that file. The argument is the name of the file. */ 177130561Sobrien bfd_boolean (*start_source) (void *, const char *); 17833965Sjdp 17933965Sjdp /* Each writer must keep a stack of types. */ 18033965Sjdp 18133965Sjdp /* Push an empty type onto the type stack. This type can appear if 18233965Sjdp there is a reference to a type which is never defined. */ 183130561Sobrien bfd_boolean (*empty_type) (void *); 18433965Sjdp 18533965Sjdp /* Push a void type onto the type stack. */ 186130561Sobrien bfd_boolean (*void_type) (void *); 18733965Sjdp 18833965Sjdp /* Push an integer type onto the type stack, given the size and 18933965Sjdp whether it is unsigned. */ 190130561Sobrien bfd_boolean (*int_type) (void *, unsigned int, bfd_boolean); 19133965Sjdp 19233965Sjdp /* Push a floating type onto the type stack, given the size. */ 193130561Sobrien bfd_boolean (*float_type) (void *, unsigned int); 19433965Sjdp 19533965Sjdp /* Push a complex type onto the type stack, given the size. */ 196130561Sobrien bfd_boolean (*complex_type) (void *, unsigned int); 19733965Sjdp 198130561Sobrien /* Push a bfd_boolean type onto the type stack, given the size. */ 199130561Sobrien bfd_boolean (*bool_type) (void *, unsigned int); 20033965Sjdp 20133965Sjdp /* Push an enum type onto the type stack, given the tag, a NULL 20233965Sjdp terminated array of names and the associated values. If there is 20333965Sjdp no tag, the tag argument will be NULL. If this is an undefined 20433965Sjdp enum, the names and values arguments will be NULL. */ 205130561Sobrien bfd_boolean (*enum_type) 206130561Sobrien (void *, const char *, const char **, bfd_signed_vma *); 20733965Sjdp 20833965Sjdp /* Pop the top type on the type stack, and push a pointer to that 20933965Sjdp type onto the type stack. */ 210130561Sobrien bfd_boolean (*pointer_type) (void *); 21133965Sjdp 21233965Sjdp /* Push a function type onto the type stack. The second argument 21333965Sjdp indicates the number of argument types that have been pushed onto 21433965Sjdp the stack. If the number of argument types is passed as -1, then 21533965Sjdp the argument types of the function are unknown, and no types have 216130561Sobrien been pushed onto the stack. The third argument is TRUE if the 21733965Sjdp function takes a variable number of arguments. The return type 21833965Sjdp of the function is pushed onto the type stack below the argument 21933965Sjdp types, if any. */ 220130561Sobrien bfd_boolean (*function_type) (void *, int, bfd_boolean); 22133965Sjdp 22233965Sjdp /* Pop the top type on the type stack, and push a reference to that 22333965Sjdp type onto the type stack. */ 224130561Sobrien bfd_boolean (*reference_type) (void *); 22533965Sjdp 22633965Sjdp /* Pop the top type on the type stack, and push a range of that type 22733965Sjdp with the given lower and upper bounds onto the type stack. */ 228130561Sobrien bfd_boolean (*range_type) (void *, bfd_signed_vma, bfd_signed_vma); 22933965Sjdp 23033965Sjdp /* Push an array type onto the type stack. The top type on the type 23133965Sjdp stack is the range, and the next type on the type stack is the 23233965Sjdp element type. These should be popped before the array type is 23333965Sjdp pushed. The arguments are the lower bound, the upper bound, and 23433965Sjdp whether the array is a string. */ 235130561Sobrien bfd_boolean (*array_type) 236130561Sobrien (void *, bfd_signed_vma, bfd_signed_vma, bfd_boolean); 23733965Sjdp 23833965Sjdp /* Pop the top type on the type stack, and push a set of that type 23933965Sjdp onto the type stack. The argument indicates whether this set is 24033965Sjdp a bitstring. */ 241130561Sobrien bfd_boolean (*set_type) (void *, bfd_boolean); 24233965Sjdp 24333965Sjdp /* Push an offset type onto the type stack. The top type on the 24433965Sjdp type stack is the target type, and the next type on the type 24533965Sjdp stack is the base type. These should be popped before the offset 24633965Sjdp type is pushed. */ 247130561Sobrien bfd_boolean (*offset_type) (void *); 24833965Sjdp 24933965Sjdp /* Push a method type onto the type stack. If the second argument 250130561Sobrien is TRUE, the top type on the stack is the class to which the 25133965Sjdp method belongs; otherwise, the class must be determined by the 25233965Sjdp class to which the method is attached. The third argument is the 25333965Sjdp number of argument types; these are pushed onto the type stack in 25433965Sjdp reverse order (the first type popped is the last argument to the 25533965Sjdp method). A value of -1 for the third argument means that no 256130561Sobrien argument information is available. The fourth argument is TRUE 25733965Sjdp if the function takes a variable number of arguments. The next 25833965Sjdp type on the type stack below the domain and the argument types is 25933965Sjdp the return type of the method. All these types must be popped, 26033965Sjdp and then the method type must be pushed. */ 261130561Sobrien bfd_boolean (*method_type) (void *, bfd_boolean, int, bfd_boolean); 26233965Sjdp 26333965Sjdp /* Pop the top type off the type stack, and push a const qualified 26433965Sjdp version of that type onto the type stack. */ 265130561Sobrien bfd_boolean (*const_type) (void *); 26633965Sjdp 26733965Sjdp /* Pop the top type off the type stack, and push a volatile 26833965Sjdp qualified version of that type onto the type stack. */ 269130561Sobrien bfd_boolean (*volatile_type) (void *); 27033965Sjdp 27133965Sjdp /* Start building a struct. This is followed by calls to the 27233965Sjdp struct_field function, and finished by a call to the 27333965Sjdp end_struct_type function. The second argument is the tag; this 27433965Sjdp will be NULL if there isn't one. If the second argument is NULL, 27533965Sjdp the third argument is a constant identifying this struct for use 276130561Sobrien with tag_type. The fourth argument is TRUE for a struct, FALSE 27733965Sjdp for a union. The fifth argument is the size. If this is an 27833965Sjdp undefined struct or union, the size will be 0 and struct_field 27933965Sjdp will not be called before end_struct_type is called. */ 280130561Sobrien bfd_boolean (*start_struct_type) 281130561Sobrien (void *, const char *, unsigned int, bfd_boolean, unsigned int); 28233965Sjdp 28333965Sjdp /* Add a field to the struct type currently being built. The type 28433965Sjdp of the field should be popped off the type stack. The arguments 28533965Sjdp are the name, the bit position, the bit size (may be zero if the 28633965Sjdp field is not packed), and the visibility. */ 287130561Sobrien bfd_boolean (*struct_field) 288130561Sobrien (void *, const char *, bfd_vma, bfd_vma, enum debug_visibility); 28933965Sjdp 29033965Sjdp /* Finish building a struct, and push it onto the type stack. */ 291130561Sobrien bfd_boolean (*end_struct_type) (void *); 29233965Sjdp 29333965Sjdp /* Start building a class. This is followed by calls to several 29433965Sjdp functions: struct_field, class_static_member, class_baseclass, 29533965Sjdp class_start_method, class_method_variant, 29633965Sjdp class_static_method_variant, and class_end_method. The class is 29733965Sjdp finished by a call to end_class_type. The first five arguments 29833965Sjdp are the same as for start_struct_type. The sixth argument is 299130561Sobrien TRUE if there is a virtual function table; if there is, the 300130561Sobrien seventh argument is TRUE if the virtual function table can be 301130561Sobrien found in the type itself, and is FALSE if the type of the object 30233965Sjdp holding the virtual function table should be popped from the type 30333965Sjdp stack. */ 304130561Sobrien bfd_boolean (*start_class_type) 305130561Sobrien (void *, const char *, unsigned int, bfd_boolean, unsigned int, 306130561Sobrien bfd_boolean, bfd_boolean); 30733965Sjdp 30833965Sjdp /* Add a static member to the class currently being built. The 30933965Sjdp arguments are the field name, the physical name, and the 31033965Sjdp visibility. The type must be popped off the type stack. */ 311130561Sobrien bfd_boolean (*class_static_member) 312130561Sobrien (void *, const char *, const char *, enum debug_visibility); 313104834Sobrien 31433965Sjdp /* Add a baseclass to the class currently being built. The type of 31533965Sjdp the baseclass must be popped off the type stack. The arguments 31633965Sjdp are the bit position, whether the class is virtual, and the 31733965Sjdp visibility. */ 318130561Sobrien bfd_boolean (*class_baseclass) 319130561Sobrien (void *, bfd_vma, bfd_boolean, enum debug_visibility); 32033965Sjdp 32133965Sjdp /* Start adding a method to the class currently being built. This 32233965Sjdp is followed by calls to class_method_variant and 32333965Sjdp class_static_method_variant to describe different variants of the 32433965Sjdp method which take different arguments. The method is finished 32533965Sjdp with a call to class_end_method. The argument is the method 32633965Sjdp name. */ 327130561Sobrien bfd_boolean (*class_start_method) (void *, const char *); 32833965Sjdp 32933965Sjdp /* Describe a variant to the class method currently being built. 33033965Sjdp The type of the variant must be popped off the type stack. The 33133965Sjdp second argument is the physical name of the function. The 33233965Sjdp following arguments are the visibility, whether the variant is 33333965Sjdp const, whether the variant is volatile, the offset in the virtual 33433965Sjdp function table, and whether the context is on the type stack 33533965Sjdp (below the variant type). */ 336130561Sobrien bfd_boolean (*class_method_variant) 337130561Sobrien (void *, const char *, enum debug_visibility, bfd_boolean, 338130561Sobrien bfd_boolean, bfd_vma, bfd_boolean); 33933965Sjdp 34033965Sjdp /* Describe a static variant to the class method currently being 34133965Sjdp built. The arguments are the same as for class_method_variant, 34233965Sjdp except that the last two arguments are omitted. The type of the 34333965Sjdp variant must be popped off the type stack. */ 344130561Sobrien bfd_boolean (*class_static_method_variant) 345130561Sobrien (void *, const char *, enum debug_visibility, bfd_boolean, 346130561Sobrien bfd_boolean); 34733965Sjdp 34833965Sjdp /* Finish describing a class method. */ 349130561Sobrien bfd_boolean (*class_end_method) (void *); 35033965Sjdp 35133965Sjdp /* Finish describing a class, and push it onto the type stack. */ 352130561Sobrien bfd_boolean (*end_class_type) (void *); 35333965Sjdp 35433965Sjdp /* Push a type on the stack which was given a name by an earlier 35533965Sjdp call to typdef. */ 356130561Sobrien bfd_boolean (*typedef_type) (void *, const char *); 35733965Sjdp 35833965Sjdp /* Push a tagged type on the stack which was defined earlier. If 35933965Sjdp the second argument is not NULL, the type was defined by a call 36033965Sjdp to tag. If the second argument is NULL, the type was defined by 36133965Sjdp a call to start_struct_type or start_class_type with a tag of 36233965Sjdp NULL and the number of the third argument. Either way, the 36333965Sjdp fourth argument is the tag kind. Note that this may be called 36433965Sjdp for a struct (class) being defined, in between the call to 36533965Sjdp start_struct_type (start_class_type) and the call to 36633965Sjdp end_struct_type (end_class_type). */ 367130561Sobrien bfd_boolean (*tag_type) 368130561Sobrien (void *, const char *, unsigned int, enum debug_type_kind); 36933965Sjdp 37033965Sjdp /* Pop the type stack, and typedef it to the given name. */ 371130561Sobrien bfd_boolean (*typdef) (void *, const char *); 37233965Sjdp 37333965Sjdp /* Pop the type stack, and declare it as a tagged struct or union or 37433965Sjdp enum or whatever. The tag passed down here is redundant, since 37533965Sjdp was also passed when enum_type, start_struct_type, or 37633965Sjdp start_class_type was called. */ 377130561Sobrien bfd_boolean (*tag) (void *, const char *); 37833965Sjdp 37933965Sjdp /* This is called to record a named integer constant. */ 380130561Sobrien bfd_boolean (*int_constant) (void *, const char *, bfd_vma); 38133965Sjdp 38233965Sjdp /* This is called to record a named floating point constant. */ 383130561Sobrien bfd_boolean (*float_constant) (void *, const char *, double); 38433965Sjdp 38533965Sjdp /* This is called to record a typed integer constant. The type is 38633965Sjdp popped off the type stack. */ 387130561Sobrien bfd_boolean (*typed_constant) (void *, const char *, bfd_vma); 38833965Sjdp 38933965Sjdp /* This is called to record a variable. The type is popped off the 39033965Sjdp type stack. */ 391130561Sobrien bfd_boolean (*variable) 392130561Sobrien (void *, const char *, enum debug_var_kind, bfd_vma); 39333965Sjdp 39433965Sjdp /* Start writing out a function. The return type must be popped off 395130561Sobrien the stack. The bfd_boolean is TRUE if the function is global. This 39633965Sjdp is followed by calls to function_parameter, followed by block 39733965Sjdp information. */ 398130561Sobrien bfd_boolean (*start_function) (void *, const char *, bfd_boolean); 39933965Sjdp 40033965Sjdp /* Record a function parameter for the current function. The type 40133965Sjdp must be popped off the stack. */ 402130561Sobrien bfd_boolean (*function_parameter) 403130561Sobrien (void *, const char *, enum debug_parm_kind, bfd_vma); 40433965Sjdp 40533965Sjdp /* Start writing out a block. There is at least one top level block 40633965Sjdp per function. Blocks may be nested. The argument is the 40733965Sjdp starting address of the block. */ 408130561Sobrien bfd_boolean (*start_block) (void *, bfd_vma); 40933965Sjdp 41033965Sjdp /* Finish writing out a block. The argument is the ending address 41133965Sjdp of the block. */ 412130561Sobrien bfd_boolean (*end_block) (void *, bfd_vma); 41333965Sjdp 41433965Sjdp /* Finish writing out a function. */ 415130561Sobrien bfd_boolean (*end_function) (void *); 41633965Sjdp 41733965Sjdp /* Record line number information for the current compilation unit. */ 418130561Sobrien bfd_boolean (*lineno) (void *, const char *, unsigned long, bfd_vma); 41933965Sjdp}; 42033965Sjdp 42133965Sjdp/* Exported functions. */ 42233965Sjdp 42333965Sjdp/* The first argument to most of these functions is a handle. This 42433965Sjdp handle is returned by the debug_init function. The purpose of the 42533965Sjdp handle is to permit the debugging routines to not use static 42633965Sjdp variables, and hence to be reentrant. This would be useful for a 42733965Sjdp program which wanted to handle two executables simultaneously. */ 42833965Sjdp 42933965Sjdp/* Return a debugging handle. */ 43033965Sjdp 431130561Sobrienextern void *debug_init (void); 43233965Sjdp 43333965Sjdp/* Set the source filename. This implicitly starts a new compilation 43433965Sjdp unit. */ 43533965Sjdp 436130561Sobrienextern bfd_boolean debug_set_filename (void *, const char *); 43733965Sjdp 43833965Sjdp/* Change source files to the given file name. This is used for 43933965Sjdp include files in a single compilation unit. */ 44033965Sjdp 441130561Sobrienextern bfd_boolean debug_start_source (void *, const char *); 44233965Sjdp 44333965Sjdp/* Record a function definition. This implicitly starts a function 44433965Sjdp block. The debug_type argument is the type of the return value. 445130561Sobrien The bfd_boolean indicates whether the function is globally visible. 44633965Sjdp The bfd_vma is the address of the start of the function. Currently 44733965Sjdp the parameter types are specified by calls to 44833965Sjdp debug_record_parameter. */ 44933965Sjdp 450130561Sobrienextern bfd_boolean debug_record_function 451130561Sobrien (void *, const char *, debug_type, bfd_boolean, bfd_vma); 45233965Sjdp 45333965Sjdp/* Record a parameter for the current function. */ 45433965Sjdp 455130561Sobrienextern bfd_boolean debug_record_parameter 456130561Sobrien (void *, const char *, debug_type, enum debug_parm_kind, bfd_vma); 45733965Sjdp 45833965Sjdp/* End a function definition. The argument is the address where the 45933965Sjdp function ends. */ 46033965Sjdp 461130561Sobrienextern bfd_boolean debug_end_function (void *, bfd_vma); 46233965Sjdp 46333965Sjdp/* Start a block in a function. All local information will be 46433965Sjdp recorded in this block, until the matching call to debug_end_block. 46533965Sjdp debug_start_block and debug_end_block may be nested. The argument 46633965Sjdp is the address at which this block starts. */ 46733965Sjdp 468130561Sobrienextern bfd_boolean debug_start_block (void *, bfd_vma); 46933965Sjdp 47033965Sjdp/* Finish a block in a function. This matches the call to 47133965Sjdp debug_start_block. The argument is the address at which this block 47233965Sjdp ends. */ 47333965Sjdp 474130561Sobrienextern bfd_boolean debug_end_block (void *, bfd_vma); 47533965Sjdp 47633965Sjdp/* Associate a line number in the current source file with a given 47733965Sjdp address. */ 47833965Sjdp 479130561Sobrienextern bfd_boolean debug_record_line (void *, unsigned long, bfd_vma); 48033965Sjdp 48133965Sjdp/* Start a named common block. This is a block of variables that may 48233965Sjdp move in memory. */ 48333965Sjdp 484130561Sobrienextern bfd_boolean debug_start_common_block (void *, const char *); 48533965Sjdp 48633965Sjdp/* End a named common block. */ 48733965Sjdp 488130561Sobrienextern bfd_boolean debug_end_common_block (void *, const char *); 48933965Sjdp 49033965Sjdp/* Record a named integer constant. */ 49133965Sjdp 492130561Sobrienextern bfd_boolean debug_record_int_const (void *, const char *, bfd_vma); 49333965Sjdp 49433965Sjdp/* Record a named floating point constant. */ 49533965Sjdp 496130561Sobrienextern bfd_boolean debug_record_float_const (void *, const char *, double); 49733965Sjdp 49833965Sjdp/* Record a typed constant with an integral value. */ 49933965Sjdp 500130561Sobrienextern bfd_boolean debug_record_typed_const 501130561Sobrien (void *, const char *, debug_type, bfd_vma); 50233965Sjdp 50333965Sjdp/* Record a label. */ 50433965Sjdp 505130561Sobrienextern bfd_boolean debug_record_label 506130561Sobrien (void *, const char *, debug_type, bfd_vma); 50733965Sjdp 50833965Sjdp/* Record a variable. */ 50933965Sjdp 510130561Sobrienextern bfd_boolean debug_record_variable 511130561Sobrien (void *, const char *, debug_type, enum debug_var_kind, bfd_vma); 51233965Sjdp 51333965Sjdp/* Make an indirect type. The first argument is a pointer to the 51433965Sjdp location where the real type will be placed. The second argument 51533965Sjdp is the type tag, if there is one; this may be NULL; the only 51633965Sjdp purpose of this argument is so that debug_get_type_name can return 51733965Sjdp something useful. This function may be used when a type is 51833965Sjdp referenced before it is defined. */ 51933965Sjdp 52033965Sjdpextern debug_type debug_make_indirect_type 521130561Sobrien (void *, debug_type *, const char *); 52233965Sjdp 52333965Sjdp/* Make a void type. */ 52433965Sjdp 525130561Sobrienextern debug_type debug_make_void_type (void *); 52633965Sjdp 527130561Sobrien/* Make an integer type of a given size. The bfd_boolean argument is TRUE 52833965Sjdp if the integer is unsigned. */ 52933965Sjdp 530130561Sobrienextern debug_type debug_make_int_type (void *, unsigned int, bfd_boolean); 53133965Sjdp 53233965Sjdp/* Make a floating point type of a given size. FIXME: On some 53333965Sjdp platforms, like an Alpha, you probably need to be able to specify 53433965Sjdp the format. */ 53533965Sjdp 536130561Sobrienextern debug_type debug_make_float_type (void *, unsigned int); 53733965Sjdp 53833965Sjdp/* Make a boolean type of a given size. */ 53933965Sjdp 540130561Sobrienextern debug_type debug_make_bool_type (void *, unsigned int); 54133965Sjdp 54233965Sjdp/* Make a complex type of a given size. */ 54333965Sjdp 544130561Sobrienextern debug_type debug_make_complex_type (void *, unsigned int); 54533965Sjdp 546130561Sobrien/* Make a structure type. The second argument is TRUE for a struct, 547130561Sobrien FALSE for a union. The third argument is the size of the struct. 54833965Sjdp The fourth argument is a NULL terminated array of fields. */ 54933965Sjdp 55033965Sjdpextern debug_type debug_make_struct_type 551130561Sobrien (void *, bfd_boolean, bfd_vma, debug_field *); 55233965Sjdp 55333965Sjdp/* Make an object type. The first three arguments after the handle 55433965Sjdp are the same as for debug_make_struct_type. The next arguments are 55533965Sjdp a NULL terminated array of base classes, a NULL terminated array of 55633965Sjdp methods, the type of the object holding the virtual function table 557130561Sobrien if it is not this object, and a bfd_boolean which is TRUE if this 55833965Sjdp object has its own virtual function table. */ 55933965Sjdp 56033965Sjdpextern debug_type debug_make_object_type 561130561Sobrien (void *, bfd_boolean, bfd_vma, debug_field *, debug_baseclass *, 562130561Sobrien debug_method *, debug_type, bfd_boolean); 56333965Sjdp 56433965Sjdp/* Make an enumeration type. The arguments are a null terminated 56533965Sjdp array of strings, and an array of corresponding values. */ 56633965Sjdp 56733965Sjdpextern debug_type debug_make_enum_type 568130561Sobrien (void *, const char **, bfd_signed_vma *); 56933965Sjdp 57033965Sjdp/* Make a pointer to a given type. */ 57133965Sjdp 572130561Sobrienextern debug_type debug_make_pointer_type (void *, debug_type); 57333965Sjdp 57433965Sjdp/* Make a function type. The second argument is the return type. The 57533965Sjdp third argument is a NULL terminated array of argument types. The 576130561Sobrien fourth argument is TRUE if the function takes a variable number of 57733965Sjdp arguments. If the third argument is NULL, then the argument types 57833965Sjdp are unknown. */ 57933965Sjdp 58033965Sjdpextern debug_type debug_make_function_type 581130561Sobrien (void *, debug_type, debug_type *, bfd_boolean); 58233965Sjdp 58333965Sjdp/* Make a reference to a given type. */ 58433965Sjdp 585130561Sobrienextern debug_type debug_make_reference_type (void *, debug_type); 58633965Sjdp 58733965Sjdp/* Make a range of a given type from a lower to an upper bound. */ 58833965Sjdp 58933965Sjdpextern debug_type debug_make_range_type 590130561Sobrien (void *, debug_type, bfd_signed_vma, bfd_signed_vma); 59133965Sjdp 59233965Sjdp/* Make an array type. The second argument is the type of an element 59333965Sjdp of the array. The third argument is the type of a range of the 59433965Sjdp array. The fourth and fifth argument are the lower and upper 59533965Sjdp bounds, respectively (if the bounds are not known, lower should be 596130561Sobrien 0 and upper should be -1). The sixth argument is TRUE if this 59733965Sjdp array is actually a string, as in C. */ 59833965Sjdp 59933965Sjdpextern debug_type debug_make_array_type 600130561Sobrien (void *, debug_type, debug_type, bfd_signed_vma, bfd_signed_vma, 601130561Sobrien bfd_boolean); 60233965Sjdp 60333965Sjdp/* Make a set of a given type. For example, a Pascal set type. The 604130561Sobrien bfd_boolean argument is TRUE if this set is actually a bitstring, as in 60533965Sjdp CHILL. */ 60633965Sjdp 607130561Sobrienextern debug_type debug_make_set_type (void *, debug_type, bfd_boolean); 60833965Sjdp 60933965Sjdp/* Make a type for a pointer which is relative to an object. The 61033965Sjdp second argument is the type of the object to which the pointer is 61133965Sjdp relative. The third argument is the type that the pointer points 61233965Sjdp to. */ 61333965Sjdp 614130561Sobrienextern debug_type debug_make_offset_type (void *, debug_type, debug_type); 61533965Sjdp 61633965Sjdp/* Make a type for a method function. The second argument is the 61733965Sjdp return type. The third argument is the domain. The fourth 61833965Sjdp argument is a NULL terminated array of argument types. The fifth 619130561Sobrien argument is TRUE if the function takes a variable number of 62033965Sjdp arguments, in which case the array of argument types indicates the 62133965Sjdp types of the first arguments. The domain and the argument array 62233965Sjdp may be NULL, in which case this is a stub method and that 62333965Sjdp information is not available. Stabs debugging uses this, and gets 62433965Sjdp the argument types from the mangled name. */ 62533965Sjdp 62633965Sjdpextern debug_type debug_make_method_type 627130561Sobrien (void *, debug_type, debug_type, debug_type *, bfd_boolean); 62833965Sjdp 62933965Sjdp/* Make a const qualified version of a given type. */ 63033965Sjdp 631130561Sobrienextern debug_type debug_make_const_type (void *, debug_type); 63233965Sjdp 63333965Sjdp/* Make a volatile qualified version of a given type. */ 63433965Sjdp 635130561Sobrienextern debug_type debug_make_volatile_type (void *, debug_type); 63633965Sjdp 63733965Sjdp/* Make an undefined tagged type. For example, a struct which has 63833965Sjdp been mentioned, but not defined. */ 63933965Sjdp 64033965Sjdpextern debug_type debug_make_undefined_tagged_type 641130561Sobrien (void *, const char *, enum debug_type_kind); 64233965Sjdp 64333965Sjdp/* Make a base class for an object. The second argument is the base 64433965Sjdp class type. The third argument is the bit position of this base 64533965Sjdp class in the object. The fourth argument is whether this is a 64633965Sjdp virtual class. The fifth argument is the visibility of the base 64733965Sjdp class. */ 64833965Sjdp 64933965Sjdpextern debug_baseclass debug_make_baseclass 650130561Sobrien (void *, debug_type, bfd_vma, bfd_boolean, enum debug_visibility); 65133965Sjdp 65233965Sjdp/* Make a field for a struct. The second argument is the name. The 65333965Sjdp third argument is the type of the field. The fourth argument is 65433965Sjdp the bit position of the field. The fifth argument is the size of 65533965Sjdp the field (it may be zero). The sixth argument is the visibility 65633965Sjdp of the field. */ 65733965Sjdp 65833965Sjdpextern debug_field debug_make_field 659130561Sobrien (void *, const char *, debug_type, bfd_vma, bfd_vma, enum debug_visibility); 66033965Sjdp 66133965Sjdp/* Make a static member of an object. The second argument is the 66233965Sjdp name. The third argument is the type of the member. The fourth 66333965Sjdp argument is the physical name of the member (i.e., the name as a 66433965Sjdp global variable). The fifth argument is the visibility of the 66533965Sjdp member. */ 66633965Sjdp 66733965Sjdpextern debug_field debug_make_static_member 668130561Sobrien (void *, const char *, debug_type, const char *, enum debug_visibility); 66933965Sjdp 67033965Sjdp/* Make a method. The second argument is the name, and the third 67133965Sjdp argument is a NULL terminated array of method variants. Each 67233965Sjdp method variant is a method with this name but with different 67333965Sjdp argument types. */ 67433965Sjdp 67533965Sjdpextern debug_method debug_make_method 676130561Sobrien (void *, const char *, debug_method_variant *); 67733965Sjdp 67833965Sjdp/* Make a method variant. The second argument is the physical name of 67933965Sjdp the function. The third argument is the type of the function, 68033965Sjdp probably constructed by debug_make_method_type. The fourth 68133965Sjdp argument is the visibility. The fifth argument is whether this is 68233965Sjdp a const function. The sixth argument is whether this is a volatile 68333965Sjdp function. The seventh argument is the index in the virtual 68433965Sjdp function table, if any. The eighth argument is the virtual 68533965Sjdp function context. */ 68633965Sjdp 68733965Sjdpextern debug_method_variant debug_make_method_variant 688130561Sobrien (void *, const char *, debug_type, enum debug_visibility, bfd_boolean, 689130561Sobrien bfd_boolean, bfd_vma, debug_type); 69033965Sjdp 69133965Sjdp/* Make a static method argument. The arguments are the same as for 69233965Sjdp debug_make_method_variant, except that the last two are omitted 69333965Sjdp since a static method can not also be virtual. */ 69433965Sjdp 69533965Sjdpextern debug_method_variant debug_make_static_method_variant 696130561Sobrien (void *, const char *, debug_type, enum debug_visibility, bfd_boolean, 697130561Sobrien bfd_boolean); 69833965Sjdp 69933965Sjdp/* Name a type. This returns a new type with an attached name. */ 70033965Sjdp 701130561Sobrienextern debug_type debug_name_type (void *, const char *, debug_type); 70233965Sjdp 70333965Sjdp/* Give a tag to a type, such as a struct or union. This returns a 70433965Sjdp new type with an attached tag. */ 70533965Sjdp 706130561Sobrienextern debug_type debug_tag_type (void *, const char *, debug_type); 70733965Sjdp 70833965Sjdp/* Record the size of a given type. */ 70933965Sjdp 710130561Sobrienextern bfd_boolean debug_record_type_size (void *, debug_type, unsigned int); 71133965Sjdp 71233965Sjdp/* Find a named type. */ 71333965Sjdp 714130561Sobrienextern debug_type debug_find_named_type (void *, const char *); 71533965Sjdp 71633965Sjdp/* Find a tagged type. */ 71733965Sjdp 71833965Sjdpextern debug_type debug_find_tagged_type 719130561Sobrien (void *, const char *, enum debug_type_kind); 72033965Sjdp 72133965Sjdp/* Get the kind of a type. */ 72233965Sjdp 723130561Sobrienextern enum debug_type_kind debug_get_type_kind (void *, debug_type); 72433965Sjdp 72533965Sjdp/* Get the name of a type. */ 72633965Sjdp 727130561Sobrienextern const char *debug_get_type_name (void *, debug_type); 72833965Sjdp 72933965Sjdp/* Get the size of a type. */ 73033965Sjdp 731130561Sobrienextern bfd_vma debug_get_type_size (void *, debug_type); 73233965Sjdp 73333965Sjdp/* Get the return type of a function or method type. */ 73433965Sjdp 735130561Sobrienextern debug_type debug_get_return_type (void *, debug_type); 73633965Sjdp 73733965Sjdp/* Get the NULL terminated array of parameter types for a function or 73833965Sjdp method type (actually, parameter types are not currently stored for 73933965Sjdp function types). This may be used to determine whether a method 74033965Sjdp type is a stub method or not. The last argument points to a 741130561Sobrien bfd_boolean which is set to TRUE if the function takes a variable 74233965Sjdp number of arguments. */ 74333965Sjdp 744130561Sobrienextern const debug_type *debug_get_parameter_types 745130561Sobrien (void *, debug_type, bfd_boolean *); 74633965Sjdp 74733965Sjdp/* Get the target type of a pointer or reference or const or volatile 74833965Sjdp type. */ 74933965Sjdp 750130561Sobrienextern debug_type debug_get_target_type (void *, debug_type); 75133965Sjdp 75233965Sjdp/* Get the NULL terminated array of fields for a struct, union, or 75333965Sjdp class. */ 75433965Sjdp 755130561Sobrienextern const debug_field *debug_get_fields (void *, debug_type); 75633965Sjdp 75733965Sjdp/* Get the type of a field. */ 75833965Sjdp 759130561Sobrienextern debug_type debug_get_field_type (void *, debug_field); 76033965Sjdp 76133965Sjdp/* Get the name of a field. */ 76233965Sjdp 763130561Sobrienextern const char *debug_get_field_name (void *, debug_field); 76433965Sjdp 76533965Sjdp/* Get the bit position of a field within the containing structure. 76633965Sjdp If the field is a static member, this will return (bfd_vma) -1. */ 76733965Sjdp 768130561Sobrienextern bfd_vma debug_get_field_bitpos (void *, debug_field); 76933965Sjdp 77033965Sjdp/* Get the bit size of a field. If the field is a static member, this 77133965Sjdp will return (bfd_vma) -1. */ 77233965Sjdp 773130561Sobrienextern bfd_vma debug_get_field_bitsize (void *, debug_field); 77433965Sjdp 77533965Sjdp/* Get the visibility of a field. */ 77633965Sjdp 777130561Sobrienextern enum debug_visibility debug_get_field_visibility (void *, debug_field); 77833965Sjdp 77933965Sjdp/* Get the physical name of a field, if it is a static member. If the 78033965Sjdp field is not a static member, this will return NULL. */ 78133965Sjdp 782130561Sobrienextern const char *debug_get_field_physname (void *, debug_field); 78333965Sjdp 78433965Sjdp/* Write out the recorded debugging information. This takes a set of 78533965Sjdp function pointers which are called to do the actual writing. The 786130561Sobrien first void * is the debugging handle. The second void * is a handle 78733965Sjdp which is passed to the functions. */ 78833965Sjdp 789130561Sobrienextern bfd_boolean debug_write 790130561Sobrien (void *, const struct debug_write_fns *, void *); 79133965Sjdp 79233965Sjdp#endif /* DEBUG_H */ 793