This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
offsets of stack variables with optimizations enabled in GCC
- From: Tao Zhang <zhangtao at cc dot gatech dot edu>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 25 Aug 2003 17:24:05 -0400 (EDT)
- Subject: offsets of stack variables with optimizations enabled in GCC
Hi, all
I am trying to track the offsets of stack variables
relative to the SP inside GCC. Because debuggers need the same
information, so I checked the source code of dbxout.c and
found lots of useful information on how to extract the offsets.
When I was using the dumped offsets, I found the offsets are
reasonable if I compile the binary without optimizations enabled.
Otherwise, the offsets are not correct or I can't figure out how to
use the offsets extracted from the GCC RTL. I think although GCC
can dump debug information with optimizations enabled, the
GDB debugger can't debug an optimized binary. Maybe the
debugger doesn't know how to use the offsets either?
Is there a way to know which stack slot GCC allocates a
stack variable (that it can't find a register for) to , with optimizations
enabled ( -O1, -O2 etc) ?
Thanks a lot!
Tao
-Tao Zhang (zhangtao@cc.gatech.edu)