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

Functions

static void sdbout_init (const char *)
static void sdbout_finish (const char *)
static void sdbout_start_source_file (unsigned int, const char *)
static void sdbout_end_source_file (unsigned int)
static void sdbout_begin_block (unsigned int, unsigned int)
static void sdbout_end_block (unsigned int, unsigned int)
static void sdbout_source_line (unsigned int, const char *, int, bool)
static void sdbout_end_epilogue (unsigned int, const char *)
static void sdbout_global_decl (tree)
static void sdbout_begin_prologue (unsigned int, const char *)
static void sdbout_end_prologue (unsigned int, const char *)
static void sdbout_begin_function (tree)
static void sdbout_end_function (unsigned int)
static void sdbout_toplevel_data (tree)
static void sdbout_label (rtx)
static char * gen_fake_label (void)
static int plain_type (tree)
static int template_name_p (tree)
static void sdbout_record_type_name (tree)
static int plain_type_1 (tree, int)
static void sdbout_block (tree)
static void sdbout_syms (tree)
static void sdbout_queue_anonymous_type (tree)
static void sdbout_dequeue_anonymous_types (void)
static void sdbout_type (tree)
static void sdbout_field_types (tree)
static void sdbout_one_type (tree)
static void sdbout_parms (tree)
static void sdbout_reg_parms (tree)
static int plain_type ()
static int template_name_p ()
static void sdbout_record_type_name ()
static int plain_type_1 ()
static void sdbout_block ()
static void sdbout_syms ()
void sdbout_symbol ()
static void sdbout_toplevel_data ()
static void sdbout_queue_anonymous_type ()
void sdbout_types ()
static void sdbout_type ()
static void sdbout_field_types ()
static void sdbout_one_type ()
static void sdbout_parms ()
static void sdbout_reg_parms ()
static void sdbout_global_decl ()
static void sdbout_finish ()
static void sdbout_begin_block ()
static void sdbout_end_block ()
static void sdbout_begin_function ()
static void sdbout_begin_prologue ()
static void sdbout_end_prologue ()
static void sdbout_end_function ()
static void sdbout_label ()
static void sdbout_end_source_file ()
static void sdbout_init ()

Variables

static tree anonymous_types
static int unnamed_struct_number
static vec< tree, va_gc > * deferred_global_decls
static tree preinit_symbols
static bool sdbout_initialized
int sdb_begin_function_line = -1
FILE * asm_out_file
tree current_function_decl
struct gcc_debug_hooks sdb_debug_hooks
static int sdb_n_dims = 0
static int sdb_dims [SDB_MAX_DIM]
static int sdb_type_size = -1
static int do_block = 0

Function Documentation

static char * gen_fake_label ( )
static
Return a unique string to name an anonymous type.   

References gcc_debug_hooks::label.

Referenced by sdbout_parms(), sdbout_record_type_name(), and sdbout_reg_parms().

static int plain_type ( tree  )
static
static int plain_type ( )
static
static int plain_type_1 ( tree  ,
int   
)
static

Referenced by plain_type(), and plain_type_1().

static int plain_type_1 ( )
static
Return the .type value for type TYPE.

   LEVEL indicates how many levels deep we have recursed into the type.
   The SDB debug format can only represent 6 derived levels of types.
   After that, we must output inaccurate debug info.  We deliberately
   stop before the 7th level, so that ADA recursive types will not give an
   infinite loop.   

References DT_ARY, DT_FCN, DT_PTR, host_integerp(), int_size_in_bytes(), plain_type_1(), sdbout_record_type_name(), T_CHAR, T_DOUBLE, T_ENUM, T_FLOAT, T_INT, T_LNGDBL, T_LONG, T_SHORT, T_STRUCT, T_UCHAR, T_UINT, T_ULONG, T_UNION, T_USHORT, T_VOID, and tree_low_cst().

static void sdbout_begin_block ( unsigned  int,
unsigned  int 
)
static
static void sdbout_begin_block ( )
static
Describe the beginning of an internal block within a function.
   Also output descriptions of variables defined in this block.

   N is the number of the block, by order of beginning, counting from 1,
   and not counting the outermost (function top-level) block.
   The blocks match the BLOCKs in DECL_INITIAL (current_function_decl),
   if the count starts at 0 for the outermost one.   

References DINFO_LEVEL_TERSE, sdbout_block(), and sdbout_dequeue_anonymous_types().

static void sdbout_begin_function ( tree  )
static
static void sdbout_begin_function ( )
static
Output sdb info for the current function name.
   Called from assemble_start_function.   

References sdbout_symbol().

static void sdbout_begin_prologue ( unsigned  int,
const char *   
)
static
static void sdbout_begin_prologue ( )
static
Called at beginning of function body after prologue.  Record the
   function's starting line number, so we can output relative line numbers
   for the other lines.  Describe beginning of outermost block.  Also
   describe the parameter list.   

References sdbout_end_prologue().

static void sdbout_block ( tree  )
static

Referenced by sdbout_begin_block(), and sdbout_block().

static void sdbout_block ( )
static

References sdbout_block(), and sdbout_syms().

static void sdbout_dequeue_anonymous_types ( void  )
static
static void sdbout_end_block ( unsigned  int,
unsigned  int 
)
static
static void sdbout_end_block ( )
static
Describe the end line-number of an internal block within a function.   
static void sdbout_end_epilogue ( unsigned int  line,
const char *  file 
)
static
Output sdb info for the absolute end of a function.
   Called after the epilogue is output.   

References assemble_name().

static void sdbout_end_function ( unsigned  int)
static
static void sdbout_end_function ( )
static
Called at end of function (before epilogue).
   Describe end of outermost block.   

References sdbout_dequeue_anonymous_types().

static void sdbout_end_prologue ( unsigned  int,
const char *   
)
static

Referenced by sdbout_begin_prologue().

static void sdbout_end_prologue ( )
static
static void sdbout_end_source_file ( unsigned  int)
static
static void sdbout_end_source_file ( )
static
Revert to reading a previous source file.   
static void sdbout_field_types ( tree  )
static

Referenced by sdbout_one_type().

static void sdbout_field_types ( )
static
Output types of the fields of type TYPE, if they are structs.

   Formerly did not chase through pointer types, since that could be circular.
   They must come before TYPE, since forward refs are not allowed.
   Now james@bigtex.cactus.org says to try them.   

References bit_position(), host_integerp(), and sdbout_one_type().

static void sdbout_finish ( const char *  )
static
static void sdbout_finish ( )
static
Output initialized global vars at the end, in the order of
   definition.  See comment in sdbout_global_decl.   

References sdbout_symbol().

static void sdbout_global_decl ( tree  )
static
static void sdbout_global_decl ( )
static
Output debug information for a global DECL.  Called from toplev.c
   after compilation proper has finished.   

References sdbout_symbol(), sdbout_toplevel_data(), and vec_safe_push().

static void sdbout_init ( const char *  )
static
static void sdbout_init ( )
static
Set up for SDB output at the start of compilation.   

References nreverse(), sdbout_symbol(), and vec_alloc().

static void sdbout_label ( rtx  )
static
static void sdbout_label ( )
static
Output sdb info for the given label.  Called only if LABEL_NAME (insn)
   is present.   

References C_LABEL, and T_NULL.

static void sdbout_one_type ( tree  )
static
static void sdbout_one_type ( )
static
Use this to put out the top level defined record and union types
   for later reference.  If this is a struct with a name, then put that
   name out.  Other unnamed structs will have .xxfake labels generated so
   that they may be referred to later.
   The label will be stored in the KNOWN_TYPE_TAG slot of a type.
   It may NOT be called recursively.   

References bit_position(), C_ENTAG, C_EOS, C_FIELD, C_MOE, C_MOS, C_MOU, C_STRTAG, C_UNTAG, current_function_section(), host_integerp(), int_bit_position(), int_size_in_bytes(), sdbout_field_types(), sdbout_record_type_name(), sdbout_type(), switch_to_section(), T_ENUM, T_MOE, T_STRUCT, T_UNION, template_name_p(), and tree_low_cst().

static void sdbout_parms ( tree  )
static

Referenced by sdbout_end_prologue().

static void sdbout_parms ( )
static
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.   

References C_ARG, C_REGPARM, eliminate_regs(), gen_fake_label(), plain_type(), and type().

static void sdbout_queue_anonymous_type ( tree  )
static

Referenced by sdbout_record_type_name().

static void sdbout_queue_anonymous_type ( )
static
Machinery to record and output anonymous types.   
static void sdbout_record_type_name ( tree  )
static

Referenced by plain_type_1(), and sdbout_one_type().

static void sdbout_record_type_name ( )
static
static void sdbout_reg_parms ( tree  )
static

Referenced by sdbout_end_prologue().

static void sdbout_reg_parms ( )
static
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.   

References C_AUTO, C_REG, gen_fake_label(), offset, plain_type(), and rtx_equal_p().

static void sdbout_source_line ( unsigned int  line,
const char *  filename,
int  discriminator,
bool  is_stmt 
)
static
Output a line number symbol entry for source file FILENAME and line
   number LINE.   
static void sdbout_start_source_file ( unsigned int  line,
const char *  filename 
)
static
Change to reading from a new source file.   
void sdbout_symbol ( )
Output SDB information for a symbol described by DECL.
   LOCAL is nonzero if the symbol is not file-scope.   

References alter_subreg(), C_AUTO, C_EXT, C_REG, C_STAT, C_TPDEF, decl_function_context(), eliminate_regs(), leaf_renumber_regs_insn(), plain_type(), sdbout_one_type(), and template_name_p().

Referenced by sdbout_begin_function(), sdbout_finish(), sdbout_global_decl(), sdbout_init(), and sdbout_syms().

static void sdbout_syms ( tree  )
static

Referenced by sdbout_block().

static void sdbout_syms ( )
static
Call sdbout_symbol on each decl in the chain SYMS.   

References sdbout_symbol().

static void sdbout_toplevel_data ( tree  )
static

Referenced by sdbout_global_decl().

static void sdbout_toplevel_data ( )
static
Output SDB information for a top-level initialized variable
   that has been delayed.   

References C_EXT, C_STAT, and plain_type().

static void sdbout_type ( tree  )
static

Referenced by sdbout_one_type().

static void sdbout_type ( )
static

References plain_type().

void sdbout_types ( )
Given a chain of ..._TYPE nodes, all of which have names,
   output definitions of those names, as typedefs.   

References sdbout_dequeue_anonymous_types(), and sdbout_one_type().

Referenced by rest_of_clean_state().

static int template_name_p ( tree  )
static
static int template_name_p ( )
static

Variable Documentation

tree anonymous_types
static
@verbatim Output sdb-format symbol table information from GNU compiler.

Copyright (C) 1988-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

mike@tredysvr.Tredydev.Unisys.COM says:
I modified the struct.c example and have a nm of a .o resulting from the
AT&T C compiler.  From the example below I would conclude the following:

1. All .defs from structures are emitted as scanned.  The example below
   clearly shows the symbol table entries for BoxRec2 are after the first
   function.

2. All functions and their locals (including statics) are emitted as scanned.

3. All nested unnamed union and structure .defs must be emitted before
   the structure in which they are nested.  The AT&T assembler is a
   one pass beast as far as symbolics are concerned.

4. All structure .defs are emitted before the typedefs that refer to them.

5. All top level static and external variable definitions are moved to the
   end of file with all top level statics occurring first before externs.

6. All undefined references are at the end of the file.
FILE* asm_out_file
tree current_function_decl

Referenced by add_bound_info(), adjust_return_value_with_ops(), apply_ipa_transforms(), asan_emit_stack_protection(), assemble_start_function(), assign_parm_find_data_types(), assign_parm_find_entry_rtl(), assign_parm_setup_reg(), assign_parms(), assign_parms_augmented_arg_list(), assign_parms_initialize_all(), assign_stack_local_1(), branch_prob(), browse_tree(), build_addr(), build_cgraph_edges(), build_duplicate_type(), cgraph_build_static_cdtor_1(), cgraph_debug_gimple_stmt(), cgraph_rebuild_references(), cgraph_rtl_info(), cgraph_update_edges_for_call_stmt_node(), check_bb_profile(), check_call(), check_counter(), clobber_return_register(), computation_cost(), compute_frame_pointer_to_fb_displacement(), compute_function_frequency(), compute_inline_parameters_for_current(), consider_split(), const_ok_for_output_1(), convert_cfa_to_fb_loc_list(), convert_local_reference_op(), convert_nonlocal_reference_op(), convert_regs_exit(), copy_gimple_seq_and_replace_locals(), coverage_begin_function(), coverage_compute_lineno_checksum(), coverage_counter_alloc(), coverage_end_function(), crash_signal(), create_access_replacement(), create_artificial_label(), create_call_for_reduction_1(), create_omp_child_function(), create_omp_child_function_name(), create_stack_guard(), create_tailcall_accumulator(), current_function_section(), dbxout_function_end(), dbxout_source_file(), dbxout_symbol(), decide_function_section(), decl_address_invariant_p(), df_get_entry_block_def_set(), diagnose_omp_structured_block_errors(), diagnose_tm_blocks(), do_per_function(), do_per_function_toporder(), dump_alias_info(), dump_bb_info(), dump_dfa_stats(), dump_function_to_file(), dump_gimple_mem_ops(), dump_loc(), dump_one_pass(), dump_scope_blocks(), dump_tree_ssa(), dw_loc_list(), dwarf2out_abstract_function(), dwarf2out_alloc_current_fde(), dwarf2out_begin_function(), dwarf2out_begin_prologue(), dwarf2out_do_cfi_startproc(), early_inliner(), eliminate_regs_1(), eliminate_tail_call(), execute_all_ipa_transforms(), execute_build_cfg(), execute_cleanup_eh(), execute_fixup_cfg(), execute_function_dump(), execute_ipa_pass_list(), execute_lower_omp(), execute_lower_tm(), execute_mudflap_function_decls(), execute_mudflap_function_ops(), execute_one_pass(), execute_optimize_stdarg(), execute_split_functions(), execute_todo(), execute_warn_function_noreturn(), expand_block_edges(), expand_builtin(), expand_builtin_setjmp_receiver(), expand_call(), expand_debug_source_expr(), expand_expr_real_1(), expand_function(), expand_function_end(), expand_function_start(), expand_gimple_stmt_1(), expand_goto(), expand_regions_1(), expand_return(), expand_thunk(), expand_used_vars(), expand_value_return(), final_end_function(), final_scan_insn(), final_start_function(), finalize_compilation_unit(), find_decls_types_in_node(), find_obviously_necessary_stmts(), find_param_candidates(), find_return_bb(), find_tail_calls(), find_var_candidates(), finite_loop_p(), fold_builtin_next_arg(), fold_comparison(), force_decl_die(), function_called_by_processed_nodes_p(), gate_asan(), gate_handle_partition_blocks(), gate_tm_init(), gen_decl_die(), gen_subprogram_die(), generate_setjmp_warnings(), get_coverage_counts(), get_loop_location(), get_spill_slot_decl(), gimple_add_tmp_var(), gimple_dump_bb_buff(), gimple_dump_cfg(), gimple_expand_cfg(), gimple_gen_ic_func_profiler(), gimple_gen_interval_profiler(), gimple_ic(), gimple_verify_flow_info(), gimplify_bind_expr(), gimplify_body(), gimplify_call_expr(), gimplify_cond_expr(), gimplify_expr(), gimplify_function_tree(), gimplify_return_expr(), gimplify_var_or_parm_decl(), graphite_initialize(), handle_dll_attribute(), init_lowered_empty_function(), initialize_inlined_parameters(), initialize_parameter_reductions(), inline_transform(), insert_range_assertions(), instantiate_virtual_regs(), intra_create_variable_infos(), ipa_early_sra(), ipa_modify_call_arguments(), ipa_passes(), ipa_read_optimization_summaries_1(), ipa_read_summaries_1(), ipa_sra_preliminary_function_checks(), ipa_tm_scan_irr_block(), ipa_tm_scan_irr_function(), ipa_tm_transform_calls_redirect(), ipa_write_optimization_summaries_1(), ipa_write_summaries_2(), ipcp_transform_function(), lhd_print_error_function(), local_pure_const(), lower_builtin_setjmp(), lower_eh_constructs(), lower_emutls_function_body(), lower_function_body(), lower_gimple_bind(), lra_eliminate_regs_1(), mark_nonssa_use(), mark_parm_dereference(), maybe_inline_call_in_expr(), mf_decl_cache_locals(), mf_file_function_line_tree(), mf_varname_tree(), modify_function(), needs_to_live_in_memory(), new_omp_context(), nonnull_arg_p(), note_simd_array_uses_cb(), omp_copy_decl(), omp_copy_decl_2(), omp_notice_variable(), optimize_inline_calls(), output_function(), output_function_exception_table(), output_gimple_stmt(), pass_init_dump_file(), pop_cfun(), pop_function_context(), process_assignment(), profile_function(), promote_decl_mode(), push_cfun(), push_struct_function(), rebuild_cgraph_edges(), record_vars(), record_vars_into(), refactor_eh(), remove_cgraph_callee_edges(), remove_unused_locals(), reorder_blocks(), rest_of_clean_state(), rest_of_handle_final(), rtx_for_function_call(), run_scc_vn(), run_warn_unused_result(), scan_function(), scope_die_for(), secname_for_decl(), set_nothrow_function_flags(), setjmp_args_warning(), setup_incoming_promotions(), sjlj_emit_function_enter(), splice_all_param_accesses(), split_function(), sra_ipa_reset_debug_stmts(), suitable_for_tail_call_opt_p(), switch_to_exception_section(), tail_merge_optimize(), take_address_of(), test_nonssa_use(), tree_function_versioning(), tree_nrv(), tree_optimize_tail_calls_1(), turn_representatives_into_adjustments(), unlikely_text_section(), unlikely_text_section_p(), update_call_edge_frequencies(), vt_add_function_parameter(), vt_add_function_parameters(), vt_init_cfa_base(), vt_initialize(), xcoffout_begin_block(), xcoffout_begin_prologue(), and xcoffout_end_epilogue().

vec<tree, va_gc>* deferred_global_decls
static
Declarations whose debug info was deferred till end of compilation.   
int do_block = 0
static
Output the symbols defined in block number DO_BLOCK.

   This function works by walking the tree structure of blocks,
   counting blocks until it finds the desired block.   
tree preinit_symbols
static
The C front end may call sdbout_symbol before sdbout_init runs.
   We save all such decls in this list and output them when we get
   to sdbout_init.   
int sdb_begin_function_line = -1
Line number of beginning of current function, minus one.
   Negative means not in a function or not using sdb.   
struct gcc_debug_hooks sdb_debug_hooks
The debug hooks structure.   

Referenced by process_options().

int sdb_dims[SDB_MAX_DIM]
static
Table of array dimensions of current type.   
int sdb_n_dims = 0
static
Number of elements used in sdb_dims.   
int sdb_type_size = -1
static
Size of outermost array currently being processed.   
bool sdbout_initialized
static
int unnamed_struct_number
static
Counter to generate unique "names" for nameless struct members.