diff --git a/mozilla/xpcom/base/nsStackFrameUnix.cpp b/mozilla/xpcom/base/nsStackFrameUnix.cpp index 5ce8111f33f..1b81f99859d 100644 --- a/mozilla/xpcom/base/nsStackFrameUnix.cpp +++ b/mozilla/xpcom/base/nsStackFrameUnix.cpp @@ -82,9 +82,20 @@ void DemangleSymbol(const char * aSymbol, #endif // MOZ_DEMANGLE_SYMBOLS } +#if defined(linux) // Linux +#if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 3)) // use glibc backtrace() +#include +void DumpStackToFile(FILE* aStream) +{ + void *array[20]; + size_t size; -#if defined(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC)) // i386 or PPC Linux stackwalking code + fflush(aStream); + size = backtrace (array, 20); + backtrace_symbols_fd (array, size, fileno(aStream)); +} +#elif defined(__GLIBC__) && (defined(__i386) || defined(PPC)) // old style i386 or PPC Linux stackwalking code #include // @@ -140,6 +151,13 @@ void DumpStackToFile(FILE* aStream) } } +#else // not implemented +void DumpStackToFile(FILE* aStream) +{ + fprintf(aStream, "Info: Stacktrace not implemented for this Linux platform\n"); +} +#endif // Linux + #elif defined(__sun) && (defined(__sparc) || defined(sparc) || defined(__i386) || defined(i386)) /* diff --git a/mozilla/xpcom/base/nsTraceRefcntImpl.cpp b/mozilla/xpcom/base/nsTraceRefcntImpl.cpp index c86fb5f4f02..e3d99e9b456 100644 --- a/mozilla/xpcom/base/nsTraceRefcntImpl.cpp +++ b/mozilla/xpcom/base/nsTraceRefcntImpl.cpp @@ -828,8 +828,8 @@ nsTraceRefcntImpl::WalkTheStack(FILE* aStream) } // WIN32 x86 stack walking code -// i386 or PPC Linux stackwalking code or Solaris -#elif (defined(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC))) || (defined(__sun) && (defined(__sparc) || defined(sparc) || defined(__i386) || defined(i386))) +// Linux stackwalking code or Solaris +#elif (defined(linux) && defined(__GLIBC__)) || (defined(__sun) && (defined(__sparc) || defined(sparc) || defined(__i386) || defined(i386))) #include "nsStackFrameUnix.h" void nsTraceRefcntImpl::WalkTheStack(FILE* aStream) diff --git a/mozilla/xpfe/bootstrap/nsSigHandlers.cpp b/mozilla/xpfe/bootstrap/nsSigHandlers.cpp index 80c32a91247..d082e440d35 100644 --- a/mozilla/xpfe/bootstrap/nsSigHandlers.cpp +++ b/mozilla/xpfe/bootstrap/nsSigHandlers.cpp @@ -75,7 +75,7 @@ static char _progname[1024] = "huh?"; -#if defined(LINUX) && defined(DEBUG) && (defined(__i386) || defined(PPC)) +#if defined(LINUX) && defined(DEBUG) && defined(__GLIBC__) #define CRAWL_STACK_ON_SIGSEGV #endif