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]

Re: Preserving the argument spills for GDB


Jean Christophe Beyler <jean.christophe.beyler@gmail.com> writes:

> I've been working on handling the Debugging information for the use of
> GDB on my port. Though I definitely know that, when compiling in -O3,
> some information is lost and the debugger can't always have all the
> information, I'd like to at least keep the values of the arguments
> when doing a backtrace. Since my architecture uses register passing
> for arguments, relatively quickly this is lost since it is not stored
> on the stack.
>
> Therefore, I would like to, when doing a backtrace, have the argument
> information. I asked a few clarifications on the GDB mailing list and,
> it seems, that I need to copy the arguments on the stack (like what is
> done by default when using -O0). However, when compiling in -O3, the
> compiler of course removes these stores on the stack and relies solely
> (and justly so) on the input registers.
>
> I've reread the GCC internals and have been looking at anything
> regarding the stack but can't seem to figure this one out. How exactly
> do I explain to the compiler that I want to keep those spills to the
> stack for debugging purposes ?


You can force your writes to the stack to not be removed by making
them use UNSPEC_VOLATILE.  You would write special define_insns for
this.

Not to miss the obvious, note that this will hurt optimization.
However, if you need to have the argument values available for all
backtraces, then I'm not sure what else to recommend.  In general gcc
will discard argument values that are not needed.

Ian


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