Date: Wed, 21 Jan 2004 22:13:44 +0100 From: Marc Olzheim <marcolz@stack.nl> To: hackers@freebsd.org Subject: libc_r/uthread/uthread_create.c Message-ID: <20040121211344.GA97203@stack.nl>
next in thread | raw e-mail | index | archive | help
--4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline For debugging purposes would like to propose the following patch. The only thing besides from not knowing anything about other architectures than i386, is that I don't know exactly what happens when compiling with -fomit-frame-pointer Could someone tell me ? Marc --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="pthread_ebp.patch" --- /usr/src/lib/libc_r/uthread/pthread_private.h Tue Jun 3 00:22:52 2003 +++ /usr/src/lib/libc_r/uthread/pthread_private.h Wed Jan 21 21:44:21 2004 @@ -86,7 +86,8 @@ fdata = (char *) (ucp)->uc_mcontext.mc_fpstate; \ __asm__("frstor %0": :"m"(*fdata)); \ } while (0) -#define SET_RETURN_ADDR_JB(jb, ra) (jb)[0]._jb[0] = (int)(ra) +#define SET_RETURN_ADDR_JB(jb, ra) (jb)[0]._jb[0] = (int)(ra) +#define SET_FRAME_PTR_JB(jb, fp) (jb)[0]._jb[3] = (int)(fp) #elif defined(__amd64__) #define GET_STACK_JB(jb) ((unsigned long)((jb)[0]._jb[2])) #define GET_STACK_SJB(sjb) ((unsigned long)((sjb)[0]._sjb[2])) @@ -105,6 +106,7 @@ __asm__("fxrstor %0": :"m"(*fdata)); \ } while (0) #define SET_RETURN_ADDR_JB(jb, ra) (jb)[0]._jb[0] = (long)(ra) +#define SET_FRAME_PTR_JB(jb, fp) #elif defined(__alpha__) #include <machine/reg.h> #define GET_STACK_JB(jb) ((unsigned long)((jb)[0]._jb[R_SP + 4])) @@ -120,6 +122,7 @@ (jb)[0]._jb[R_RA + 4] = (long)(ra); \ (jb)[0]._jb[R_T12 + 4] = (long)(ra); \ } while (0) +#define SET_FRAME_PTR_JB(jb, fp) #elif defined(__ia64__) #define GET_BSP_JB(jb) (*((unsigned long*)JMPBUF_ADDR_OF(jb,J_BSP))) #define GET_STACK_JB(jb) (*((unsigned long*)JMPBUF_ADDR_OF(jb,J_SP))) @@ -136,6 +139,7 @@ GET_BSP_JB(jb) = (long)(stk); \ } while (0) #define UPD_STACK_JB(jb, stk) GET_STACK_JB(jb) = (long)(stk) +#define SET_FRAME_PTR_JB(jb, fp) #elif defined(__sparc64__) #include <machine/frame.h> @@ -164,6 +168,7 @@ #define FP_RESTORE_UC(ucp) /* XXX */ #define SET_RETURN_ADDR_JB(jb, ra) \ (jb)[0]._jb[_JB_PC] = (long)(ra) - 8 +#define SET_FRAME_PTR_JB(jb, fp) #else #error "Don't recognize this architecture!" #endif --- /usr/src/lib/libc_r/uthread/uthread_create.c Wed Dec 3 07:54:40 2003 +++ /usr/src/lib/libc_r/uthread/uthread_create.c Wed Jan 21 04:01:31 2004 @@ -146,6 +146,7 @@ * _thread_start(). */ SET_RETURN_ADDR_JB(new_thread->ctx.jb, _thread_start); + SET_FRAME_PTR_JB(new_thread->ctx.jb, NULL); #if !defined(__ia64__) stackp = (long)new_thread->stack + pattr->stacksize_attr - sizeof(double); --4Ckj6UjgE2iN1+kY--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040121211344.GA97203>