A tiny amount of work toward an x86 backtrace facility.
This commit is contained in:
@@ -34,14 +34,17 @@ typedef unsigned long long UInt64;
|
||||
* even though they resolve to the same thing (bug in gcc?). */
|
||||
#define HAVE_MACHINE_ENDIAN_H
|
||||
|
||||
// Looking ahead to "Universal binaries."
|
||||
#ifdef __ppc__
|
||||
#if defined(__ppc__)
|
||||
# define CPU_PPC
|
||||
# define ENDIAN_BIG
|
||||
# define BACKTRACE_LOOKUP_METHOD_DARWIN_DYLD
|
||||
# define BACKTRACE_METHOD_POWERPC_DARWIN
|
||||
# define CRASH_HANDLER
|
||||
#else
|
||||
#elif defined(__i386__)
|
||||
# define CPU_X86
|
||||
# define ENDIAN_LITTLE
|
||||
# define BACKTRACE_METHOD_X86_DARWIN
|
||||
# define BACKTRACE_LOOKUP_METHOD_DLADDR
|
||||
#endif
|
||||
|
||||
#ifndef MACOSX
|
||||
@@ -197,7 +200,7 @@ namespace std
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2003-2005 Steve Checkoway
|
||||
* (c) 2003-2006 Steve Checkoway
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
||||
@@ -404,6 +404,22 @@ void GetBacktrace( const void **buf, size_t size, const BacktraceContext *ctx )
|
||||
|
||||
do_backtrace( buf, size, ctx );
|
||||
}
|
||||
#elif defined(BACKTRACE_METHOD_X86_DARWIN)
|
||||
void InitializeBacktrace() { }
|
||||
|
||||
void GetSignalBacktraceContext( BacktraceContext *ctx, const ucontext_t *uc )
|
||||
{
|
||||
ctx->ip = (void *) uc->uc_mcontext->ss.eip;
|
||||
ctx->bp = (void *) uc->uc_mcontext->ss.ebp;
|
||||
ctx->sp = (void *) uc->uc_mcontext->ss.esp;
|
||||
}
|
||||
|
||||
void GetBacktrace( const void **buf, size_t size, const BacktraceContext *ctx )
|
||||
{
|
||||
buf[0] = BACKTRACE_METHOD_NOT_AVAILABLE;
|
||||
buf[1] = NULL;
|
||||
}
|
||||
|
||||
#elif defined(BACKTRACE_METHOD_POWERPC_DARWIN)
|
||||
typedef struct Frame
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ struct BacktraceContext
|
||||
pid_t pid;
|
||||
#endif
|
||||
|
||||
#if defined(MACOSX)
|
||||
#if defined(CPU_PPC)
|
||||
void *FramePtr, *PC;
|
||||
#endif
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user