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]

Re: Helping out GDB


In article <20000712134729R.mitchell@codesourcery.com> you write:
>Other tools depend on this being set.  The examples I know of our
>non-GNU tools, so we may or may not care, but some people will
>definitely complain if we remove this.

There are other tools that try to use gcc2_compiled, but they are all
misguided.  The change from gcc2 to gcc3 would be a good chance to drop this
historical baggage.

The gcc2_compiled symbol was originally emitted for the debugger.
Unfortunately there were so many practical problems with using it that
it was never reliable, and gdb had to stop using it.  It has been so long
since this issue was discussed that I don't remember all of the details.
I just remember that the problems were serious and intractable.

It is still useful for gdb to know whether code was gcc compiled or not, but
it doesn't get this info by looking at the symbol table, it gets it from
the debug info.  We already emit a gcc2_compiled. stab for gdb.  Ses
ASM_IDENTIFY_GCC_AFTER_SOURCE in config/dbxelf.h.  For dwarf and dwarf2
we emit this info in the producer string.  That only leaves sdb/coff,
and that format is hopeless anyways, so we don't care.

Some systems can't support the gcc2_compiled symbol.  Irix for instance.
The only thing that the Irix assembler allows in the text section is
well formed functions.  It doesn't allow naked labels.  Thus the irix
configurations don't emit the gcc2_compiled symbol.  There are other
targets that disable the gcc2_compiled symbol for other reasons.

The gcc2_compiled symbol can interfere with profilers.  It used to be that
you could run gprof and it would tell you that X% of the time was spent
in gcc2_compiled.  That is because the output looked like gcc2_compiled
was the name of the first function.  We fixed that by emitting a nop after
the gcc2_compiled label.  But that creates yet another problem, it makes
the code bigger, 4 bytes per module for a typical RISC.  This size increase
is a problem for some people, particularly people using gcc for embedded
development.

If it is necessary to keep the symbol for some reason, I'd suggest having
the default be to not emit the symbol.  Those targets that really want it
can re-enable it, but it will be off for most targets which is the best
choice.

Jim

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