GCC Middle and Back End API 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 |
|
static |
Return a unique string to name an anonymous type.
References plain_type_1().
|
static |
|
static |
If we have already saved up some array dimensions, print them now.
Don't kill sdb if type is not laid out or has variable size.
If we have computed the size of an array containing this type, print it now.
|
static |
Referenced by gen_fake_label().
|
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.
Carefully distinguish all the standard types of C, without messing up if the language is not C. Note that we check only for the names that contain spaces; other names might occur by coincidence in other languages.
Output the referenced structure tag name only if the .def has already been finished. At least on 386, the Unix assembler cannot handle forward references to tags.
But the 88100, it requires them, sigh...
And the MIPS requires unknown refs as well...
These 3 lines used to follow the close brace. However, a size of 0 without a tag implies a tag of 0, so if we don't know a tag, we can't mention the size.
|
static |
|
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.
The SCO compiler does not emit a separate block for the function level scope, so we avoid it here also.
Include the outermost BLOCK's variables in block 1.
If -g1, suppress all the internal symbols of functions except for arguments.
References assemble_name().
|
static |
|
static |
Output sdb info for the current function name. Called from assemble_start_function.
|
static |
|
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.
|
static |
Referenced by sdbout_reg_parms().
|
static |
Ignore blocks never expanded or otherwise marked as real.
When we reach the specified block, output its symbols.
If we are past the specified block, stop the scan.
Scan the blocks within this block.
References decl_function_context(), and sdbout_one_type().
|
static |
Referenced by sdbout_finish(), and sdbout_reg_parms().
|
static |
|
static |
Describe the end line-number of an internal block within a function.
The SCO compiler does not emit a separate block for the function level scope, so we avoid it here also.
|
static |
Output sdb info for the absolute end of a function. Called after the epilogue is output.
|
static |
|
static |
Called at end of function (before epilogue). Describe end of outermost block.
Indicate we are between functions, for line-number output.
|
static |
|
static |
|
static |
|
static |
Revert to reading a previous source file.
|
static |
|
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.
This condition should match the one for emitting the actual members below.
|
static |
|
static |
Output initialized global vars at the end, in the order of definition. See comment in sdbout_global_decl.
References sdbout_dequeue_anonymous_types().
|
static |
|
static |
Output debug information for a global DECL. Called from toplev.c after compilation proper has finished.
The COFF linker can move initialized global vars to the end. And that can screw up the symbol ordering. Defer those for sdbout_finish ().
Output COFF information for non-global file-scope initialized variables.
References sdbout_symbol().
|
static |
|
static |
Set up for SDB output at the start of compilation.
Emit debug information which was queued by sdbout_symbol before we got here.
|
static |
|
static |
Output sdb info for the given label. Called only if LABEL_NAME (insn) is present.
|
static |
Referenced by sdbout_block(), and sdbout_queue_anonymous_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.
Don't output a type twice.
James said test TREE_ASM_BEING_WRITTEN here.
Output nothing if type is not yet defined.
This is reputed to cause trouble with the following case, but perhaps checking TYPE_SIZE above will fix it.
Here is a testcase: struct foo { struct badstr *bbb; } forwardref; typedef struct intermediate { int aaaa; } intermediate_ref; typedef struct badstr { int ccccc; } badtype;
This change, which ought to make better output, used to make the COFF assembler unhappy. Changes involving KNOWN_TYPE_TAG may fix the problem.
Before really doing anything, output types we want to refer to.
Note that in version 1 the following two lines are not used if forward references are in use.
Output a structure type.
Record the type tag, but not in its permanent place just yet.
Print out the base class information with fields named after the types they hold.
This is only relevant to aggregate types. TYPE_BINFO is used for other purposes in an ENUMERAL_TYPE, so we must exclude that case.
Output the individual fields.
Output the name, type, position (in bits), size (in bits) of each field.
Omit here the nameless fields that are used to skip bits. Also omit fields with variable size or position. Also omit non FIELD_DECL nodes that GNU C++ may put here.
Output end of a structure,union, or enumeral definition.
|
static |
|
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.
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.
This is the case where the parm is passed as an int or double and it is converted to a char, short or float and stored back in the parmlist. In this case, describe the parm with the variable's declared type, and adjust the address if the least significant bytes (which we are using) are not the first ones.
Parm passed in registers and lives in registers or nowhere.
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 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 ...)) or (MEM (MEM ...)), in which case we use a value of zero.
Again, this assumes the offset is based on the arg pointer.
|
static |
|
static |
Machinery to record and output anonymous types.
References sdbout_one_type().
|
static |
|
static |
Find the IDENTIFIER_NODE for the type name.
The DECL_NAME for templates includes "<>", which breaks most assemblers. Use its assembler name instead, which has been mangled into being safe.
Now get the name as a string, or invent one.
|
static |
|
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.
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.
A parm declared char is really passed as an int, so it occupies the least significant bytes. On a big-endian machine those are not the low-numbered ones.
References DINFO_LEVEL_TERSE, sdbout_block(), and sdbout_dequeue_anonymous_types().
|
static |
Output a line number symbol entry for source file FILENAME and line number LINE.
COFF relative line numbers must be positive.
|
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.
If we are called before sdbout_init is run, just save the symbol for later.
Enum values are defined by defining the enum type.
Don't mention a nested function under its parent.
Check DECL_INITIAL to distinguish declarations from definitions. Don't output debug info here for declarations; they will have a DECL_INITIAL value of 0.
Done with tagged types.
Don't output intrinsic types. GAS chokes on SDB .def statements that contain identifiers with embedded spaces (eg "unsigned long").
Output typedef name.
Parm decls go in their own separate chains and are output by sdbout_reg_parms and sdbout_parms.
Don't mention a variable that is external. Let the file that defines it describe it.
Ignore __FUNCTION__, etc.
If there was an error in the declaration, don't dump core if there is no RTL associated with the variable doesn't exist.
Don't mention a variable at all if it was completely optimized into nothingness. If DECL was from an inline function, then its rtl is not identically the rtl that was used in this particular compilation.
Don't output anything if an auto variable gets RTL that is static. GAS version 2.2 can't handle such output.
Emit any structure, union, or enum type that has not been output. This occurs for tag-less structs (et al) used to declare variables within functions.
Defer SDB information for top-level initialized variables!
C++ in 2.3 makes nameless symbols. That will be fixed later. For now, avoid crashing.
Record the name for, starting a symtab entry.
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. COFF has no way to represent this so all we can do is output the variable as a pointer.
DECL_RTL looks like (MEM (MEM (PLUS (REG...) (CONST_INT...)))). We want the value of that CONST_INT.
Encore compiler hates a newline in a macro arg, it seems.
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.
This is for variables which are at offset zero from the frame pointer. This happens on the Alpha. Non-frame pointer registers are excluded above.
DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))) or (MEM (REG...)). We want the value of that CONST_INT or zero.
It is something we don't know how to represent for SDB.
Referenced by sdbout_global_decl().
|
static |
|
static |
Call sdbout_symbol on each decl in the chain SYMS.
|
static |
|
static |
Output SDB information for a top-level initialized variable that has been delayed.
|
static |
|
static |
void sdbout_types | ( | ) |
Given a chain of ..._TYPE nodes, all of which have names, output definitions of those names, as typedefs.
|
static |
|
static |
|
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 allocate_struct_function(), asan_clear_shadow(), assign_parm_remove_parallels(), build_addr(), build_cgraph_edges(), canonicalize_component_ref(), compute_argument_addresses(), convert_local_reference_op(), copy_static_chain(), crash_signal(), create_function_info_for(), create_phi_for_local_result(), dbxout_finish_complex_stabs(), delete_unreachable_blocks_update_callgraph(), DFS(), dw2_size_of_call_site_table(), emit_notes_for_differences_2(), expand_function(), expand_value_return(), free_histograms(), gate_intra_sra(), gen_array_type_die(), get_cdtor_priority_section(), get_elimination(), init_dummy_function_start(), leaf_renumber_regs(), locate_and_pad_parm(), lower_gimple_return(), nonremovable_p(), gcc::pass_manager::operator new(), output_in_order(), promote_mode(), push_function_context(), reorder_blocks_1(), resolve_operand_name_1(), set_label_offsets(), sra_ipa_modify_assign(), stmt_overflow_infinity(), tree_add_const_value_attribute_for_decl(), tree_nrv(), update_call_edge_frequencies(), whole_program_function_and_variable_visibility(), and xcoffout_declare_function().
Declarations whose debug info was deferred till end of compilation.
|
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.
|
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.
|
static |
Table of array dimensions of current type.
|
static |
Number of elements used in sdb_dims.
|
static |
Size of outermost array currently being processed.
|
static |
|
static |
Counter to generate unique "names" for nameless struct members.