This is the mail archive of the gcc@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]
Other format: [Raw text]

[debug-early] emitting early debug for external variables


Gentlemen:

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 table:

[rest_of_decl_compilation]:
  else if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl)
	   && TREE_STATIC (decl))
    varpool_node::get_create (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)?

Aldy


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