GCC Middle and Back End API Reference
dbxout.c File Reference

Data Structures

struct  typeinfo
struct  dbx_file




static void emit_bincl_stab (const char *c)
static void emit_pending_bincls (void)
static void emit_pending_bincls_if_required (void)
static void dbxout_init (const char *)
static void dbxout_finish (const char *)
static void dbxout_start_source_file (unsigned, const char *)
static void dbxout_end_source_file (unsigned)
static void dbxout_typedefs (tree)
static void dbxout_type_index (tree)
static void dbxout_args (tree)
static void dbxout_type_fields (tree)
static void dbxout_type_method_1 (tree)
static void dbxout_type_methods (tree)
static void dbxout_range_type (tree, tree, tree)
static void dbxout_type (tree, int)
static bool print_int_cst_bounds_in_octal_p (tree, tree, tree)
static bool is_fortran (void)
static void dbxout_type_name (tree)
static void dbxout_class_name_qualifiers (tree)
static int dbxout_symbol_location (tree, tree, const char *, rtx)
static void dbxout_symbol_name (tree, const char *, int)
static void dbxout_common_name (tree, const char *, stab_code_type)
static const char * dbxout_common_check (tree, int *)
static void dbxout_global_decl (tree)
static void dbxout_type_decl (tree, int)
static void dbxout_handle_pch (unsigned)
static void debug_free_queue (void)
static void dbxout_source_line (unsigned int, const char *, int, bool)
static void dbxout_begin_prologue (unsigned int, const char *)
static void dbxout_source_file (const char *)
static void dbxout_function_end (tree)
static void dbxout_begin_function (tree)
static void dbxout_begin_block (unsigned, unsigned)
static void dbxout_end_block (unsigned, unsigned)
static void dbxout_function_decl (tree)
void dbxout_int ()
void dbxout_stab_value_zero ()
void dbxout_stab_value_label ()
void dbxout_stab_value_label_diff ()
void dbxout_stab_value_internal_label ()
void dbxout_stab_value_internal_label_diff (const char *stem, int *counterp, const char *base)
void dbxout_stabd ()
void dbxout_begin_stabn ()
void dbxout_begin_stabn_sline ()
void dbxout_begin_empty_stabs ()
void dbxout_begin_simple_stabs ()
void dbxout_begin_simple_stabs_desc ()
static void dbxout_begin_complex_stabs ()
static void dbxout_begin_complex_stabs_noforcetext ()
static void stabstr_D ()
static void stabstr_U ()
static void stabstr_O ()
static void stabstr_continue ()
static void dbxout_finish_complex_stabs (tree sym, stab_code_type code, rtx addr, const char *label, int number)
static void dbxout_function_end ()
static unsigned int get_lang_number ()
static void dbxout_init ()
static void dbxout_typedefs ()
static void emit_bincl_stab ()
static void dbxout_start_source_file (unsigned int line, const char *filename)
static void dbxout_end_source_file ()
static void dbxout_handle_pch ()
static void dbxout_block (tree, int, tree)
static void dbxout_source_file ()
static void dbxout_begin_prologue ()
static void dbxout_begin_block ()
static void dbxout_end_block ()
static void dbxout_function_decl ()
static void dbxout_global_decl ()
static void dbxout_type_decl ()
static void dbxout_finish ()
static void dbxout_type_index ()
static void debug_flush_symbol_queue ()
static void debug_queue_symbol ()
static void dbxout_type_fields ()
static void dbxout_type_method_1 ()
static void dbxout_type_methods ()
static void dbxout_range_type ()
static void dbxout_type ()
static bool print_int_cst_bounds_in_octal_p ()
static void dbxout_type_name ()
static void dbxout_class_name_qualifiers ()
static rtx dbxout_expand_expr ()
static int output_used_types_helper ()
static int output_types_sort ()
static void output_used_types ()
int dbxout_symbol ()
static int dbxout_symbol_location ()
static void dbxout_symbol_name ()
static void dbxout_common_name ()
static const char * dbxout_common_check ()
int dbxout_syms ()
void dbxout_parms ()
void dbxout_reg_parms ()
static void dbxout_args ()
static void dbx_output_lbrac (const char *label, const char *begin_label)
static void dbx_output_rbrac (const char *label, const char *begin_label)
static void dbxout_block ()
static void dbxout_begin_function ()
void default_stabs_asm_out_destructor (rtx symbol, int priority)
void default_stabs_asm_out_constructor (rtx symbol, int priority)


static struct typeinfotypevec
static int typevec_len
static int next_type_number
static tree preinit_symbols
static struct dbx_filecurrent_file
static int next_file_number
static int scope_labelno
static int dbxout_source_line_counter
static int source_label_number = 1
static const char * lastfile
static int lastfile_is_base
static int pending_bincls = 0
static const char * base_input_file
static struct obstack stabstr_ob
static size_t stabstr_last_contin_point
struct gcc_debug_hooks dbx_debug_hooks
struct gcc_debug_hooks xcoff_debug_hooks
static int debug_nesting = 0
static treesymbol_queue
static int symbol_queue_index = 0
static int symbol_queue_size = 0

Enumeration Type Documentation

enum typestatus

Function Documentation

static void dbx_output_lbrac ( const char *  label,
const char *  begin_label 
   Subroutine of dbxout_block.  Emit an N_LBRAC stab referencing LABEL.
   BEGIN_LABEL is the name of the beginning of the function, which may
   be required.  
static void dbx_output_rbrac ( const char *  label,
const char *  begin_label 
   Subroutine of dbxout_block.  Emit an N_RBRAC stab referencing LABEL.
   BEGIN_LABEL is the name of the beginning of the function, which may
   be required.  
static void dbxout_args ( tree  )
static void dbxout_args ( )
   Given a chain of ..._TYPE nodes (as come in a parameter list),
   output definitions of those names, in raw form 
static void dbxout_begin_block ( unsigned  ,
static void dbxout_begin_block ( )
   Describe the beginning of an internal block within a function.  
static void dbxout_begin_complex_stabs ( )
   The next set of functions are entirely concerned with production of
   "complex" .stabs directives: that is, .stabs directives whose
   strings have to be constructed piecemeal.  dbxout_type,
   dbxout_symbol, etc. use these routines heavily.  The string is queued
   up in an obstack, then written out by dbxout_finish_complex_stabs, which
   is also responsible for splitting it up if it exceeds DBX_CONTIN_LENGTH.
   (You might think it would be more efficient to go straight to stdio
   when DBX_CONTIN_LENGTH is 0 (i.e. no length limit) but that turns
   out not to be the case, and anyway this needs fewer #ifdefs.)  
   Begin a complex .stabs directive.  If we can, write the initial
   ASM_STABS_OP to the asm_out_file.  

Referenced by output_used_types().

static void dbxout_begin_complex_stabs_noforcetext ( )
   As above, but do not force text or emit pending bincls.  This is
   used by dbxout_symbol_location, which needs to do something else.  
void dbxout_begin_empty_stabs ( )
   Begin a .stabs directive with string "", type STYPE, and desc and
   other fields 0.  The value field is the responsibility of the
   caller.  This function cannot be used for .stabx directives.  

Referenced by dbxout_finish_complex_stabs().

static void dbxout_begin_function ( tree  )

Referenced by dbxout_source_file().

static void dbxout_begin_function ( )
   Output the information about a function and its arguments and result.
   Usually this follows the function's code,
   but on some systems, it comes before.  
static void dbxout_begin_prologue ( unsigned  int,
const char *   
static void dbxout_begin_prologue ( )
   Output N_BNSYM, line number symbol entry, and local symbol at
   function scope  
     pre-increment the scope counter 
     Output function begin block at function scope, referenced
     by dbxout_block, dbxout_source_line and dbxout_function_end.  

References dbxout_symbol().

void dbxout_begin_simple_stabs ( )
   Begin a .stabs directive with string STR, type STYPE, and desc 0.
   The value field is the responsibility of the caller.  
void dbxout_begin_simple_stabs_desc ( )
   As above but use SDESC for the desc field.  
void dbxout_begin_stabn ( )
   Write a .stabn directive with type STYPE.  This function stops
   short of emitting the value field, which is the responsibility of
   the caller (normally it will be either a symbol or the difference
   of two symbols).  

References asm_out_file, dbxout_int(), and output_quoted_string().

Referenced by dbxout_parms(), and emit_bincl_stab().

void dbxout_begin_stabn_sline ( )
   Write a .stabn directive with type N_SLINE and desc LINE.  As above,
   the value field is the responsibility of the caller.  

References asm_out_file, dbxout_int(), and output_quoted_string().

Referenced by dbxout_end_source_file().

static void dbxout_block ( tree  ,
int  ,

Referenced by dbxout_source_file().

static void dbxout_block ( )
   Output everything about a symbol block (a BLOCK node
   that represents a scope level),
   including recursive output of contained blocks.

   BLOCK is the BLOCK node.
   DEPTH is its depth within containing symbol blocks.
   ARGS is usually zero; but for the outermost block of the
   body of a function, it is a chain of PARM_DECLs for the function parameters.
   We output definitions of all the register parms
   as if they were local variables of that block.

   If -g1 was used, we count blocks just the same, but output nothing
   except for the outermost block.

   Actually, BLOCK may be several blocks chained together.
   We handle them all in sequence.  
     Reference current function start using LFBB.  
         Ignore blocks never expanded or otherwise marked as real.  
             In dbx format, the syms of a block come before the N_LBRAC.
             If nothing is output, we don't need the N_LBRAC, either.  
             Now output an N_LBRAC symbol to represent the beginning of
             the block.  Use the block's tree-walk order to generate
             the assembler symbols LBBn and LBEn
             that final will define around the code in this block.  
                   The outermost block doesn't get LBB labels; use
                   the LFBB local symbol emitted by dbxout_begin_prologue.  
             Output the subblocks.  
             Refer to the marker for the end of the block.  
                   The outermost block doesn't get LBE labels;
                   use the "scope" label which will be emitted
                   by dbxout_function_end.  
static void dbxout_class_name_qualifiers ( tree  )
static void dbxout_class_name_qualifiers ( )
   Output leading leading struct or class names needed for qualifying
   type whose scope is limited to a struct or class.  

References debug_nesting, preinit_symbols, gdbhooks::TYPE_DECL, and typevec.

static const char* dbxout_common_check ( tree  ,
int *   
static const char* dbxout_common_check ( )
   Check decl to determine whether it is a VAR_DECL destined for storage in a
   common area.  If it is, the return value will be a non-null string giving
   the name of the common storage block it will go into.  If non-null, the
   value is the offset into the common block for that symbol's storage.  
     If the decl isn't a VAR_DECL, or if it isn't static, or if
     it does not have a value (the offset into the common area), or if it
     is thread local (as opposed to global) then it isn't common, and shouldn't
     be handled as such.

     ??? DECL_THREAD_LOCAL_P check prevents problems with improper .stabs
     for thread-local symbols.  Can be handled via same mechanism as used
     in dwarf2out.c.  
         We have a sym that will go into a common area, meaning that it
         will get storage reserved with a .comm/.lcomm assembler pseudo-op.

         Determine name of common area this symbol will be an offset into,
         and offset into that area.  Also retrieve the decl for the area
         that the symbol is offset into.  
         Check area common symbol is offset into.  If this is not public, then
         it is not a symbol in a common block.  It must be a .lcomm symbol, not
         a .comm symbol.  
static void dbxout_common_name ( tree  ,
const char *  ,
static void dbxout_common_name ( )
   Output the common block name for DECL in a stabs.

   Symbols in global common (.comm) get wrapped with an N_BCOMM/N_ECOMM pair
   around each group of symbols in the same .comm area.  The N_GSYM stabs
   that are emitted only contain the offset in the common area.  This routine
   emits the N_BCOMM and N_ECOMM stabs.  
static void dbxout_end_block ( unsigned  ,
static void dbxout_end_block ( )
   Describe the end line-number of an internal block within a function.  
static void dbxout_end_source_file ( unsigned  )
static void dbxout_end_source_file ( )
   Revert to reading a previous source file.  Generate a N_EINCL stab.  
     Emit EINCL stab only if BINCL is not pending.  

References asm_out_file, dbxout_begin_stabn_sline(), and dbxout_source_file().

static rtx dbxout_expand_expr ( )
   This is a specialized subset of expand_expr for use by dbxout_symbol in
   evaluating DECL_VALUE_EXPR.  In particular, we stop if we find decls that
   haven't been expanded, or if the expression is getting so complex we won't
   be able to represent it in stabs anyway.  Returns NULL on failure.  
         We can't handle emulated tls variables, because the address is an
         offset to the return value of __emutls_get_address, and there is no
         way to express that in stabs.  Also, there are name mangling issues
         here.  We end up with references to undefined symbols if we don't
         disable debug info for these variables.  
             If this is a var that might not be actually output,
             return NULL, otherwise stabs might reference an undefined
static void dbxout_finish ( const char *  )
static void dbxout_finish ( )
   At the end of compilation, finish writing the symbol table.
   The default is to call debug_free_queue but do nothing else.  

References gdbhooks::TYPE_DECL.

static void dbxout_finish_complex_stabs ( tree  sym,
stab_code_type  code,
rtx  addr,
const char *  label,
int  number 
   Finish the emission of a complex .stabs directive.  When DBX_CONTIN_LENGTH
   is zero, this has only to emit the close quote and the remainder of
   the arguments.  When it is nonzero, the string has been marshalled in
   stabstr_ob, and this routine is responsible for breaking it up into
   DBX_CONTIN_LENGTH-sized chunks.

   SYM is the DECL of the symbol under consideration; it is used only
   for its DECL_SOURCE_LINE.  The other arguments are all passed directly
   to DBX_FINISH_STABS; see above for details.  
         Nul-terminate the growing string, then get its size and
         Within the buffer are a sequence of NUL-separated strings,
         each of which is to be written out as a separate stab
             Must add an extra byte to account for the NUL separator.  
             Only put a line number on the last stab in the sequence.  
         No continuations - we can put the whole string out at once.
         It is faster to augment the string with the close quote and
         comma than to do a two-character fputs.  

References asm_out_file, current_function_decl, dbxout_begin_empty_stabs(), dbxout_stab_value_label_diff(), dbxout_stabd(), function_section(), switch_to_section(), and targetm.

Referenced by output_used_types().

static void dbxout_function_decl ( tree  )
static void dbxout_function_decl ( )
   Output dbx data for a function definition.
   This includes a definition of the function name itself (a symbol),
   definitions of the parameters (locating them in the parameter list)
   and then output the block that makes up the function's body
   (including all the auto variables of the function).  
static void dbxout_function_end ( tree  )

Referenced by dbxout_source_file().

static void dbxout_function_end ( )
     The Lscope label must be emitted even if we aren't doing anything
     else; dbxout_block needs it.  
     Convert Lscope into the appropriate format for local labels in case
     the system doesn't insert underscores in front of user generated
     The N_FUN tag at the end of the function is a GNU extension,
     which may be undesirable, and is unnecessary if we do not have
     named sections.  
     By convention, GCC will mark the end of a function with an N_FUN
     symbol and an empty string.  
         Reference current function start using LFBB.  
static void dbxout_global_decl ( tree  )
static void dbxout_global_decl ( )
   Debug information for a global DECL.  Called from toplev.c after
   compilation proper has finished.  
static void dbxout_handle_pch ( unsigned  )
static void dbxout_handle_pch ( )
   Handle a few odd cases that occur when trying to make PCH files work.  
         When using the PCH, this file will be included, so we need to output
         a BINCL.  
         The base file when using the PCH won't be the same as
         the base file when it's being generated.  
         ... and an EINCL.  
         Deal with cases where 'lastfile' was never actually changed.  
static void dbxout_init ( const char *  )
static void dbxout_init ( )
   At the beginning of compilation, start writing the symbol table.
   Initialize `typevec' and output the standard data types of C.  
     stabstr_ob contains one string, which will be just fine with
     1-byte alignment.  
     Convert Ltext into the appropriate format for local labels in case
     the system doesn't insert underscores in front of user generated
     Put the current working directory in an N_SO symbol.  
     Emit an N_OPT stab to indicate that this file was compiled by GCC.
     The string used is historical.  
     Get all permanent types that have typedef names, and output them
     all, except for those already output.  Some language front ends
     put these declarations in the top-level scope; some do not;
     the latter are responsible for calling debug_hooks->type_decl from
     their record_builtin_type function.  
void dbxout_int ( )
   Utility: write a decimal integer NUM to asm_out_file.  

Referenced by dbxout_begin_stabn(), dbxout_begin_stabn_sline(), and dbxout_stabd().

void dbxout_parms ( )
   The following two functions output definitions of function parameters.
   Each parameter gets a definition locating it in the parameter list.
   Each parameter that is a register variable gets a second definition
   locating it in the register.

   Printing or argument lists in gdb uses the definitions that
   locate in the parameter list.  But reference to the variable in
   expressions uses preferentially the definition as a register.  
   Output definitions, referring to storage in the parmlist,
   of all the parms in PARMS, which is a chain of PARM_DECL nodes.  
           Perform any necessary register eliminations on the parameter's rtl,
           so that the debugging output will be accurate.  
               ??? Here we assume that the parm address is indexed
               off the frame pointer or arg pointer.
               If that is not true, we produce meaningless results,
               but do not crash.  
               It is quite tempting to use TREE_TYPE (parms) instead
               of DECL_ARG_TYPE (parms) for the eff_type, so that gcc
               reports the actual type of the parameter, rather than
               the promoted type.  This certainly makes GDB's life
               easier, at least for some ports.  The change is a bad
               idea however, since GDB expects to be able access the
               type without performing any conversions.  So for
               example, if we were passing a float to an unprototyped
               function, gcc will store a double on the stack, but if
               we emit a stab saying the type is a float, then gdb
               will only read in a single value, and this will produce
               an erroneous value.  
               Parm passed in registers and lives in registers or nowhere.  
               For parms passed in registers, it is better to use the
               declared type of the variable, not the type it arrived in.  
               If parm lives in a register, use that register; pretend
               the parm was passed there.  It would be more consistent
               to describe the register where the parm was passed, but
               in practice that register usually holds something else.
               If the parm lives nowhere, use the register where it
               was passed.  
               Parm was passed via invisible reference.
               That is, its address was passed in a register.
               Output it as if it lived in that register.
               The debugger will know from the type
               that it was actually passed by invisible reference.  
               GDB likes this marked with a special letter.  
               DECL_RTL looks like (MEM (REG...).  Get the register number.
               If it is an unallocated pseudo-reg, then use the register where
               it was passed instead.
               ??? Why is DBX_REGISTER_NUMBER not used here?  
               Parm was passed via invisible reference, with the reference
               living on the stack.  DECL_RTL looks like
               (MEM (MEM (PLUS (REG ...) (CONST_INT ...)))) or it
               could look like (MEM (MEM (REG))).  
                    ??? A constant address for a parm can happen
                    when the reg it lives in is equiv to a constant in memory.
                    Should make this not happen, after 2.4.  
               Parm was passed in registers but lives on the stack.  
               DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
               in which case we want the value of that CONST_INT,
               or (MEM (REG ...)),
               in which case we use a value of zero.  
               Make a big endian correction if the mode of the type of the
               parameter is not the same as the mode of the rtl.  
             ??? We don't know how to represent this argument.  

References dbxout_begin_stabn(), dbxout_stab_value_label(), and dbxout_stab_value_label_diff().

Referenced by xcoffout_declare_function().

static void dbxout_range_type ( tree  ,
tree  ,
static void dbxout_range_type ( )
   Emit a "range" type specification, which has the form:
   "r<index type>;<lower bound>;<upper bound>;".
   TYPE is an INTEGER_TYPE, LOW and HIGH are the bounds.  
         Traditionally, we made sure 'int' was type 1, and builtin types
         were defined to be sub-ranges of int.  Unfortunately, this
         does not allow us to distinguish true sub-ranges from integer
         types.  So, instead we define integer (non-sub-range) types as
         sub-ranges of themselves.  This matters for Chill.  If this isn't
         a subrange type, then we want to define it in terms of itself.
         However, in C, this may be an anonymous integer type, and we don't
         want to emit debug info referring to it.  Just calling
         dbxout_type_index won't work anyways, because the type hasn't been
         defined yet.  We make this work for both cases by checked to see
         whether this is a defined type, referring to it if it is, and using
         'int' otherwise.  
void dbxout_reg_parms ( )
   Output definitions for the places where parms live during the function,
   when different from where they were passed, when the parms were passed
   in memory.

   It is not useful to do this for parms passed in registers
   that live during the function in different registers, because it is
   impossible to look in the passed register for the passed value,
   so we use the within-the-function register to begin with.

   PARMS is a chain of PARM_DECL nodes.  
           Report parms that live in registers during the function
           but were passed in memory.  
           Report parms that live in memory but not where they were passed.  

Referenced by xcoffout_source_line().

static void dbxout_source_file ( const char *  )

Referenced by dbxout_end_source_file().

static void dbxout_source_file ( )
   Output debugging info to FILE to switch to sourcefile FILENAME.  
         Don't change section amid function.  

References dbxout_begin_function(), dbxout_block(), dbxout_function_end(), and emit_pending_bincls_if_required().

static void dbxout_source_line ( unsigned int  lineno,
const char *  filename,
int  discriminator,
bool  is_stmt 
   The debug hooks structure.  
   Output a line number symbol entry for source file FILENAME and line
   number LINENO.  
         Reference current function start using LFBB.  

References typeinfo::file_number, stabstr_D(), typeinfo::type_number, and typevec.

void dbxout_stab_value_internal_label ( )
   Write out an internal label as the value of a stab, and immediately
   emit that internal label.  This should be used only when
   dbxout_stabd will not work.  STEM is the name stem of the label,
   COUNTERP is a pointer to a counter variable which will be used to
   guarantee label uniqueness.  
void dbxout_stab_value_internal_label_diff ( const char *  stem,
int *  counterp,
const char *  base 
   Write out the difference between BASE and an internal label as the
   value of a stab, and immediately emit that internal label.  STEM and
   COUNTERP are as for dbxout_stab_value_internal_label.  
void dbxout_stab_value_label ( )
   Write out the label LABEL as the value of a stab.  

References targetm.

Referenced by dbxout_parms().

void dbxout_stab_value_label_diff ( )
   Write out the difference of two labels, LABEL - BASE, as the value
   of a stab.  

References asm_out_file, and targetm.

Referenced by dbxout_finish_complex_stabs(), and dbxout_parms().

void dbxout_stab_value_zero ( void  )
   Primitives for emitting simple stabs directives.  All other stabs
   routines should use these functions instead of directly emitting
   stabs.  They are exported because machine-dependent code may need
   to invoke them, e.g. in a DBX_OUTPUT_* macro whose definition
   forwards to code in CPU.c.  
   The following functions should all be called immediately after one
   of the dbxout_begin_stab* functions (below).  They write out
   various things as the value of a stab.  
   Write out a literal zero as the value of a stab.  

References gcc_debug_hooks::label.

Referenced by emit_bincl_stab().

void dbxout_stabd ( )
   The following functions produce specific kinds of stab directives.  
   Write a .stabd directive with type STYPE and desc SDESC to asm_out_file.  

References asm_out_file, and dbxout_int().

Referenced by dbxout_finish_complex_stabs().

static void dbxout_start_source_file ( unsigned  ,
const char *   

Referenced by emit_pending_bincls().

static void dbxout_start_source_file ( unsigned int  line,
const char *  filename 
   Change to reading from a new source file.  Generate a N_BINCL stab.  
     Do not assign file number now.
     Delay it until we actually emit BINCL.  
int dbxout_symbol ( )
   Output a .stabs for the symbol defined by DECL,
   which must be a ..._DECL node in the normal namespace.
   LOCAL is nonzero if the scope is less than the entire file.
   Return 1 if a stabs might have been emitted.  
     "Intercept" dbxout_symbol() calls like we do all debug_hooks.  
     Ignore nameless syms, but don't ignore type tags.  
     If we are to generate only the symbols actually used then such
     symbol nodes are flagged with TREE_USED.  Ignore any that
     aren't flagged as TREE_USED.  
     If dbxout_init has not yet run, queue this symbol for later.  
         We now have a used symbol.  We need to generate the info for
         the symbol's type in addition to the symbol itself.  These
         type symbols are queued to be generated after were done with
         the symbol itself (otherwise they would fight over the
         stabstr obstack).

         Note, because the TREE_TYPE(type) might be something like a
         pointer to a named type we need to look for the first name
         we see following the TREE_TYPE chain.  
         need special treatment.  The TYPE_STUB_DECL field in these
         types generally represents the tag name type we want to
         output.  In addition there  could be a typedef type with
         a different name.  In that case we also want to output
         Enum values are defined by defining the enum type.  
         Don't mention a nested function under its parent.  
         Don't mention an inline instance of a nested function.  
         For a nested function, when that function is compiled,
         mention the containing function name
         as well as (since dbx wants it) our own assembler-name.  
         Don't output the same typedef twice.
         And don't output what language-specific stuff doesn't want output.  
         Don't output typedefs for types with magic type numbers (XCOFF).  
               Nonzero means we must output a tag as well as a typedef.  
               Handle the case of a C++ structure or union
               where the TYPE_NAME is a TYPE_DECL
               which gives both a typedef name and a tag.  
               dbx requires the tag first and the typedef second.  
                   Distinguish the implicit typedefs of C++
                   from explicit ones that might be found in C.  
                   Do not generate a tag for incomplete records.  
                   Do not generate a tag for records of variable size,
                   since this type can not be properly described in the
                   DBX format, and it confuses some tools such as objdump.  
               Output leading class/struct qualifiers.  
               Output typedef name.  
               Short cut way to output a tag also.  
                   Distinguish the implicit typedefs of C++
                   from explicit ones that might be found in C.  
           Don't output a tag if this is an incomplete type.  This prevents
           the sun4 Sun OS 4.x dbx from crashing.  
               For a TYPE_DECL with no name, but the type has a name,
               output a tag.
               This is what represents `struct foo' with no typedef.  
               In C++, the name of a type is the corresponding typedef.
               In C, it is an IDENTIFIER_NODE.  
           If an enum type has no name, it cannot be referred to, but
           we must output it anyway, to record the enumeration
               Some debuggers fail when given NULL names, so give this a
               harmless name of " " (Why not "(anon)"?).  
           Prevent duplicate output of a typedef.  
         PARM_DECLs go in their own separate chain and are output by
         dbxout_reg_parms and dbxout_parms, except for those that are
         disguised VAR_DECLs like Out parameters in Ada.  
         ... fall through ...  
         Don't mention a variable that is external.
         Let the file that defines it describe it.  
         If the variable is really a constant
         and not written in memory, inform the debugger.

         ??? Why do we skip emitting the type and location in this case?  
             The sun4 assembler does not grok this.  
         else it is something we handle like a normal variable.  

Referenced by dbxout_begin_prologue().

static int dbxout_symbol_location ( tree  ,
tree  ,
const char *  ,

Referenced by dbxout_syms().

static int dbxout_symbol_location ( )
   Output the stab for DECL, a VAR_DECL, RESULT_DECL or PARM_DECL.
   Add SUFFIX to its name, if SUFFIX is not 0.
   Describe the variable as residing in HOME
   (usually HOME is DECL_RTL (DECL), but not always).
   Returns 1 if the stab was really emitted.  
     Don't mention a variable at all
     if it was completely optimized into nothingness.

     If the decl was from an inline function, then its rtl
     is not identically the rtl that was used in this
     particular compilation.  
     The kind-of-variable letter depends on where
     the variable is and on the scope of its name:
     G and N_GSYM for static storage and global scope,
     S for static storage and file scope,
     V for static storage and local scope,
     for those two, use N_LCSYM if data is in bss segment,
     N_STSYM if in data segment, N_FUN otherwise.
     (We used N_FUN originally, then changed to N_STSYM
     to please GDB.  However, it seems that confused ld.
     Now GDB has been fixed to like N_FUN, says Kingdon.)
     no letter at all, and N_LSYM, for auto variable,
     r and N_RSYM for register variable.  
             Some ports can transform a symbol ref into a label ref,
             because the symbol ref is too far away and has to be
             dumped into a constant pool.  Alternatively, the symbol
             in the constant pool might be referenced by a different
                 If all references to the constant pool were optimized
                 out, we just ignore the symbol.  
             This should be the same condition as in assemble_variable, but
             we don't have access to dont_output_data here.  So, instead,
             we rely on the fact that error_mark_node initializers always
             end up in bss for C++ and never end up in bss for C.  
               This is not quite right, but it's the closest
               of all the codes that Unix defines.  
                 Ultrix `as' seems to need this.  
       If the value is indirect by memory or by a register
       that isn't the frame pointer
       then it means the object is variable-sized and address through
       that register or stack slot.  DBX has no way to represent this
       so all we can do is output the variable as a pointer.
       If it's not a parameter, ignore it.  
             RTL looks like (MEM (MEM (PLUS (REG...) (CONST_INT...)))).
             We want the value of that CONST_INT.  
         Effectively do build_pointer_type, but don't cache this type,
         since it might be temporary whereas the type it points to
         might have been saved for inlining.  
         Don't use REFERENCE_TYPE because dbx can't handle that.  
         RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
         We want the value of that CONST_INT.  
         Handle an obscure case which can arise when optimizing and
         when there are few available registers.  (This is *always*
         the case for i386/i486 targets).  The RTL looks like
         (MEM (CONST ...)) even though this variable is a local `auto'
         or a local `register' variable.  In effect, what has happened
         is that the reload pass has seen that all assignments and
         references for one such a local variable can be replaced by
         equivalent assignments and references to some static storage
         variable, thereby avoiding the need for a register.  In such
         cases we're forced to lie to debuggers and tell them that
         this variable was itself `static'.  
         If TYPE is not a COMPLEX_TYPE (it might be a RECORD_TYPE,
         for example), then there is no easy way to figure out
         what SUBTYPE should be.  So, we give up.  
         If the variable's storage is in two parts,
         output each as a separate stab with a modified name.  
       Address might be a MEM, when DECL is a variable-sized object.
       Or it might be const0_rtx, meaning previous passes
       want us to ignore this variable.  
     Ok, start a symtab entry and output the variable name.  
static void dbxout_symbol_name ( tree  ,
const char *  ,
static void dbxout_symbol_name ( )
   Output the symbol name of DECL for a stabs, with suffix SUFFIX.
   Then output LETTER to indicate the kind of location the symbol has.  
       One slight hitch: if this is a VAR_DECL which is a class member
       or a namespace member, we must put out the mangled name instead of the
       DECL_NAME.  Note also that static member (variable) names DO NOT begin
       with underscores in .stabs directives.  
       ...but if we're function-local, we don't want to include the junk
       added by ASM_FORMAT_PRIVATE_NAME.  
int dbxout_syms ( )
   Output definitions of all the decls in a chain. Return nonzero if
   anything was output 
         Check for common symbol, and then progression into a new/different
         block of common symbols.  Emit closing/opening common bracket if

References dbxout_symbol_location(), and rtx_equal_p().

Referenced by xcoffout_source_line().

static void dbxout_type ( tree  ,

Referenced by output_used_types().

static void dbxout_type ( )
   Output a reference to a type.  If the type has not yet been
   described in the dbx output, output its definition now.
   For a type already defined, just refer to its definition
   using the type number.

   If FULL is nonzero, and the type has been described only with
   a forward-reference, output the definition now.
   If FULL is zero in this case, just refer to the forward-reference
   using the number previously allocated.  
         If this is a subtype that should not be emitted as a subrange type,
         use the base type.  
     If there was an input error and we don't really have a type,
     avoid crashing and write something that is at least valid
     by assuming `int'.  
     Try to find the "main variant" with the same name.  
     If we are not using extensions, stabs does not distinguish const and
     volatile, so there is no need to make them separate types.  
         Type has no dbx number assigned.  Assign next available number.  
         Make sure type vector is long enough to record about this type.  
     Output the number of this type, to refer to it.  
     If this type's definition has been output or is now being output,
     that is all.  
         If we have already had a cross reference,
         and either that's all we want or that's the best we could do,
         don't repeat the cross reference.
         Sun dbx crashes if we do.  
             No way in DBX fmt to describe a variable size.  
     For systems where dbx output does not allow the `=xsNAME:' syntax,
     leave the type-number completely undefined rather than output
     a cross-reference.  If we have already used GNU debug info extensions,
     then it is OK to output a cross reference.  This is necessary to get
     proper C++ debug output.  
       We must use the same test here as we use twice below when deciding
       whether to emit a cross-reference.  
           No way in DBX fmt to describe a variable size.  
     Output a definition now.  
     Mark it as defined, so that if it is self-referent
     we will not get into an infinite recursion of definitions.  
     If this type is a variant of some other, hand off.  Types with
     different names are usefully distinguished.  We only distinguish
     cv-qualified types if we're using extensions.  
         'type' is a typedef; output the type it refers to.  
     else continue.  
         For a void type, just define it as itself; i.e., "5=5".
         This makes us consider it defined
         without saying what it is.  The debugger will make it
         a void type when the reference is seen, and nothing will
         ever override that default.  
             Output the type `char' as a subrange of itself!
             I don't understand this definition, just copied it
             from the output of pcc.
             This used to use `r2' explicitly and we used to
             take care to make sure that `char' was type number 2.  
         If this is a subtype of another integer type, always prefer to
         write it as a subtype.  
             If the size is non-standard, say what it is if we can use
             GDB extensions.  
             If the size is non-standard, say what it is if we can use
             GDB extensions.  
                 If this type derives from another type, output type index of
                 parent type. This is particularly important when parent type
                 is an enumerated type, because not generating the parent type
                 index would transform the definition of this enumerated type
                 into a plain unsigned type.  
               Output other integer types as subranges of `int'.  
         This used to say `r1' and we used to take care
         to make sure that `int' was type number 1.  
         Differs from the REAL_TYPE by its new data type number.
         R3 is NF_COMPLEX.  We don't try to use any of the other NF_*
         codes since gdb doesn't care anyway.  
             Output a complex integer type as a structure,
             pending some other way to do it.  
         Make arrays of packed bits look like bitstrings for chill.  
         Output "a" followed by a range type definition
         for the index type of the array
         followed by a reference to the target-type.
         ar1;0;N;M for a C array of type M and size N+1.  
         Check if a character string type, which in Chill is
         different from an array of characters.  
         Make vectors look like an array.  
         Output "a" followed by a range type definition
         for the index type of the array
         followed by a reference to the target-type.
         ar1;0;N;M for a C array of type M and size N+1.  
           Output a structure type.  We must use the same test here as we
           use in the DBX_NO_XREFS case above.  
               No way in DBX fmt to describe a variable size.  
               If the type is just a cross reference, output one
               and mark the type as partially described.
               If it later becomes defined, we will output
               its real definition.
               If the type has a name, don't nest its definition within
               another type's definition; instead, output an xref
               and let the definition come when the name is defined.  
                   The C frontend creates for anonymous variable length
                   records/unions TYPE_NAME with DECL_NAME NULL.  
           Identify record or union, and print its size.  
                         For a virtual base, print the (negative)
                         offset within the vtable where we must look
                         to find the necessary adjustment.  
                       Print out the base class information with
                       fields which have the same names at the types
                       they hold.  
         Write out the field declarations.  
             Avoid the ~ if we don't really need it--it confuses dbx.  
             We need to write out info about what field this class
             uses as its "main" vtable pointer field, because if this
             field is inherited from a base class, GDB cannot necessarily
             figure out which field it's using in time.  
         We must use the same test here as we use in the DBX_NO_XREFS case
         above.  We simplify it a bit since an enum will never have a variable
             Write the argument types out longhand.  
           Treat it as a function type.  
           Should print as an int, because it is really just an offset.  

References typeinfo::status, TYPE_XREF, and typevec.

static void dbxout_type_decl ( tree  ,
static void dbxout_type_decl ( )
   This is just a function-type adapter; dbxout_symbol does exactly
   what we want but returns an int.  
static void dbxout_type_fields ( tree  )
static void dbxout_type_fields ( )
   Subroutine of `dbxout_type'.  Output the type fields of TYPE.
   This must be a separate function because anonymous unions require
   recursive calls.  
     Output the name, type, position (in bits), size (in bits) of each
     field that we can support.  
         If one of the nodes is an error_mark or its type is then
         return early.  
         Omit here local type decls until we know how to support them.  
             Omit here the nameless fields that are used to skip bits.  
             Omit fields whose position or size are variable or too large to
             Continue the line if necessary,
             but not before the first field.  
                   If TEM is non-static, GDB won't understand it.  
static void dbxout_type_index ( tree  )
static void dbxout_type_index ( )
   Output the index of a type.  
static void dbxout_type_method_1 ( tree  )
static void dbxout_type_method_1 ( )
   Subroutine of `dbxout_type_methods'.  Output debug info about the
   method described DECL.  
         A for normal functions.
         B for `const' member functions.
         C for `volatile' member functions.
         D for `const volatile' member functions.  
     ??? Output the mangled name, which contains an encoding of the
     method's type signature.  May not be necessary anymore.  
static void dbxout_type_methods ( tree  )
static void dbxout_type_methods ( )
   Subroutine of `dbxout_type'.  Output debug info about the methods defined
   in TYPE.  
     C++: put out the method names and their parameter lists 
         Group together all the methods for the same operation.
         These differ in the types of the arguments.  
           Output the name of the field (after overloading), as
           well as the name of the field before overloading, along
           with its parameter list 
             Skip methods that aren't FUNCTION_DECLs.  (In C++, these
             include TEMPLATE_DECLs.)  The debugger doesn't know what
             to do with such entities anyhow.  
             Also ignore abstract methods; those are only interesting to
             the DWARF backends.  
             Redundantly output the plain name, since that's what gdb

References emit_pending_bincls_if_required(), typeinfo::file_number, dbx_file::file_number, memset(), next_type_number, subrange_type_for_debug_p(), gdbhooks::TYPE_DECL, typeinfo::type_number, typevec, and typevec_len.

static void dbxout_type_name ( tree  )
static void dbxout_type_name ( )
   Output the name of type TYPE, with no punctuation.
   Such names can be set up either by typedef declarations
   or by struct, enum and union tags.  
static void dbxout_typedefs ( tree  )
static void dbxout_typedefs ( )
static void debug_flush_symbol_queue ( )
   Generate the symbols for any queued up type symbols we encountered
   while generating the type info for some originally used symbol.
   This might generate additional entries in the queue.  Only when
   the nesting depth goes to 0 is this routine called.  
     Make sure that additionally queued items are not flushed
         If we pushed queued symbols then such symbols must be
         output no matter what anyone else says.  Specifically,
         we need to make sure dbxout_symbol() thinks the symbol was
         used and also we need to override TYPE_DECL_SUPPRESS_DEBUG
         which may be set for outside reasons.  
static void debug_free_queue ( )
   Free symbol queue.  
static void debug_queue_symbol ( )
   Queue a type symbol needed as part of the definition of a decl
   symbol.  These symbols are generated when debug_flush_symbol_queue()
   is called.  
void default_stabs_asm_out_constructor ( rtx  symbol,
int  priority 
   Likewise for global constructors.  
     Tell GNU LD that this is part of the static destructor set.
     This will work for any system that uses stabs, most usefully
     aout systems.  
void default_stabs_asm_out_destructor ( rtx  symbol,
int  priority 
   Record an element in the table of global destructors.  SYMBOL is
   a SYMBOL_REF of the function to be called; PRIORITY is a number
   between 0 and MAX_INIT_PRIORITY.  
     Tell GNU LD that this is part of the static destructor set.
     This will work for any system that uses stabs, most usefully
     aout systems.  
static void emit_bincl_stab ( const char *  c)
static void emit_bincl_stab ( )
   Emit BINCL stab using given name.  

References BINCL_PROCESSED, dbx_file::bincl_status, dbxout_begin_stabn(), and dbxout_stab_value_zero().

static void emit_pending_bincls ( )
   Emit all pending bincls.  
     Find first pending bincl.  
     Now emit all bincls.  
             Update file number and status.  
     All pending bincls have been emitted.  

References dbxout_start_source_file().

static void emit_pending_bincls_if_required ( void  )
   If there are pending bincls then it is time to emit all of them.  

Referenced by dbxout_source_file(), and dbxout_type_methods().

static unsigned int get_lang_number ( )
   Get lang description for N_SO stab.  
static bool is_fortran ( void  )
static int output_types_sort ( )
   This is a qsort callback which sorts types and declarations into a
   predictable order (types, then declarations, sorted by UID
static void output_used_types ( )
   Force all types used by this function to be output in debug
         Sort by UID to prevent dependence on hash table ordering.  

References dbxout_begin_complex_stabs(), dbxout_finish_complex_stabs(), dbxout_type(), and gdbhooks::TYPE_DECL.

static int output_used_types_helper ( )
   Helper function for output_used_types.  Queue one entry from the
   used types hash to be output.  
static bool print_int_cst_bounds_in_octal_p ( tree  ,
tree  ,
static bool print_int_cst_bounds_in_octal_p ( )
   Return nonzero if the given type represents an integer whose bounds
   should be printed in octal format.  
     If we can use GDB extensions and the size is wider than a long
     (the size used by GDB to read them) or we may have trouble writing
     the bounds the usual way, write them in octal.  Note the test is for
     the *target's* size of "long", not that of the host.  The host test
     is just to make sure we can write it out in case the host wide int
     is narrower than the target "long".

     For unsigned types, we use octal if they are the same size or larger.
     This is because we print the bounds as signed decimal, and hence they
     can't span same size unsigned types.  
static void stabstr_continue ( )
   Called whenever it is safe to break a stabs string into multiple
   .stabs directives.  If the current string has exceeded the limit
   set by DBX_CONTIN_LENGTH, mark the current position in the buffer
   as a continuation point by inserting DBX_CONTIN_CHAR (doubled if
   it is a backslash) and a null character.  

References asm_out_file, len, stabstr_ob, and strlen().

static void stabstr_D ( )
   Add NUM, a signed decimal number, to the string being built.  

Referenced by dbxout_source_line().

static void stabstr_O ( )
   Add CST, an INTEGER_CST tree, to the string being built as an
   unsigned octal number.  This routine handles values which are
   larger than a single HOST_WIDE_INT.  
     GDB wants constants with no extra leading "1" bits, so
     we need to remove any sign-extension that might be
     Leading zero for base indicator.  
     If the value is zero, the base indicator will serve as the value
     all by itself.  
     If the high half is zero, we need only print the low half normally.  
         When high != 0, we need to print enough zeroes from low to
         give the digits from high their proper place-values.  Hence
         NUMBER_FMT_LOOP cannot be used.  
         Octal digits carry exactly three bits of information.  The
         width of a HOST_WIDE_INT is not normally a multiple of three.
         Therefore, the next digit printed probably needs to carry
         information from both low and high.  
             At this point, only the bottom n_leftover_bits bits of low
             should be set.  
         Now we can format high in the normal manner.  However, if
         the only bits of high that were set were handled by the
         digit split between low and high, high will now be zero, and
         we don't want to print extra digits in that case.  


static void stabstr_U ( )
   Add NUM, an unsigned decimal number, to the string being built.  

Variable Documentation

const char* base_input_file
   The original input file name.  
struct dbx_file* current_file
   This is the top of the stack.

   This is not saved for PCH, because restoring a PCH should not change it.
   next_file_number does have to be saved, because the PCH may use some
   file numbers; however, just before restoring a PCH, next_file_number
   should always be 0 because we should not have needed any file numbers

Referenced by dbxout_typedefs().

struct gcc_debug_hooks dbx_debug_hooks
int dbxout_source_line_counter
   A counter for dbxout_source_line.  
int debug_nesting = 0
   When -gused is used, emit debug info for only used symbols. But in
   addition to the standard intercepted debug_hooks there are some
   direct calls into this file, i.e., dbxout_symbol, dbxout_parms, and
   dbxout_reg_params.  Those routines may also be called from a higher
   level intercepted routine. So to prevent recording data for an inner
   call to one of these for an intercept, we maintain an intercept
   nesting counter (debug_nesting). We only save the intercepted
   arguments if the nesting is 1.  

Referenced by dbxout_class_name_qualifiers().

const char* lastfile
   Last source file name mentioned in a NOTE insn.  
int lastfile_is_base
   Used by PCH machinery to detect if 'lastfile' should be reset to
int next_file_number
   This is the next file number to use.  
int next_type_number
   In dbx output, each type gets a unique number.
   This is the number for the next type output.
   The number, once assigned, is in the TYPE_SYMTAB_ADDRESS field.  

Referenced by dbxout_type_methods().

int pending_bincls = 0
   Typical USG systems don't have stab.h, and they also have
   no use for DBX-format debugging info.  
   If zero then there is no pending BINCL.  
tree preinit_symbols
   The C front end may call dbxout_symbol before dbxout_init runs.
   We save all such decls in this list and output them when we get
   to dbxout_init.  

Referenced by dbxout_class_name_qualifiers().

int scope_labelno
   A counter for dbxout_function_end.  
int source_label_number = 1
   Number for the next N_SOL filename stabs label.  The number 0 is reserved
   for the N_SO filename stabs label.  
size_t stabstr_last_contin_point
struct obstack stabstr_ob
   This obstack holds the stab string currently being constructed.  We
   build it up here, then write it out, so we can split long lines up
   properly (see dbxout_finish_complex_stabs).  

Referenced by stabstr_continue().

tree* symbol_queue
int symbol_queue_index = 0
int symbol_queue_size = 0
struct typeinfo* typevec
   Vector recording information about C data types.
   When we first notice a data type (a tree node),
   we assign it a number using next_type_number.
   That is its index in this vector.  

Referenced by dbxout_class_name_qualifiers(), dbxout_source_line(), dbxout_type(), and dbxout_type_methods().

int typevec_len
   Number of elements of space allocated in `typevec'.  

Referenced by dbxout_type_methods().

struct gcc_debug_hooks xcoff_debug_hooks