This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Frame handling
[Apologies if I've missed a message on this].
Something (recent frame stuff?) seems to have broken backtraces on
Sparc Solaris 5.8. Use the head version of GDB (although the GDB6 branch
shows it also) on the attached silly program (I compiled
with -g and gcc 3.0.3). If you stop in, say, inside the first recursive
invocation of g, you will find that 'where' only prints three frames,
getting the frame pointer screwed up in the last one, as far as I can tell.
Paul Hilfinger
------------------------------------------------------------
#include <stdio.h>
extern int g (int);
int h (int r)
{
int i;
int s;
for (i = r-1, s = 0; i >= 0; i -= 1)
s += g (i);
return s;
}
int g (int q)
{
return h (q);
}
int f (int x, int y)
{
int z, s;
for (z = x, s = 0; z < y; z += 1)
s += z * g(x);
return s;
}
main ()
{
printf ("%d\n", f (3, 7));
}