This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

begin_block, end_block debug hooks


... and removal of the Fortran front end's using dwarf only.  (Toon, I
have no way to test this for you - I know no Fortran, and little about
debug info).  However, I see no reason why one debug format should
work, and others not.  If that is the case, then there is a bug,
either in the FFE or in the debug code, and it's better to find it
than to hide it IMO.

This patch also splits out xcoff hooks from dbx hooks.

OK to commit?

Neil.

	* 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.

============================================================
Index: gcc/Makefile.in
--- gcc/Makefile.in	2001/07/11 20:51:45	1.697
+++ gcc/Makefile.in	2001/07/11 22:07:38
@@ -1523,7 +1523,7 @@ sched-vis.o : sched-vis.c $(CONFIG_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) \
============================================================
Index: gcc/dbxout.c
--- gcc/dbxout.c	2001/07/11 20:51:45	1.89
+++ gcc/dbxout.c	2001/07/11 22:07:47
@@ -312,6 +312,11 @@ static void dbxout_block		PARAMS ((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
@@ -548,6 +570,32 @@ dbxout_source_line (file, filename, line
   fprintf (file, "%s%d,0,%d\n", ASM_STABD_OP, N_SLINE, 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
============================================================
Index: gcc/debug.c
--- gcc/debug.c	2001/07/11 20:51:45	1.2
+++ gcc/debug.c	2001/07/11 22:07:47
@@ -27,7 +27,9 @@ struct gcc_debug_hooks do_nothing_debug_
   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
@@ -50,5 +52,13 @@ debug_nothing_int_charstar (line, text)
 void
 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;
 {
 }
============================================================
Index: gcc/debug.h
--- gcc/debug.h	2001/07/11 20:51:45	1.2
+++ gcc/debug.h	2001/07/11 22:07:48
@@ -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;
 
============================================================
Index: gcc/dwarf2out.c
--- gcc/dwarf2out.c	2001/07/11 20:51:45	1.288
+++ gcc/dwarf2out.c	2001/07/11 22:08:14
@@ -3007,6 +3007,8 @@ static void dwarf2out_define	        PAR
 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_hook
   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);
============================================================
Index: gcc/dwarf2out.h
--- gcc/dwarf2out.h	2001/07/11 20:51:45	1.15
+++ gcc/dwarf2out.h	2001/07/11 22:08:14
@@ -18,8 +18,6 @@ along with GNU CC; see the file COPYING.
 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));
============================================================
Index: gcc/dwarfout.c
--- gcc/dwarfout.c	2001/07/11 20:51:45	1.88
+++ gcc/dwarfout.c	2001/07/11 22:08:41
@@ -795,6 +795,8 @@ static void dwarfout_start_source_file	P
 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_fina
 /* 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];
 
============================================================
Index: gcc/dwarfout.h
--- gcc/dwarfout.h	2001/07/11 20:51:45	1.9
+++ gcc/dwarfout.h	2001/07/11 22:08:41
@@ -24,7 +24,5 @@ extern void dwarfout_begin_function	PARA
 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));
============================================================
Index: gcc/final.c
--- gcc/final.c	2001/07/09 11:20:51	1.182
+++ gcc/final.c	2001/07/11 22:09:10
@@ -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, p
 	      ++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, p
 	      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;
 
============================================================
Index: gcc/sdbout.c
--- gcc/sdbout.c	2001/07/11 20:51:45	1.45
+++ gcc/sdbout.c	2001/07/11 22:09:13
@@ -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);
 
============================================================
Index: gcc/sdbout.h
--- gcc/sdbout.h	2001/07/11 20:51:45	1.8
+++ gcc/sdbout.h	2001/07/11 22:09:13
@@ -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));
============================================================
Index: gcc/toplev.c
--- gcc/toplev.c	2001/07/11 20:51:45	1.482
+++ gcc/toplev.c	2001/07/11 22:09:28
@@ -2289,9 +2289,13 @@ 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)
============================================================
Index: gcc/f/lex.c
--- gcc/f/lex.c	2001/07/11 20:51:46	1.23
+++ gcc/f/lex.c	2001/07/11 22:09:43
@@ -857,8 +857,7 @@ ffelex_file_pop_ (const char *input_file
       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
   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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]