how to examine data with compiler optimization option set?

Eli Zaretskii
Thu Sep 4 15:55:00 GMT 2008

> From: Andreas Schwab <>
> Cc: Eli Zaretskii <>,
> 	"Frank Ch. Eigler" <>,,
> Date: Thu, 04 Sep 2008 10:00:45 +0200
> If parameters are passed in registers they are very likely to get lost.

Then the compiler should, under -ggdb, emit code and debug info that
allow GDB finding these parameters somewhere.

Failing that, there should be a compiler switch to disable this
optimization, and that switch should be enabled by default when one
uses -ggdb.

In many real-life programs the net effect of this optimization is
negligibly small, while the effect of not being able to see function
arguments means the program either gets shipped less debugged or is
built without optimizations and shipped that way.  I know _I_ would
happily give up this optimization if I could get back the lost ability
of debugging reasonably well optimized code.

More information about the Gdb mailing list