From 8b6b4f48fb4b902b95d4be39d25d71217fcf4b38 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 22 Oct 2004 21:39:26 +0000 Subject: [PATCH] rename eip/ebp/esp -> ip/bp/sp, since it's used for x86-64 too (rip/rbp/rsp) --- stepmania/src/archutils/Unix/Backtrace.cpp | 28 +++++++++---------- stepmania/src/archutils/Unix/Backtrace.h | 2 +- .../src/archutils/Unix/LinuxThreadHelpers.cpp | 12 ++++---- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/stepmania/src/archutils/Unix/Backtrace.cpp b/stepmania/src/archutils/Unix/Backtrace.cpp index fcab584ba2..6b6a40cce7 100644 --- a/stepmania/src/archutils/Unix/Backtrace.cpp +++ b/stepmania/src/archutils/Unix/Backtrace.cpp @@ -299,42 +299,42 @@ static void do_backtrace( const void **buf, size_t size, const BacktraceContext get_readable_ranges( g_ExecutableBegin, g_ExecutableEnd, 1024, READABLE_ONLY|EXECUTABLE_ONLY ); /* Find the stack memory blocks. */ - g_StackBlock1 = find_address( ctx->esp, g_ReadableBegin, g_ReadableEnd ); + g_StackBlock1 = find_address( ctx->sp, g_ReadableBegin, g_ReadableEnd ); g_StackBlock2 = find_address( SavedStackPointer, g_ReadableBegin, g_ReadableEnd ); /* Put eip at the top of the backtrace. */ /* XXX: We want EIP even if it's not valid, but we can't put NULL on the * list, since it's NULL-terminated. Hmm. */ unsigned i=0; - if( i < size-1 && ctx->eip ) // -1 for NULL - buf[i++] = ctx->eip; + if( i < size-1 && ctx->ip ) // -1 for NULL + buf[i++] = ctx->ip; /* If we did a CALL to an invalid address (eg. call a NULL callback), then * we won't have a stack frame for the function that called it (since the * stack frame is set up by the called function), but if esp hasn't been * changed after the CALL, the return address will be esp[0]. Grab it. */ - if( IsOnStack( ctx->esp ) ) + if( IsOnStack( ctx->sp ) ) { - const void *p = ((const void **) ctx->esp)[0]; + const void *p = ((const void **) ctx->sp)[0]; if( IsExecutableAddress( p ) && PointsToValidCall( p ) && i < size-1 ) // -1 for NULL buf[i++] = p; } #if 0 /* ebp is usually the frame pointer. */ - const StackFrame *frame = (StackFrame *) ctx->ebp; + const StackFrame *frame = (StackFrame *) ctx->bp; /* If ebp doesn't point to a valid stack frame, we're probably in * -fomit-frame-pointer code. Ignore it; use esp instead. It probably * won't point to a stack frame, but it should at least give us a starting * point in the stack. */ if( !IsValidFrame( frame ) ) - frame = (StackFrame *) ctx->esp; + frame = (StackFrame *) ctx->sp; #endif /* Actually, let's just use esp. Even if ebp points to a valid stack frame, there might be * -fomit-frame-pointer calls in front of it, and we want to get those. */ - const StackFrame *frame = (StackFrame *) ctx->esp; + const StackFrame *frame = (StackFrame *) ctx->sp; while( i < size-1 ) // -1 for NULL { @@ -368,9 +368,9 @@ static void do_backtrace( const void **buf, size_t size, const BacktraceContext void GetSignalBacktraceContext( BacktraceContext *ctx, const ucontext_t *uc ) { - ctx->eip = (void *) uc->uc_mcontext.gregs[REG_EIP]; - ctx->ebp = (void *) uc->uc_mcontext.gregs[REG_EBP]; - ctx->esp = (void *) uc->uc_mcontext.gregs[REG_ESP]; + ctx->ip = (void *) uc->uc_mcontext.gregs[REG_EIP]; + ctx->bp = (void *) uc->uc_mcontext.gregs[REG_EBP]; + ctx->sp = (void *) uc->uc_mcontext.gregs[REG_ESP]; ctx->pid = GetCurrentThreadId(); } @@ -383,9 +383,9 @@ void GetBacktrace( const void **buf, size_t size, const BacktraceContext *ctx ) { ctx = &CurrentCtx; - CurrentCtx.eip = NULL; - CurrentCtx.ebp = __builtin_frame_address(0); - CurrentCtx.esp = __builtin_frame_address(0); + CurrentCtx.ip = NULL; + CurrentCtx.bp = __builtin_frame_address(0); + CurrentCtx.sp = __builtin_frame_address(0); CurrentCtx.pid = GetCurrentThreadId(); } diff --git a/stepmania/src/archutils/Unix/Backtrace.h b/stepmania/src/archutils/Unix/Backtrace.h index 1461449e2b..e4b6e04000 100644 --- a/stepmania/src/archutils/Unix/Backtrace.h +++ b/stepmania/src/archutils/Unix/Backtrace.h @@ -7,7 +7,7 @@ struct BacktraceContext { #if defined(LINUX) - const void *eip, *ebp, *esp; + const void *ip, *bp, *sp; pid_t pid; #endif diff --git a/stepmania/src/archutils/Unix/LinuxThreadHelpers.cpp b/stepmania/src/archutils/Unix/LinuxThreadHelpers.cpp index 96001f05f4..1a694443a1 100644 --- a/stepmania/src/archutils/Unix/LinuxThreadHelpers.cpp +++ b/stepmania/src/archutils/Unix/LinuxThreadHelpers.cpp @@ -223,13 +223,13 @@ bool GetThreadBacktraceContext( uint64_t ThreadID, BacktraceContext *ctx ) ctx->pid = pid_t(ThreadID); #if defined(CPU_X86_64) - ctx->eip = (void *) regs.rip; - ctx->ebp = (void *) regs.rbp; - ctx->esp = (void *) regs.rsp; + ctx->ip = (void *) regs.rip; + ctx->bp = (void *) regs.rbp; + ctx->sp = (void *) regs.rsp; #elif defined(CPU_X86) - ctx->eip = (void *) regs.eip; - ctx->ebp = (void *) regs.ebp; - ctx->esp = (void *) regs.esp; + ctx->ip = (void *) regs.eip; + ctx->bp = (void *) regs.ebp; + ctx->sp = (void *) regs.esp; #else #error GetThreadBacktraceContext: which arch? #endif