Bug 323853 - JB_BP not exported by newer glibc (2.4), r=bsmedberg, sr=shaver

git-svn-id: svn://10.0.0.236/trunk@188144 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
wr%rosenauer.org
2006-01-25 05:46:27 +00:00
parent c07bd96bcb
commit d9d7edb8b3
3 changed files with 22 additions and 4 deletions

View File

@@ -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 <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(__GLIBC__) && (defined(__i386) || defined(PPC)) // old style i386 or PPC Linux stackwalking code
#include <setjmp.h>
//
@@ -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))
/*