Should GCC tell GDB about its optimizations?

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Sat Mar 4 01:47:00 GMT 2000


>   What sort of squirrelly behavior are you talking about exactly?  If it is 
> just the typical problem where GCC reuses register's and stack locations 
> when variables lifetime's are over, this would seem like a gdb problem, not 
> a GCC problem.

I don't know what problem Stan is talking about, but I know there are
other problems:

- If  a function  is inlined,  single-stepping will  get you  into the
  function source code. However, it won't appear in the backtrace, and
  invoking 'fin' will do the wrong thing.

- Again, in inlining, the compiler will not put information about
  function parameters into the stabs if the parameters are
  optimized-away.

- The same holds for local variables - if they are eliminated, gdb
  won't know about them - they just don't exist in the debug
  information (or, in the code, for that matter)

Regards,
Martin



More information about the Gcc mailing list