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]

tail call optimization vs. debugging



For each optimized tail call, in the debugger, there is a stack frame missing.
Example:
         A () { B (); }
         B () { C (); }
         C () { D (); ... }
Here gdb will only display the stack frames of A and D. That is, the tail
call elimination makes debugging very hard.

Many GNU programs are compiled with "-O2 -g" by default, which has been
up to now a good compromise between speed and ease of debugging.

May I suggest:

1. that tail call elimination be disabled/enabled by a particular command
   line option,

2. that this command line option be "-fomit-frame-pointer", which is the
   other optimization which makes debugging impossible. Since -O2 does
   not imply "-fomit-frame-pointer", "-O2 -g" would continue to produce
   reasonably debuggable code.

Bruno


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