|
|
#include "nsCOMPtr.h" | #include "nsCOMPtr.h" |
#include "nsCRT.h" | #include "nsCRT.h" |
#include <math.h> | #include <math.h> |
| |
#if defined(_WIN32) | #if defined(_WIN32) |
#include <windows.h> | #include <windows.h> |
#elif defined(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC)) |
|
#include <setjmp.h> |
|
|
|
// |
|
// On glibc 2.1, the Dl_info api defined in <dlfcn.h> is only exposed |
|
// if __USE_GNU is defined. I suppose its some kind of standards |
|
// adherence thing. |
|
// |
|
#if (__GLIBC_MINOR__ >= 1) && !defined(__USE_GNU) |
|
#define __USE_GNU |
|
#endif |
|
|
|
#include <dlfcn.h> |
|
#endif | #endif |
| |
#ifdef HAVE_LIBDL | #ifdef HAVE_LIBDL |
#include <dlfcn.h> | #include <dlfcn.h> |
#endif | #endif |
| |
|
Lines 481-493
static PRIntn PR_CALLBACK DumpSerialNumb
|
Link Here
|
|---|
|
return HT_ENUMERATE_NEXT; | return HT_ENUMERATE_NEXT; |
} | } |
| |
| |
#endif /* NS_BUILD_REFCNT_LOGGING */ | #endif /* NS_BUILD_REFCNT_LOGGING */ |
| |
nsresult |
NS_COM nsresult |
nsTraceRefcntImpl::DumpStatistics(StatisticsType type, FILE* out) | nsTraceRefcntImpl::DumpStatistics(StatisticsType type, FILE* out) |
{ | { |
nsresult rv = NS_OK; | nsresult rv = NS_OK; |
#ifdef NS_BUILD_REFCNT_LOGGING | #ifdef NS_BUILD_REFCNT_LOGGING |
if (gBloatLog == nsnull || gBloatView == nsnull) { | if (gBloatLog == nsnull || gBloatView == nsnull) { |
return NS_ERROR_FAILURE; | return NS_ERROR_FAILURE; |
|
|
gLogging = wasLogging; | gLogging = wasLogging; |
UNLOCK_TRACELOG(); | UNLOCK_TRACELOG(); |
#endif | #endif |
return rv; | return rv; |
} | } |
| |
void |
NS_COM void |
nsTraceRefcntImpl::ResetStatistics() | nsTraceRefcntImpl::ResetStatistics() |
{ | { |
#ifdef NS_BUILD_REFCNT_LOGGING | #ifdef NS_BUILD_REFCNT_LOGGING |
LOCK_TRACELOG(); | LOCK_TRACELOG(); |
if (gBloatView) { | if (gBloatView) { |
PL_HashTableDestroy(gBloatView); | PL_HashTableDestroy(gBloatView); |
|
Lines 847-869
static void InitTraceLog(void)
|
Link Here
|
|---|
|
} | } |
| |
#endif | #endif |
| |
#if defined(_WIN32) && defined(_M_IX86) // WIN32 x86 stack walking code | #if defined(_WIN32) && defined(_M_IX86) // WIN32 x86 stack walking code |
#include "nsStackFrameWin.h" | #include "nsStackFrameWin.h" |
void |
NS_COM void |
nsTraceRefcntImpl::WalkTheStack(FILE* aStream) | nsTraceRefcntImpl::WalkTheStack(FILE* aStream) |
{ | { |
DumpStackToFile(aStream); | DumpStackToFile(aStream); |
} | } |
| |
// WIN32 x86 stack walking code | // WIN32 x86 stack walking code |
// i386 or PPC Linux stackwalking code or Solaris | // 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))) |
#elif (defined(linux) && defined(__GNUC__) && (defined(__i386) || defined(PPC))) || (defined(__sun) && (defined(__sparc) || defined(sparc) || defined(__i386) || defined(i386))) |
#include "nsStackFrameUnix.h" | #include "nsStackFrameUnix.h" |
void |
NS_COM void |
nsTraceRefcntImpl::WalkTheStack(FILE* aStream) | nsTraceRefcntImpl::WalkTheStack(FILE* aStream) |
{ | { |
DumpStackToFile(aStream); | DumpStackToFile(aStream); |
} | } |
| |
#elif defined(XP_MAC) | #elif defined(XP_MAC) |
|
Lines 957-969
nsTraceRefcntImpl::WalkTheStack(FILE* aS
|
Link Here
|
|---|
|
break; | break; |
} | } |
} | } |
| |
#else // unsupported platform. | #else // unsupported platform. |
| |
void |
NS_COM void |
nsTraceRefcntImpl::WalkTheStack(FILE* aStream) | nsTraceRefcntImpl::WalkTheStack(FILE* aStream) |
{ | { |
fprintf(aStream, "write me, dammit!\n"); | fprintf(aStream, "write me, dammit!\n"); |
} | } |
| |
#endif | #endif |