From a5a42b92933220e45ac15c4034065c0a2be5b209 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Thu, 12 Jul 2001 05:56:27 +0000 Subject: [PATCH] Makefile.in (final.o): Depend on debug.h. * Makefile.in (final.o): Depend on debug.h. * dbxout.c (dbxout_begin_block, dbxout_end_block): New. (dbx_debug_hooks): Add new hooks. (xcoff_debug_hooks): New. * debug.c (debug_nothing_file_int_int): New. (do_nothing_debug_hooks): Update. * debug.h (gcc_debug_hooks): New hooks begin_block and end_block. (debug_nothing_file_int_int): New. * dwarf2out.c (dwarf2out_begin_block, dwarf2out_end_block): Make static, update prototype. (dwarf2_debug_hooks): Update. * dwarf2out.h (dwarf2out_begin_block, dwarf2out_end_block): Remove. * dwarfout.c (dwarfout_begin_block, dwarfout_end_block): Make static, update prototype. (dwarf_debug_hooks): Update. * dwarfout.h (dwarfout_begin_block, dwarfout_end_block): Remove. * final.c: Include debug.h. (final_scan_insn): Use debug hooks when beginning and ending blocks. * sdbout.c (sdbout_begin_block, sdbout_end_block): Make static, update prototype. (sdb_debug_hooks): Update. * sdbout.h (sdbout_begin_block, sdbout_end_block): Remove. * toplev.c: Distinguish between xcoff and dbx. * f/lex.c (ffelex_file_pop_, ffelex_file_push_, ffelex_hash_): Call all debug hooks, not just dwarf ones. From-SVN: r43959 --- gcc/ChangeLog | 29 ++++++++++++++++++++++++++++ gcc/Makefile.in | 2 +- gcc/dbxout.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++- gcc/debug.c | 12 +++++++++++- gcc/debug.h | 10 ++++++++++ gcc/dwarf2out.c | 22 +++++++++++++++------- gcc/dwarf2out.h | 2 -- gcc/dwarfout.c | 22 +++++++++++++++------- gcc/dwarfout.h | 2 -- gcc/f/lex.c | 12 ++++-------- gcc/final.c | 45 ++++---------------------------------------- gcc/sdbout.c | 16 ++++++++++------ gcc/sdbout.h | 3 --- gcc/toplev.c | 8 ++++++-- 14 files changed, 154 insertions(+), 81 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fd9857f1b14..866a6d6869f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,32 @@ +2001-07-12 Neil Booth + + * Makefile.in (final.o): Depend on debug.h. + * dbxout.c (dbxout_begin_block, dbxout_end_block): New. + (dbx_debug_hooks): Add new hooks. + (xcoff_debug_hooks): New. + * debug.c (debug_nothing_file_int_int): New. + (do_nothing_debug_hooks): Update. + * debug.h (gcc_debug_hooks): New hooks begin_block and end_block. + (debug_nothing_file_int_int): New. + * dwarf2out.c (dwarf2out_begin_block, dwarf2out_end_block): Make + static, update prototype. + (dwarf2_debug_hooks): Update. + * dwarf2out.h (dwarf2out_begin_block, dwarf2out_end_block): Remove. + * dwarfout.c (dwarfout_begin_block, dwarfout_end_block): Make + static, update prototype. + (dwarf_debug_hooks): Update. + * dwarfout.h (dwarfout_begin_block, dwarfout_end_block): Remove. + * final.c: Include debug.h. + (final_scan_insn): Use debug hooks when beginning and ending blocks. + * sdbout.c (sdbout_begin_block, sdbout_end_block): Make + static, update prototype. + (sdb_debug_hooks): Update. + * sdbout.h (sdbout_begin_block, sdbout_end_block): Remove. + * toplev.c: Distinguish between xcoff and dbx. + + * f/lex.c (ffelex_file_pop_, ffelex_file_push_, ffelex_hash_): + Call all debug hooks, not just dwarf ones. + 2001-07-11 Timothy Wall * config.gcc: Add configuration for AIX5/IA64. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index beb097ce275..a03f77f19dc 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1523,7 +1523,7 @@ sched-vis.o : sched-vis.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \ hard-reg-set.h $(BASIC_BLOCK_H) $(INSN_ATTR_H) $(REGS_H) $(TM_P_H) final.o : final.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h intl.h \ $(REGS_H) $(RECOG_H) conditions.h insn-config.h $(INSN_ATTR_H) function.h \ - real.h output.h hard-reg-set.h except.h \ + real.h output.h hard-reg-set.h except.h debug.h \ xcoffout.h toplev.h reload.h dwarfout.h dwarf2out.h sdbout.h \ dbxout.h $(BASIC_BLOCK_H) $(TM_P_H) $(TARGET_H) recog.o : recog.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) function.h $(BASIC_BLOCK_H) \ diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 2a16e4dd8d9..d88b8eb609d 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -312,6 +312,11 @@ static void dbxout_block PARAMS ((tree, int, tree)); static void dbxout_really_begin_function PARAMS ((tree)); /* The debug hooks structure. */ +#if defined (DBX_DEBUGGING_INFO) + +static void dbxout_begin_block PARAMS ((FILE *, unsigned, unsigned)); +static void dbxout_end_block PARAMS ((FILE *, unsigned, unsigned)); + struct gcc_debug_hooks dbx_debug_hooks = { dbxout_init, @@ -319,8 +324,25 @@ struct gcc_debug_hooks dbx_debug_hooks = debug_nothing_int_charstar, debug_nothing_int_charstar, dbxout_start_source_file, - dbxout_end_source_file + dbxout_end_source_file, + dbxout_begin_block, + dbxout_end_block }; +#endif /* DBX_DEBUGGING_INFO */ + +#if defined (XCOFF_DEBUGGING_INFO) +struct gcc_debug_hooks xcoff_debug_hooks = +{ + dbxout_init, + dbxout_finish, + debug_nothing_int_charstar, + debug_nothing_int_charstar, + dbxout_start_source_file, + dbxout_end_source_file, + xcoffout_begin_block, + xcoffout_end_block +}; +#endif /* XCOFF_DEBUGGING_INFO */ #if defined(ASM_OUTPUT_SECTION_NAME) static void @@ -549,6 +571,32 @@ dbxout_source_line (file, filename, lineno) #endif } +#if defined (DBX_DEBUGGING_INFO) + +/* Describe the beginning of an internal block within a function. */ + +static void +dbxout_begin_block (file, line, n) + FILE *file; + unsigned int line ATTRIBUTE_UNUSED; + unsigned int n; +{ + ASM_OUTPUT_INTERNAL_LABEL (file, "LBB", n); +} + +/* Describe the end line-number of an internal block within a function. */ + +static void +dbxout_end_block (file, line, n) + FILE *file; + unsigned int line ATTRIBUTE_UNUSED; + unsigned int n; +{ + ASM_OUTPUT_INTERNAL_LABEL (file, "LBE", n); +} + +#endif /* DBX_DEBUGGING_INFO */ + /* At the end of compilation, finish writing the symbol table. Unless you define DBX_OUTPUT_MAIN_SOURCE_FILE_END, the default is to do nothing. */ diff --git a/gcc/debug.c b/gcc/debug.c index 0b750ac7870..5fb9a6f4722 100644 --- a/gcc/debug.c +++ b/gcc/debug.c @@ -27,7 +27,9 @@ struct gcc_debug_hooks do_nothing_debug_hooks = debug_nothing_int_charstar, debug_nothing_int_charstar, debug_nothing_int_charstar, - debug_nothing_int + debug_nothing_int, + debug_nothing_file_int_int, + debug_nothing_file_int_int }; /* This file contains implementations of each debug hook that do @@ -52,3 +54,11 @@ debug_nothing_int (line) unsigned int line ATTRIBUTE_UNUSED; { } + +void +debug_nothing_file_int_int (file, line, n) + FILE *file ATTRIBUTE_UNUSED; + unsigned int line ATTRIBUTE_UNUSED; + unsigned int n ATTRIBUTE_UNUSED; +{ +} diff --git a/gcc/debug.h b/gcc/debug.h index 9b7e28a5958..755ac0ae9ee 100644 --- a/gcc/debug.h +++ b/gcc/debug.h @@ -43,6 +43,13 @@ struct gcc_debug_hooks /* Record the resumption of a source file. LINE is the line number in the source file we are returning to. */ void (* end_source_file) PARAMS ((unsigned int line)); + + /* Record the beginning of block N, counting from 1 and not + including the function-scope block, at LINE. Output to FILE. */ + void (* begin_block) PARAMS ((FILE *, unsigned int line, unsigned int n)); + + /* Record the end of a block. Arguments as for begin_block. */ + void (* end_block) PARAMS ((FILE *, unsigned int line, unsigned int n)); }; extern struct gcc_debug_hooks *debug_hooks; @@ -54,11 +61,14 @@ extern void debug_nothing_int_charstar PARAMS ((unsigned int, const char *)); extern void debug_nothing_int PARAMS ((unsigned int)); +extern void debug_nothing_file_int_int + PARAMS ((FILE *, unsigned int, unsigned int)); /* Hooks for various debug formats. */ extern struct gcc_debug_hooks do_nothing_debug_hooks; extern struct gcc_debug_hooks dbx_debug_hooks; extern struct gcc_debug_hooks sdb_debug_hooks; +extern struct gcc_debug_hooks xcoff_debug_hooks; extern struct gcc_debug_hooks dwarf_debug_hooks; extern struct gcc_debug_hooks dwarf2_debug_hooks; diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index dc8d64a090a..c0359d3cd4c 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -3007,6 +3007,8 @@ static void dwarf2out_define PARAMS ((unsigned int, const char *)); static void dwarf2out_undef PARAMS ((unsigned int, const char *)); static void dwarf2out_start_source_file PARAMS ((unsigned, const char *)); static void dwarf2out_end_source_file PARAMS ((unsigned)); +static void dwarf2out_begin_block PARAMS ((FILE *, unsigned, unsigned)); +static void dwarf2out_end_block PARAMS ((FILE *, unsigned, unsigned)); /* The debug hooks structure. */ @@ -3017,7 +3019,9 @@ struct gcc_debug_hooks dwarf2_debug_hooks = dwarf2out_define, dwarf2out_undef, dwarf2out_start_source_file, - dwarf2out_end_source_file + dwarf2out_end_source_file, + dwarf2out_begin_block, + dwarf2out_end_block }; /* NOTE: In the comments in this file, many references are made to @@ -11103,9 +11107,11 @@ dwarf2out_decl (decl) /* Output a marker (i.e. a label) for the beginning of the generated code for a lexical block. */ -void -dwarf2out_begin_block (blocknum) - register unsigned blocknum; +static void +dwarf2out_begin_block (file, line, blocknum) + FILE *file ATTRIBUTE_UNUSED; + unsigned int line ATTRIBUTE_UNUSED; + unsigned int blocknum; { function_section (current_function_decl); ASM_OUTPUT_DEBUG_LABEL (asm_out_file, BLOCK_BEGIN_LABEL, blocknum); @@ -11114,9 +11120,11 @@ dwarf2out_begin_block (blocknum) /* Output a marker (i.e. a label) for the end of the generated code for a lexical block. */ -void -dwarf2out_end_block (blocknum) - register unsigned blocknum; +static void +dwarf2out_end_block (file, line, blocknum) + FILE *file ATTRIBUTE_UNUSED; + unsigned int line ATTRIBUTE_UNUSED; + unsigned int blocknum; { function_section (current_function_decl); ASM_OUTPUT_DEBUG_LABEL (asm_out_file, BLOCK_END_LABEL, blocknum); diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h index 726ad0061a6..4250dfd7270 100644 --- a/gcc/dwarf2out.h +++ b/gcc/dwarf2out.h @@ -18,8 +18,6 @@ along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -extern void dwarf2out_begin_block PARAMS ((unsigned)); -extern void dwarf2out_end_block PARAMS ((unsigned)); extern int dwarf2out_ignore_block PARAMS ((tree)); extern void dwarf2out_decl PARAMS ((tree)); extern void dwarf2out_line PARAMS ((const char *, unsigned)); diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index f5fa7c424e5..3263f107c5f 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -795,6 +795,8 @@ static void dwarfout_start_source_file PARAMS ((unsigned, const char *)); static void dwarfout_start_source_file_check PARAMS ((unsigned, const char *)); static void dwarfout_end_source_file PARAMS ((unsigned)); static void dwarfout_end_source_file_check PARAMS ((unsigned)); +static void dwarfout_begin_block PARAMS ((FILE *, unsigned, unsigned)); +static void dwarfout_end_block PARAMS ((FILE *, unsigned, unsigned)); static const char *dwarf_tag_name PARAMS ((unsigned)); static const char *dwarf_attr_name PARAMS ((unsigned)); static const char *dwarf_stack_op_name PARAMS ((unsigned)); @@ -1375,7 +1377,9 @@ struct gcc_debug_hooks dwarf_debug_hooks = dwarfout_define, dwarfout_undef, dwarfout_start_source_file_check, - dwarfout_end_source_file_check + dwarfout_end_source_file_check, + dwarfout_begin_block, + dwarfout_end_block }; /************************ general utility functions **************************/ @@ -5833,9 +5837,11 @@ dwarfout_file_scope_decl (decl, set_finalizing) /* Output a marker (i.e. a label) for the beginning of the generated code for a lexical block. */ -void -dwarfout_begin_block (blocknum) - register unsigned blocknum; +static void +dwarfout_begin_block (file, line, blocknum) + FILE *file ATTRIBUTE_UNUSED; + unsigned int line ATTRIBUTE_UNUSED; + unsigned int blocknum; { char label[MAX_ARTIFICIAL_LABEL_BYTES]; @@ -5847,9 +5853,11 @@ dwarfout_begin_block (blocknum) /* Output a marker (i.e. a label) for the end of the generated code for a lexical block. */ -void -dwarfout_end_block (blocknum) - register unsigned blocknum; +static void +dwarfout_end_block (file, line, blocknum) + FILE *file ATTRIBUTE_UNUSED; + unsigned int line ATTRIBUTE_UNUSED; + unsigned int blocknum; { char label[MAX_ARTIFICIAL_LABEL_BYTES]; diff --git a/gcc/dwarfout.h b/gcc/dwarfout.h index a72db0515cd..9e4ca6275b6 100644 --- a/gcc/dwarfout.h +++ b/gcc/dwarfout.h @@ -24,7 +24,5 @@ extern void dwarfout_begin_function PARAMS ((void)); extern void dwarfout_end_function PARAMS ((void)); extern void dwarfout_begin_epilogue PARAMS ((void)); extern void dwarfout_end_epilogue PARAMS ((void)); -extern void dwarfout_begin_block PARAMS ((unsigned)); -extern void dwarfout_end_block PARAMS ((unsigned)); extern void dwarfout_line PARAMS ((const char *, unsigned)); diff --git a/gcc/f/lex.c b/gcc/f/lex.c index 70f666aaf44..05e627bdc8b 100644 --- a/gcc/f/lex.c +++ b/gcc/f/lex.c @@ -857,8 +857,7 @@ ffelex_file_pop_ (const char *input_filename) input_file_stack = p->next; free (p); input_file_stack_tick++; - if (write_symbols == DWARF_DEBUG) - (*debug_hooks->end_source_file) (input_file_stack->line); + (*debug_hooks->end_source_file) (input_file_stack->line); } else error ("#-lines for entering and leaving files don't match"); @@ -883,8 +882,7 @@ ffelex_file_push_ (int old_lineno, const char *input_filename) input_file_stack = p; input_file_stack_tick++; - if (write_symbols == DWARF_DEBUG) - (*debug_hooks->start_source_file) (0, input_filename); + (*debug_hooks->start_source_file) (0, input_filename); /* Now that we've pushed or popped the input stack, update the name in the top element. */ @@ -1165,8 +1163,7 @@ ffelex_hash_ (FILE *finput) c = ffelex_get_directive_line_ (&text, finput); - if ((debug_info_level == DINFO_LEVEL_VERBOSE) - && (write_symbols == DWARF_DEBUG)) + if (debug_info_level == DINFO_LEVEL_VERBOSE) (*debug_hooks->define) (lineno, text); goto skipline; @@ -1185,8 +1182,7 @@ ffelex_hash_ (FILE *finput) c = ffelex_get_directive_line_ (&text, finput); - if ((debug_info_level == DINFO_LEVEL_VERBOSE) - && (write_symbols == DWARF_DEBUG)) + if (debug_info_level == DINFO_LEVEL_VERBOSE) (*debug_hooks->undef) (lineno, text); goto skipline; diff --git a/gcc/final.c b/gcc/final.c index f257ea94095..99cc446216f 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -66,6 +66,7 @@ Boston, MA 02111-1307, USA. */ #include "intl.h" #include "basic-block.h" #include "target.h" +#include "debug.h" #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO) #include "dbxout.h" @@ -2138,27 +2139,8 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) ++block_depth; high_block_linenum = last_linenum; - /* Output debugging info about the symbol-block beginning. */ -#ifdef SDB_DEBUGGING_INFO - if (write_symbols == SDB_DEBUG) - sdbout_begin_block (file, last_linenum, n); -#endif -#ifdef XCOFF_DEBUGGING_INFO - if (write_symbols == XCOFF_DEBUG) - xcoffout_begin_block (file, last_linenum, n); -#endif -#ifdef DBX_DEBUGGING_INFO - if (write_symbols == DBX_DEBUG) - ASM_OUTPUT_INTERNAL_LABEL (file, "LBB", n); -#endif -#ifdef DWARF_DEBUGGING_INFO - if (write_symbols == DWARF_DEBUG) - dwarfout_begin_block (n); -#endif -#ifdef DWARF2_DEBUGGING_INFO - if (write_symbols == DWARF2_DEBUG) - dwarf2out_begin_block (n); -#endif + /* Output debugging info about the symbol-block beginning. */ + (*debug_hooks->begin_block) (file, last_linenum, n); /* Mark this block as output. */ TREE_ASM_WRITTEN (NOTE_BLOCK (insn)) = 1; @@ -2180,26 +2162,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) if (block_depth < 0) abort (); -#ifdef XCOFF_DEBUGGING_INFO - if (write_symbols == XCOFF_DEBUG) - xcoffout_end_block (file, high_block_linenum, n); -#endif -#ifdef DBX_DEBUGGING_INFO - if (write_symbols == DBX_DEBUG) - ASM_OUTPUT_INTERNAL_LABEL (file, "LBE", n); -#endif -#ifdef SDB_DEBUGGING_INFO - if (write_symbols == SDB_DEBUG) - sdbout_end_block (file, high_block_linenum, n); -#endif -#ifdef DWARF_DEBUGGING_INFO - if (write_symbols == DWARF_DEBUG) - dwarfout_end_block (n); -#endif -#ifdef DWARF2_DEBUGGING_INFO - if (write_symbols == DWARF2_DEBUG) - dwarf2out_end_block (n); -#endif + (*debug_hooks->end_block) (file, high_block_linenum, n); } break; diff --git a/gcc/sdbout.c b/gcc/sdbout.c index 47d34c17a84..aecdcf7826f 100644 --- a/gcc/sdbout.c +++ b/gcc/sdbout.c @@ -95,6 +95,8 @@ extern tree current_function_decl; static void sdbout_init PARAMS ((FILE *, const char *)); static void sdbout_start_source_file PARAMS ((unsigned, const char *)); static void sdbout_end_source_file PARAMS ((unsigned)); +static void sdbout_begin_block PARAMS ((FILE *, unsigned, unsigned)); +static void sdbout_end_block PARAMS ((FILE *, unsigned, unsigned)); static char *gen_fake_label PARAMS ((void)); static int plain_type PARAMS ((tree)); static int template_name_p PARAMS ((tree)); @@ -299,7 +301,9 @@ struct gcc_debug_hooks sdb_debug_hooks = debug_nothing_int_charstar, debug_nothing_int_charstar, sdbout_start_source_file, - sdbout_end_source_file + sdbout_end_source_file, + sdbout_begin_block, + sdbout_end_block }; #if 0 @@ -1466,11 +1470,11 @@ sdbout_reg_parms (parms) The blocks match the BLOCKs in DECL_INITIAL (current_function_decl), if the count starts at 0 for the outermost one. */ -void +static void sdbout_begin_block (file, line, n) FILE *file ATTRIBUTE_UNUSED; - int line; - int n; + unsigned int line; + unsigned int n; { tree decl = current_function_decl; MAKE_LINE_SAFE (line); @@ -1507,8 +1511,8 @@ sdbout_begin_block (file, line, n) void sdbout_end_block (file, line, n) FILE *file ATTRIBUTE_UNUSED; - int line; - int n ATTRIBUTE_UNUSED; + unsigned int line; + unsigned int n ATTRIBUTE_UNUSED; { MAKE_LINE_SAFE (line); diff --git a/gcc/sdbout.h b/gcc/sdbout.h index 1697ffd91f3..0118cd1dafb 100644 --- a/gcc/sdbout.h +++ b/gcc/sdbout.h @@ -21,9 +21,6 @@ Boston, MA 02111-1307, USA. */ extern void sdbout_begin_function PARAMS ((int)); extern void sdbout_end_function PARAMS ((int)); -extern void sdbout_begin_block PARAMS ((FILE *, int, int)); -extern void sdbout_end_block PARAMS ((FILE *, int, int)); - extern void sdbout_label PARAMS ((rtx)); extern void sdbout_symbol PARAMS ((tree, int)); extern void sdbout_toplevel_data PARAMS ((tree)); diff --git a/gcc/toplev.c b/gcc/toplev.c index c42a243ba51..f99e9d4a4f3 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2289,10 +2289,14 @@ compile_file (name) /* Set up the debug hooks based on write_symbols. Default to doing nothing. */ debug_hooks = &do_nothing_debug_hooks; -#if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) - if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG) +#if defined(DBX_DEBUGGING_INFO) + if (write_symbols == DBX_DEBUG) debug_hooks = &dbx_debug_hooks; #endif +#if defined(XCOFF_DEBUGGING_INFO) + if (write_symbols == XCOFF_DEBUG) + debug_hooks = &xcoff_debug_hooks; +#endif #ifdef SDB_DEBUGGING_INFO if (write_symbols == SDB_DEBUG) debug_hooks = &sdb_debug_hooks; -- 2.30.2