This is the mail archive of the
mailing list for the GCC project.
[debug-early] emitting early debug for external variables
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: jason merrill <jason at redhat dot com>, Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Mailing List <gcc at gcc dot gnu dot org>
- Date: Wed, 18 Mar 2015 13:35:15 -0700
- Subject: [debug-early] emitting early debug for external variables
- Authentication-results: sourceware.org; auth=none
Since we pick global symbols to be emitted early from the symbol table,
we miss out on DECL_EXTERNAL's because they never appear in the symbol
else if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl)
&& TREE_STATIC (decl))
We could move the early_global_decl call right here, on demand for each
symbol, since it looks like all front-ends use rest_of_decl_compilation.
However, by rest_of_decl_compilation time, we don't know if a symbol
will be used (the parser hasn't set TREE_USED), and dwarf2out
specifically tries to avoid generating possibly useless externs:
/* Ignore this VAR_DECL if it refers to a file-scope extern data object
declaration and if the declaration was never even referenced from
within this entire compilation unit. We suppress these DIEs in
order to save space in the .debug section (by eliminating entries
which are probably useless).
I know Richi wanted debug information for _everything_, but I doubt
unused externs would make even him happy.
I can think of various ways of attacking this, none of which are void of
the words "kludge" or "hack" :). Did you guys have anything in mind
here, assuming the present functionality is the end goal here (unused
externs do NOT appear in the debug info)?