flags.h 中有write_symbols的定义
/* 1 => write gdb debugging output (using symout.c).
2 => write dbx debugging output (using dbxout.c).
3 => write sdb debugging output (using sdbout.c). */
enum debugger { NO_DEBUG = 0, GDB_DEBUG = 1, DBX_DEBUG = 2, SDB_DEBUG = 3,
EXTENDED_DBX_DEBUG = 4 };
extern enum debugger write_symbols;
toplev.c 中有对-g的处理
else if (!strcmp (str, "gg"))
write_symbols = GDB_DEBUG;
stmt.c中出现了一次:
/* Initialize the RTL mechanism. */
init_emit (write_symbols);
emit.c中的对应的函数
/* Initialize data structures and variables in this file
before generating rtl for each function.
WRITE_SYMBOLS is nonzero if any kind of debugging info
is to be generated. */
void
init_emit (write_symbols)
int write_symbols;
{
first_insn = NULL;
last_insn = NULL;
sequence_stack = NULL;
cur_insn_uid = 1;
reg_rtx_no = FIRST_PSEUDO_REGISTER;
last_linenum = 0;
last_filename = 0;
first_label_num = label_num;
no_line_numbers = ! write_symbols;
/* Init the tables that describe all the pseudo regs. */
regno_pointer_flag_length = FIRST_PSEUDO_REGISTER + 100;
regno_pointer_flag
= (char *) oballoc (regno_pointer_flag_length);
bzero (regno_pointer_flag, regno_pointer_flag_length);
regno_reg_rtx
= (rtx *) oballoc (regno_pointer_flag_length * sizeof (rtx));
bzero (regno_reg_rtx, regno_pointer_flag_length * sizeof (rtx));
}
final.c中的好几处出现的地方
toplev.c中调用了final_start_function()函数
TIMEVAR (final_time,
{
assemble_function (decl);
final_start_function (insns, asm_out_file,
write_symbols, optimize);
final (insns, asm_out_file,
write_symbols, optimize, 0);
final_end_function (insns, asm_out_file,
write_symbols, optimize);
fflush (asm_out_file);
});
filnal.c文件中有对write_symbols的使用
void
final_start_function (first, file, write_symbols, optimize)
rtx first;
FILE *file;
enum debugger write_symbols;
int optimize;
{
block_depth = 0;
this_is_asm_operands = 0;
/* Record beginning of the symbol-block that's the entire function. */
if (write_symbols == GDB_DEBUG)
{
pending_blocks[block_depth++] = next_block_index;
fprintf (file, "\t.gdbbeg %d\n", next_block_index++);
}