|
From: <sv...@va...> - 2005-11-05 14:22:07
|
Author: sewardj
Date: 2005-11-05 14:22:03 +0000 (Sat, 05 Nov 2005)
New Revision: 5021
Log:
Commit Tom's improved-stack-unwinding patch.
Modified:
trunk/coregrind/m_libcassert.c
Modified: trunk/coregrind/m_libcassert.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_libcassert.c 2005-11-05 14:08:35 UTC (rev 5020)
+++ trunk/coregrind/m_libcassert.c 2005-11-05 14:22:03 UTC (rev 5021)
@@ -44,22 +44,28 @@
------------------------------------------------------------------ */
=20
#if defined(VGP_x86_linux)
-# define GET_REAL_SP_AND_FP(sp, fp) \
- asm("movl %%esp, %0;" \
- "movl %%ebp, %1;" \
- : "=3Dr" (sp),\
+# define GET_REAL_PC_SP_AND_FP(pc, sp, fp) \
+ asm("call m_libcassert_get_ip;" \
+ "m_libcassert_get_ip: popl %0;" \
+ "movl %%esp, %1;" \
+ "movl %%ebp, %2;" \
+ : "=3Dr" (pc),\
+ "=3Dr" (sp),\
"=3Dr" (fp));
#elif defined(VGP_amd64_linux)
-# define GET_REAL_SP_AND_FP(sp, fp) \
- asm("movq %%rsp, %0;" \
- "movq %%rbp, %1;" \
- : "=3Dr" (sp),\
+# define GET_REAL_PC_SP_AND_FP(pc, sp, fp) \
+ asm("leaq 0(%%rip), %0;" \
+ "movq %%rsp, %1;" \
+ "movq %%rbp, %2;" \
+ : "=3Dr" (pc),\
+ "=3Dr" (sp),\
"=3Dr" (fp));
#elif defined(VGP_ppc32_linux)
-# define GET_REAL_SP_AND_FP(sp, fp) \
+# define GET_REAL_PC_SP_AND_FP(pc, sp, fp) \
asm("mr %0,1;" \
"mr %1,1;" \
- : "=3Dr" (sp),\
+ : "=3Dr" (pc),\
+ "=3Dr" (sp),\
"=3Dr" (fp));
#else
# error Unknown platform
@@ -105,8 +111,7 @@
// state. Could cause problems if we got the panic/exception within =
the
// execontext/stack dump/symtab code. But it's better than nothing.
if (0 =3D=3D ip && 0 =3D=3D sp && 0 =3D=3D fp) {
- ip =3D (Addr)__builtin_return_address(0);
- GET_REAL_SP_AND_FP(sp, fp);
+ GET_REAL_PC_SP_AND_FP(ip, sp, fp);
}
=20
stacktop =3D tst->os_state.valgrind_stack_init_SP;
|