This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Another 3 debug hooks
On Fri, Jul 20, 2001 at 07:08:21AM +0100, Neil Booth wrote:
> Are you saying that sdb do it from assemble_variable only (and the
> deferred stuff in the finish hook?)
No, rather the other way around -- don't do _any_ output from
assemble_variable and to it all in check_global_declarations.
Stabs info shouldn't care what order these things are in so
long as they are present somewhere; I would think that sdb
info would be the same. To be sure, I tested the following
patchlet vs the gdb testsuite on i686-linux and as I expected,
no regressions.
I didn't clean up the sdb side here. To preserve the existing
hack, you'll still need to delay public initialized decls so
that they get sorted to the end. I don't think you need to
actually queue them, since the whole list is available via
getdecls().
r~
Index: dbxout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dbxout.c,v
retrieving revision 1.94
diff -u -p -r1.94 dbxout.c
--- dbxout.c 2001/07/19 21:17:07 1.94
+++ dbxout.c 2001/07/20 21:15:42
@@ -313,6 +313,7 @@ static void dbxout_prepare_symbol PARAMS
static void dbxout_finish_symbol PARAMS ((tree));
static void dbxout_block PARAMS ((tree, int, tree));
static void dbxout_begin_function PARAMS ((tree));
+static void dbxout_global_decl PARAMS ((tree));
/* The debug hooks structure. */
#if defined (DBX_DEBUGGING_INFO)
@@ -343,7 +344,7 @@ struct gcc_debug_hooks dbx_debug_hooks =
#endif
debug_nothing_int, /* end_function */
dbxout_function_decl,
- debug_nothing_tree, /* global_decl */
+ dbxout_global_decl,
debug_nothing_tree, /* deferred_inline_function */
debug_nothing_tree, /* outlining_inline_function */
debug_nothing_rtx /* label */
@@ -369,7 +370,7 @@ struct gcc_debug_hooks xcoff_debug_hooks
debug_nothing_tree, /* begin_function */
xcoffout_end_function,
debug_nothing_tree, /* function_decl */
- debug_nothing_tree, /* global_decl */
+ dbxout_global_decl, /* global_decl */
debug_nothing_tree, /* deferred_inline_function */
debug_nothing_tree, /* outlining_inline_function */
debug_nothing_rtx /* label */
@@ -599,6 +600,15 @@ dbxout_source_line (lineno, filename)
#else
fprintf (asmfile, "%s%d,0,%d\n", ASM_STABD_OP, N_SLINE, lineno);
#endif
+}
+
+/* Debug information for a global DECL. Called from toplev.c after
+ compilation proper has finished. */
+static void
+dbxout_global_decl (decl)
+ tree decl;
+{
+ dbxout_symbol (decl, 0);
}
#if defined (DBX_DEBUGGING_INFO)
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.178
diff -u -p -r1.178 varasm.c
--- varasm.c 2001/07/17 19:47:58 1.178
+++ varasm.c 2001/07/20 21:15:43
@@ -1232,44 +1232,6 @@ assemble_variable (decl, top_level, at_e
last_assemble_variable_decl = 0;
- if (DECL_RTL_SET_P (decl) && GET_CODE (DECL_RTL (decl)) == REG)
- {
- /* Do output symbol info for global register variables, but do nothing
- else for them. */
-
- if (TREE_ASM_WRITTEN (decl))
- return;
- TREE_ASM_WRITTEN (decl) = 1;
-
- /* Do no output if -fsyntax-only. */
- if (flag_syntax_only)
- return;
-
-#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
- /* File-scope global variables are output here. */
- if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
- && top_level)
- dbxout_symbol (decl, 0);
-#endif
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG && top_level
- /* Leave initialized global vars for end of compilation;
- see comment in compile_file. */
- && (TREE_PUBLIC (decl) == 0 || DECL_INITIAL (decl) == 0))
- sdbout_symbol (decl, 0);
-#endif
-
- /* Don't output any DWARF debugging information for variables here.
- In the case of local variables, the information for them is output
- when we do our recursive traversal of the tree representation for
- the entire containing function. In the case of file-scope variables,
- we output information for all of them at the very end of compilation
- while we are doing our final traversal of the chain of file-scope
- declarations. */
-
- return;
- }
-
/* Normally no need to say anything here for external references,
since assemble_external is called by the language-specific code
when a declaration is first seen. */
@@ -1283,6 +1245,13 @@ assemble_variable (decl, top_level, at_e
if (TREE_CODE (decl) == FUNCTION_DECL)
return;
+ /* Do nothing for global register variables. */
+ if (DECL_RTL_SET_P (decl) && GET_CODE (DECL_RTL (decl)) == REG)
+ {
+ TREE_ASM_WRITTEN (decl) = 1;
+ return;
+ }
+
/* If type was incomplete when the variable was declared,
see if it is complete now. */
@@ -1411,27 +1380,6 @@ assemble_variable (decl, top_level, at_e
(decl, "requested alignment for %s is greater than implemented alignment of %d.",rounded);
#endif
-#ifdef DBX_DEBUGGING_INFO
- /* File-scope global variables are output here. */
- if (write_symbols == DBX_DEBUG && top_level)
- dbxout_symbol (decl, 0);
-#endif
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG && top_level
- /* Leave initialized global vars for end of compilation;
- see comment in compile_file. */
- && (TREE_PUBLIC (decl) == 0 || DECL_INITIAL (decl) == 0))
- sdbout_symbol (decl, 0);
-#endif
-
- /* Don't output any DWARF debugging information for variables here.
- In the case of local variables, the information for them is output
- when we do our recursive traversal of the tree representation for
- the entire containing function. In the case of file-scope variables,
- we output information for all of them at the very end of compilation
- while we are doing our final traversal of the chain of file-scope
- declarations. */
-
#if 0 /* ??? We should either delete this or add a comment describing what
it was intended to do and why we shouldn't delete it. */
if (flag_shared_data)
@@ -1493,29 +1441,6 @@ assemble_variable (decl, top_level, at_e
/* Record current section so we can restore it if dbxout.c clobbers it. */
saved_in_section = in_section;
-
- /* Output the dbx info now that we have chosen the section. */
-
-#ifdef DBX_DEBUGGING_INFO
- /* File-scope global variables are output here. */
- if (write_symbols == DBX_DEBUG && top_level)
- dbxout_symbol (decl, 0);
-#endif
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG && top_level
- /* Leave initialized global vars for end of compilation;
- see comment in compile_file. */
- && (TREE_PUBLIC (decl) == 0 || DECL_INITIAL (decl) == 0))
- sdbout_symbol (decl, 0);
-#endif
-
- /* Don't output any DWARF debugging information for variables here.
- In the case of local variables, the information for them is output
- when we do our recursive traversal of the tree representation for
- the entire containing function. In the case of file-scope variables,
- we output information for all of them at the very end of compilation
- while we are doing our final traversal of the chain of file-scope
- declarations. */
/* If the debugging output changed sections, reselect the section
that's supposed to be selected. */