alloca is bad?
Michael Meissner
meissner@cygnus.com
Mon Nov 13 08:05:00 GMT 2000
On Mon, Nov 13, 2000 at 06:12:58AM -0500, Eli Zaretskii wrote:
> > Date: Sun, 12 Nov 2000 23:15:54 +0000
> > From: Fernando Nasser <fnasser@cygnus.com>
> >
> > As Andrew explained in his message, if the stack is
> > corrupted the PC and FP can (and probably will) be clobbered with
> > the garbage when the function returns.
>
> They could, yes; but in practice (at least in my experience), the
> clobbered return address is caught by the OS protection in most cases,
> so the program will GPF before the PC is garbled.
That's not my experience, but I suspect different machines, different OSes....
> > Bottom line: for most stack corruption problems, no "where" ("backtrace")
>
> In my experience, in most cases, there is in fact at least the frame
> where it crashed. You should be able to start debugging from there.
This is assuming you have a valid frame. On systems with a frame pointer, the
FP often times gets clobbered, just like the return address does, because both
get restored at the same time.
--
Michael Meissner, Red Hat, Inc.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work: meissner@redhat.com phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482
More information about the Gdb
mailing list