From 4074f20476114081c4f93d98d851058b071efce3 Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 7 May 2013 19:41:17 +0000 Subject: [PATCH] apparently this is more correct. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4345 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/server/sv_sys_unix.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engine/server/sv_sys_unix.c b/engine/server/sv_sys_unix.c index f784ada42..196e60db7 100644 --- a/engine/server/sv_sys_unix.c +++ b/engine/server/sv_sys_unix.c @@ -646,7 +646,6 @@ void Sys_Shutdown (void) #ifdef __linux__ /*should probably be GNUC but whatever*/ #include #ifdef __i386__ -#define __USE_GNU #include #endif static void Friendly_Crash_Handler(int sig, siginfo_t *info, void *vcontext) @@ -670,10 +669,12 @@ static void Friendly_Crash_Handler(int sig, siginfo_t *info, void *vcontext) size = backtrace(array, 10); #if defined(__i386__) - ucontext_t *uc = vcontext; - array[1] = uc->uc_mcontext.gregs[REG_EIP]; + //x86 signals don't leave the stack in a clean state, so replace the signal handler with the real crash address, and hide this function + struct sig_ucontext *uc = vcontext; + array[1] = uc->uc_mcontext.eip; firstframe = 1; #elif defined(__amd64__) + //amd64 is sane enough, but this function and the libc signal handler are on the stack, and should be ignored. firstframe = 2; #endif