[sheepdog] [PATCH] Fix hardcode AMD64 assembly code (RSP)
Liu Yuan
namei.unix at gmail.com
Tue Jul 30 04:48:54 CEST 2013
On Tue, Jul 30, 2013 at 08:35:23AM +0900, MORITA Kazutaka wrote:
> At Mon, 29 Jul 2013 14:41:35 +0800,
> Liu Yuan wrote:
> >
> > diff --git a/lib/logger.c b/lib/logger.c
> > index 253163d..da1221b 100644
> > --- a/lib/logger.c
> > +++ b/lib/logger.c
> > @@ -697,11 +697,15 @@ static bool check_gdb(void)
> > return system("which gdb > /dev/null") == 0;
> > }
> >
> > +#define STACK_POINTER \
> > + ((char *)__builtin_frame_address(0) + __SIZEOF_POINTER__ * 2)
> > +
>
> I think we should add some explanation why this would work.
>
> - IIUC, we have to add (__SIZEOF_POINTER__ * 2) since the old ebp and
> eip are saved in the stack.
I thought of it too, but I have some questions with this assumption.
- Your old asm("esp") means the end of the caller's frame or begin of the
callee's frame?
- so GDB expect the address of end of the frame or the begin of the frame?
Thanks
Yuan
More information about the sheepdog
mailing list