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]

Re: When to emit C++ debug info?



On Jan 3, 2004, at 10:12 PM, Geoff Keating wrote:


You can do what you do for C++ vtable output, use the linkage rules to
determine a single place, or a few places, that debug information
might need to be output.

For instance, you could do it like this: A given piece of debugging
information need not be placed in a .o file if the lexicographically
first external symbol used by the .o file, whose debugging information
requires that piece of information, is not defined in the same .o
file.  That is, in

struct x { int y; };
extern int bar (struct x *);
int foo (void) {
  struct x tt = { 3 };
  return bar(&tt);
}

we decide that because 'bar' is alphabetically before 'foo',
everything to do with 'bar' will already be output in its .o file, so
we don't have to output any of it here (including the definition of
'struct x').  For C++, you would decide that vtable definitions come
"before" everything else, so debug information gets output with the
vtable if there is one.

The idea is that it doesn't need to be perfect, since duplicate
information is harmless; just so long as you can eliminate most of the
duplicates.

If, while eliminating duplicate info., linker works only at compilation unit level (e.g. darwin linker) then this can bloat final binary. If linker can can consider and eliminate duplicate info for each DIE then this is close to perfect.

--
Devang


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