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]
Other format: [Raw text]

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)


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