This is the mail archive of the
insight@sourceware.cygnus.com
mailing list for the Insight project.
Re: Debugging without a frame pointer.
- To: duane_ellis at franklin dot com
- Subject: Re: Debugging without a frame pointer.
- From: Jim Blandy <jimb at zwingli dot cygnus dot com>
- Date: 08 May 2000 10:01:38 -0500
- Cc: insight at sourceware dot cygnus dot com
- References: <200004272222.SAA09246@mercury.franklin.com>
GDB does support debugging functions lacking frame pointers on some
architectures.
If there isn't any more reliable source of information, GDB handles
these cases by actually analyzing the first few instructions of the
function, looking for an instruction that adjusts the stack pointer.
Usually, if you can discover where the stack pointer was on entry to
the function, you can find the saved return address; there's no harm
in choosing a convention here and making GCC stick to it.
For an example of a port that works this way, you might want to check
out mn10200_analyze_prologue in mn10200-tdep.c.
Handling functions whose frame size varies (because they call alloca,
use GCC's variable-sized arrays, etc.) is a challenge. GDB pretty
much requires that such functions use a frame pointer register. But
I don't see how GCC could find the local variables reliably unless
there was a frame pointer there for GDB to find.