dbxout.c (dbxout_global_decl): New.
* dbxout.c (dbxout_global_decl): New. (xcoff_debug_hooks, dbx_debug_hooks): Use it. * sdbout.c (sdbout_finish): New. (sdbout_debug_hooks): Use it, add comments. (sdbout_global_decl): Defer initialised public vars to sdbout_finish. * varasm.c (assemble_variable): Don't output debug information for file-scope variables. Co-Authored-By: Richard Henderson <rth@redhat.com> From-SVN: r44232
This commit is contained in:
parent
919b1aecc7
commit
f7e1058777
|
@ -1,3 +1,15 @@
|
||||||
|
2001-07-21 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||||
|
Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
|
* dbxout.c (dbxout_global_decl): New.
|
||||||
|
(xcoff_debug_hooks, dbx_debug_hooks): Use it.
|
||||||
|
* sdbout.c (sdbout_finish): New.
|
||||||
|
(sdbout_debug_hooks): Use it, add comments.
|
||||||
|
(sdbout_global_decl): Defer initialised public vars to
|
||||||
|
sdbout_finish.
|
||||||
|
* varasm.c (assemble_variable): Don't output debug information
|
||||||
|
for file-scope variables.
|
||||||
|
|
||||||
2001-07-21 H.J. Lu (hjl@gnu.org)
|
2001-07-21 H.J. Lu (hjl@gnu.org)
|
||||||
|
|
||||||
* config/mips/mips.c (mips_cpu): Moved into ...
|
* config/mips/mips.c (mips_cpu): Moved into ...
|
||||||
|
|
14
gcc/dbxout.c
14
gcc/dbxout.c
|
@ -313,6 +313,7 @@ static void dbxout_prepare_symbol PARAMS ((tree));
|
||||||
static void dbxout_finish_symbol PARAMS ((tree));
|
static void dbxout_finish_symbol PARAMS ((tree));
|
||||||
static void dbxout_block PARAMS ((tree, int, tree));
|
static void dbxout_block PARAMS ((tree, int, tree));
|
||||||
static void dbxout_begin_function PARAMS ((tree));
|
static void dbxout_begin_function PARAMS ((tree));
|
||||||
|
static void dbxout_global_decl PARAMS ((tree));
|
||||||
|
|
||||||
/* The debug hooks structure. */
|
/* The debug hooks structure. */
|
||||||
#if defined (DBX_DEBUGGING_INFO)
|
#if defined (DBX_DEBUGGING_INFO)
|
||||||
|
@ -343,7 +344,7 @@ struct gcc_debug_hooks dbx_debug_hooks =
|
||||||
#endif
|
#endif
|
||||||
debug_nothing_int, /* end_function */
|
debug_nothing_int, /* end_function */
|
||||||
dbxout_function_decl,
|
dbxout_function_decl,
|
||||||
debug_nothing_tree, /* global_decl */
|
dbxout_global_decl, /* global_decl */
|
||||||
debug_nothing_tree, /* deferred_inline_function */
|
debug_nothing_tree, /* deferred_inline_function */
|
||||||
debug_nothing_tree, /* outlining_inline_function */
|
debug_nothing_tree, /* outlining_inline_function */
|
||||||
debug_nothing_rtx /* label */
|
debug_nothing_rtx /* label */
|
||||||
|
@ -369,7 +370,7 @@ struct gcc_debug_hooks xcoff_debug_hooks =
|
||||||
debug_nothing_tree, /* begin_function */
|
debug_nothing_tree, /* begin_function */
|
||||||
xcoffout_end_function,
|
xcoffout_end_function,
|
||||||
debug_nothing_tree, /* function_decl */
|
debug_nothing_tree, /* function_decl */
|
||||||
debug_nothing_tree, /* global_decl */
|
dbxout_global_decl, /* global_decl */
|
||||||
debug_nothing_tree, /* deferred_inline_function */
|
debug_nothing_tree, /* deferred_inline_function */
|
||||||
debug_nothing_tree, /* outlining_inline_function */
|
debug_nothing_tree, /* outlining_inline_function */
|
||||||
debug_nothing_rtx /* label */
|
debug_nothing_rtx /* label */
|
||||||
|
@ -623,6 +624,15 @@ dbxout_end_block (line, n)
|
||||||
ASM_OUTPUT_INTERNAL_LABEL (asmfile, "LBE", n);
|
ASM_OUTPUT_INTERNAL_LABEL (asmfile, "LBE", n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
}
|
||||||
|
|
||||||
/* Output dbx data for a function definition.
|
/* Output dbx data for a function definition.
|
||||||
This includes a definition of the function name itself (a symbol),
|
This includes a definition of the function name itself (a symbol),
|
||||||
definitions of the parameters (locating them in the parameter list)
|
definitions of the parameters (locating them in the parameter list)
|
||||||
|
|
74
gcc/sdbout.c
74
gcc/sdbout.c
|
@ -93,6 +93,7 @@ extern tree current_function_decl;
|
||||||
#include "sdbout.h"
|
#include "sdbout.h"
|
||||||
|
|
||||||
static void sdbout_init PARAMS ((const char *));
|
static void sdbout_init PARAMS ((const char *));
|
||||||
|
static void sdbout_finish PARAMS ((const char *));
|
||||||
static void sdbout_start_source_file PARAMS ((unsigned, const char *));
|
static void sdbout_start_source_file PARAMS ((unsigned, const char *));
|
||||||
static void sdbout_end_source_file PARAMS ((unsigned));
|
static void sdbout_end_source_file PARAMS ((unsigned));
|
||||||
static void sdbout_begin_block PARAMS ((unsigned, unsigned));
|
static void sdbout_begin_block PARAMS ((unsigned, unsigned));
|
||||||
|
@ -124,6 +125,7 @@ static void sdbout_field_types PARAMS ((tree));
|
||||||
static void sdbout_one_type PARAMS ((tree));
|
static void sdbout_one_type PARAMS ((tree));
|
||||||
static void sdbout_parms PARAMS ((tree));
|
static void sdbout_parms PARAMS ((tree));
|
||||||
static void sdbout_reg_parms PARAMS ((tree));
|
static void sdbout_reg_parms PARAMS ((tree));
|
||||||
|
static void sdbout_global_decl PARAMS ((tree));
|
||||||
|
|
||||||
/* Random macros describing parts of SDB data. */
|
/* Random macros describing parts of SDB data. */
|
||||||
|
|
||||||
|
@ -298,16 +300,16 @@ static struct sdb_file *current_file;
|
||||||
/* The debug hooks structure. */
|
/* The debug hooks structure. */
|
||||||
struct gcc_debug_hooks sdb_debug_hooks =
|
struct gcc_debug_hooks sdb_debug_hooks =
|
||||||
{
|
{
|
||||||
sdbout_init,
|
sdbout_init, /* init */
|
||||||
debug_nothing_charstar,
|
sdbout_finish, /* finish */
|
||||||
debug_nothing_int_charstar,
|
debug_nothing_int_charstar, /* define */
|
||||||
debug_nothing_int_charstar,
|
debug_nothing_int_charstar, /* undef */
|
||||||
sdbout_start_source_file,
|
sdbout_start_source_file, /* start_source_file */
|
||||||
sdbout_end_source_file,
|
sdbout_end_source_file, /* end_source_file */
|
||||||
sdbout_begin_block,
|
sdbout_begin_block, /* begin_block */
|
||||||
sdbout_end_block,
|
sdbout_end_block, /* end_block */
|
||||||
debug_true_tree, /* ignore_block */
|
debug_true_tree, /* ignore_block */
|
||||||
sdbout_source_line,
|
sdbout_source_line, /* source_line */
|
||||||
#ifdef MIPS_DEBUGGING_INFO
|
#ifdef MIPS_DEBUGGING_INFO
|
||||||
/* Defer on MIPS systems so that parameter descriptions follow
|
/* Defer on MIPS systems so that parameter descriptions follow
|
||||||
function entry. */
|
function entry. */
|
||||||
|
@ -317,11 +319,11 @@ struct gcc_debug_hooks sdb_debug_hooks =
|
||||||
sdbout_begin_prologue, /* begin_prologue */
|
sdbout_begin_prologue, /* begin_prologue */
|
||||||
debug_nothing_int, /* end_prologue */
|
debug_nothing_int, /* end_prologue */
|
||||||
#endif
|
#endif
|
||||||
sdbout_end_epilogue,
|
sdbout_end_epilogue, /* end_epilogue */
|
||||||
sdbout_begin_function,
|
sdbout_begin_function, /* begin_function */
|
||||||
sdbout_end_function,
|
sdbout_end_function, /* end_function */
|
||||||
debug_nothing_tree, /* function_decl */
|
debug_nothing_tree, /* function_decl */
|
||||||
sdbout_global_decl,
|
sdbout_global_decl, /* global_decl */
|
||||||
debug_nothing_tree, /* deferred_inline_function */
|
debug_nothing_tree, /* deferred_inline_function */
|
||||||
debug_nothing_tree, /* outlining_inline_function */
|
debug_nothing_tree, /* outlining_inline_function */
|
||||||
sdbout_label
|
sdbout_label
|
||||||
|
@ -1489,23 +1491,53 @@ sdbout_global_decl (decl)
|
||||||
tree decl;
|
tree decl;
|
||||||
{
|
{
|
||||||
if (TREE_CODE (decl) == VAR_DECL
|
if (TREE_CODE (decl) == VAR_DECL
|
||||||
&& DECL_INITIAL (decl)
|
&& !DECL_EXTERNAL (decl)
|
||||||
&& ! DECL_EXTERNAL (decl)
|
&& DECL_RTL_SET_P (decl))
|
||||||
&& DECL_RTL (decl) != 0)
|
|
||||||
{
|
{
|
||||||
/* The COFF linker can move initialized global vars to the end.
|
/* The COFF linker can move initialized global vars to the end.
|
||||||
And that can screw up the symbol ordering. By putting the
|
And that can screw up the symbol ordering. Defer those for
|
||||||
symbols in that order to begin with, we avoid a problem.
|
sdbout_finish (). */
|
||||||
mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
|
if (!DECL_INITIAL (decl) || !TREE_PUBLIC (decl))
|
||||||
if (TREE_PUBLIC (decl))
|
|
||||||
sdbout_symbol (decl, 0);
|
sdbout_symbol (decl, 0);
|
||||||
|
|
||||||
/* Output COFF information for non-global file-scope initialized
|
/* Output COFF information for non-global file-scope initialized
|
||||||
variables. */
|
variables. */
|
||||||
if (GET_CODE (DECL_RTL (decl)) == MEM)
|
if (DECL_INITIAL (decl) && GET_CODE (DECL_RTL (decl)) == MEM)
|
||||||
sdbout_toplevel_data (decl);
|
sdbout_toplevel_data (decl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Output initialized global vars at the end, in the order of
|
||||||
|
definition. See comment in sdbout_global_decl. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
sdbout_finish (main_filename)
|
||||||
|
const char *main_filename ATTRIBUTE_UNUSED;
|
||||||
|
{
|
||||||
|
tree decl = getdecls ();
|
||||||
|
unsigned int len = list_length (decl);
|
||||||
|
tree *vec = (tree *) xmalloc (sizeof (tree) * len);
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
/* Process the decls in reverse order--earliest first. Put them
|
||||||
|
into VEC from back to front, then take out from front. */
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++, decl = TREE_CHAIN (decl))
|
||||||
|
vec[len - i - 1] = decl;
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
decl = vec[i];
|
||||||
|
if (TREE_CODE (decl) == VAR_DECL
|
||||||
|
&& ! DECL_EXTERNAL (decl)
|
||||||
|
&& DECL_INITIAL (decl)
|
||||||
|
&& TREE_PUBLIC (decl)
|
||||||
|
&& DECL_RTL_SET_P (decl))
|
||||||
|
sdbout_symbol (decl, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
free (vec);
|
||||||
|
}
|
||||||
|
|
||||||
/* Describe the beginning of an internal block within a function.
|
/* Describe the beginning of an internal block within a function.
|
||||||
Also output descriptions of variables defined in this block.
|
Also output descriptions of variables defined in this block.
|
||||||
|
|
89
gcc/varasm.c
89
gcc/varasm.c
|
@ -1232,44 +1232,6 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
|
||||||
|
|
||||||
last_assemble_variable_decl = 0;
|
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,
|
/* Normally no need to say anything here for external references,
|
||||||
since assemble_external is called by the language-specific code
|
since assemble_external is called by the language-specific code
|
||||||
when a declaration is first seen. */
|
when a declaration is first seen. */
|
||||||
|
@ -1283,6 +1245,13 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
|
||||||
if (TREE_CODE (decl) == FUNCTION_DECL)
|
if (TREE_CODE (decl) == FUNCTION_DECL)
|
||||||
return;
|
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,
|
/* If type was incomplete when the variable was declared,
|
||||||
see if it is complete now. */
|
see if it is complete now. */
|
||||||
|
|
||||||
|
@ -1411,27 +1380,6 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
|
||||||
(decl, "requested alignment for %s is greater than implemented alignment of %d.",rounded);
|
(decl, "requested alignment for %s is greater than implemented alignment of %d.",rounded);
|
||||||
#endif
|
#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
|
#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. */
|
it was intended to do and why we shouldn't delete it. */
|
||||||
if (flag_shared_data)
|
if (flag_shared_data)
|
||||||
|
@ -1494,29 +1442,6 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
|
||||||
/* Record current section so we can restore it if dbxout.c clobbers it. */
|
/* Record current section so we can restore it if dbxout.c clobbers it. */
|
||||||
saved_in_section = in_section;
|
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
|
/* If the debugging output changed sections, reselect the section
|
||||||
that's supposed to be selected. */
|
that's supposed to be selected. */
|
||||||
if (in_section != saved_in_section)
|
if (in_section != saved_in_section)
|
||||||
|
|
Loading…
Reference in New Issue