File dumpstack.patch of Package nvu
Index: xpcom/base/nsStackFrameUnix.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/base/nsStackFrameUnix.cpp,v
retrieving revision 1.12
diff -u -p -8 -r1.12 nsStackFrameUnix.cpp
--- xpcom/base/nsStackFrameUnix.cpp 18 Apr 2004 14:18:12 -0000 1.12
+++ xpcom/base/nsStackFrameUnix.cpp 18 Jan 2006 09:20:13 -0000
@@ -77,19 +77,31 @@ void DemangleSymbol(const char * aSymbol
if (demangled)
{
strncpy(aBuffer,demangled,aBufLen);
free(demangled);
}
#endif // MOZ_DEMANGLE_SYMBOLS
}
+#if defined(linux) && defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 3)))
+/* just use glibc backtrace() */
+#include <execinfo.h>
+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(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC)) // i386 or PPC Linux stackwalking code
+/* old style linux backtrace */
#include <setjmp.h>
//
void DumpStackToFile(FILE* aStream)
{
jmp_buf jb;
setjmp(jb);