Mail Archives: djgpp/1997/09/24/13:54:05
Nate Eldredge eldredge AT ap DOT net wrote:
> At 01:52 9/18/1997 +0200, Vik Heyndrickx wrote:
> >Shawn Hargreaves wrote:
> >
> >...
> >> the parameters and local variables are accessed relative to this. The
> >> main advantage to this is that the return address will always be at a
> >> fixed offset from %ebp, and the version of %ebp from the previous
> >> function will be pushed directly after this, so it is easy for debuggers
> >> and programs like symify to walk backwards up the callstack.
> >
> >Does this then mean that program's compiled with the
> >-fomit-frame-pointer option, that access local variables directly
> >relative to %esp can yield problems with symify?
> Yes. Basically -fomit-frame-pointer will make backtraces, and just about any
> debugging whatever, impossible. The GCC docs warn about this. Moral: Don't
> compile with -fomit-frame-pointer until the code is completely debugged
> (what a laugh).
And hence you'll never be able to debug because you are debugging another EXE
and not the one you want ;-))).
Normally you can debug programs with -fomit-frame-pointer, you just only must
be aware that you can't trust in the values of local variables reported by the
debugger. In some cases EBP isn't modified and you can watch local variables,
in other watching global variables is OK.
Another important thing: If you use -fomit-frame-pointer and inline asm save
the EBP BY HAND, if you put it in the clobber list gcc will ignore the entry. I
think that's a bug in gcc.
SET
------------------------------------ 0 --------------------------------
Visit my home page: http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-sot AT usa DOT net - ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013
- Raw text -