Lines 47-71
Link Here
|
47 |
#include "nsCOMPtr.h" |
47 |
#include "nsCOMPtr.h" |
48 |
#include "nsCRT.h" |
48 |
#include "nsCRT.h" |
49 |
#include <math.h> |
49 |
#include <math.h> |
50 |
|
50 |
|
51 |
#if defined(_WIN32) |
51 |
#if defined(_WIN32) |
52 |
#include <windows.h> |
52 |
#include <windows.h> |
53 |
#elif defined(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC)) |
|
|
54 |
#include <setjmp.h> |
55 |
|
56 |
// |
57 |
// On glibc 2.1, the Dl_info api defined in <dlfcn.h> is only exposed |
58 |
// if __USE_GNU is defined. I suppose its some kind of standards |
59 |
// adherence thing. |
60 |
// |
61 |
#if (__GLIBC_MINOR__ >= 1) && !defined(__USE_GNU) |
62 |
#define __USE_GNU |
63 |
#endif |
64 |
|
65 |
#include <dlfcn.h> |
66 |
#endif |
53 |
#endif |
67 |
|
54 |
|
68 |
#ifdef HAVE_LIBDL |
55 |
#ifdef HAVE_LIBDL |
69 |
#include <dlfcn.h> |
56 |
#include <dlfcn.h> |
70 |
#endif |
57 |
#endif |
71 |
|
58 |
|
Lines 481-493
static PRIntn PR_CALLBACK DumpSerialNumb
Link Here
|
481 |
return HT_ENUMERATE_NEXT; |
468 |
return HT_ENUMERATE_NEXT; |
482 |
} |
469 |
} |
483 |
|
470 |
|
484 |
|
471 |
|
485 |
#endif /* NS_BUILD_REFCNT_LOGGING */ |
472 |
#endif /* NS_BUILD_REFCNT_LOGGING */ |
486 |
|
473 |
|
487 |
nsresult |
474 |
NS_COM nsresult |
488 |
nsTraceRefcntImpl::DumpStatistics(StatisticsType type, FILE* out) |
475 |
nsTraceRefcntImpl::DumpStatistics(StatisticsType type, FILE* out) |
489 |
{ |
476 |
{ |
490 |
nsresult rv = NS_OK; |
477 |
nsresult rv = NS_OK; |
491 |
#ifdef NS_BUILD_REFCNT_LOGGING |
478 |
#ifdef NS_BUILD_REFCNT_LOGGING |
492 |
if (gBloatLog == nsnull || gBloatView == nsnull) { |
479 |
if (gBloatLog == nsnull || gBloatView == nsnull) { |
493 |
return NS_ERROR_FAILURE; |
480 |
return NS_ERROR_FAILURE; |
Lines 558-570
done:
Link Here
|
558 |
gLogging = wasLogging; |
545 |
gLogging = wasLogging; |
559 |
UNLOCK_TRACELOG(); |
546 |
UNLOCK_TRACELOG(); |
560 |
#endif |
547 |
#endif |
561 |
return rv; |
548 |
return rv; |
562 |
} |
549 |
} |
563 |
|
550 |
|
564 |
void |
551 |
NS_COM void |
565 |
nsTraceRefcntImpl::ResetStatistics() |
552 |
nsTraceRefcntImpl::ResetStatistics() |
566 |
{ |
553 |
{ |
567 |
#ifdef NS_BUILD_REFCNT_LOGGING |
554 |
#ifdef NS_BUILD_REFCNT_LOGGING |
568 |
LOCK_TRACELOG(); |
555 |
LOCK_TRACELOG(); |
569 |
if (gBloatView) { |
556 |
if (gBloatView) { |
570 |
PL_HashTableDestroy(gBloatView); |
557 |
PL_HashTableDestroy(gBloatView); |
Lines 847-869
static void InitTraceLog(void)
Link Here
|
847 |
} |
834 |
} |
848 |
|
835 |
|
849 |
#endif |
836 |
#endif |
850 |
|
837 |
|
851 |
#if defined(_WIN32) && defined(_M_IX86) // WIN32 x86 stack walking code |
838 |
#if defined(_WIN32) && defined(_M_IX86) // WIN32 x86 stack walking code |
852 |
#include "nsStackFrameWin.h" |
839 |
#include "nsStackFrameWin.h" |
853 |
void |
840 |
NS_COM void |
854 |
nsTraceRefcntImpl::WalkTheStack(FILE* aStream) |
841 |
nsTraceRefcntImpl::WalkTheStack(FILE* aStream) |
855 |
{ |
842 |
{ |
856 |
DumpStackToFile(aStream); |
843 |
DumpStackToFile(aStream); |
857 |
} |
844 |
} |
858 |
|
845 |
|
859 |
// WIN32 x86 stack walking code |
846 |
// WIN32 x86 stack walking code |
860 |
// i386 or PPC Linux stackwalking code or Solaris |
847 |
// i386 or PPC Linux stackwalking code or Solaris |
861 |
#elif (defined(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC))) || (defined(__sun) && (defined(__sparc) || defined(sparc) || defined(__i386) || defined(i386))) |
848 |
#elif (defined(linux) && defined(__GNUC__) && (defined(__i386) || defined(PPC))) || (defined(__sun) && (defined(__sparc) || defined(sparc) || defined(__i386) || defined(i386))) |
862 |
#include "nsStackFrameUnix.h" |
849 |
#include "nsStackFrameUnix.h" |
863 |
void |
850 |
NS_COM void |
864 |
nsTraceRefcntImpl::WalkTheStack(FILE* aStream) |
851 |
nsTraceRefcntImpl::WalkTheStack(FILE* aStream) |
865 |
{ |
852 |
{ |
866 |
DumpStackToFile(aStream); |
853 |
DumpStackToFile(aStream); |
867 |
} |
854 |
} |
868 |
|
855 |
|
869 |
#elif defined(XP_MAC) |
856 |
#elif defined(XP_MAC) |
Lines 957-969
nsTraceRefcntImpl::WalkTheStack(FILE* aS
Link Here
|
957 |
break; |
944 |
break; |
958 |
} |
945 |
} |
959 |
} |
946 |
} |
960 |
|
947 |
|
961 |
#else // unsupported platform. |
948 |
#else // unsupported platform. |
962 |
|
949 |
|
963 |
void |
950 |
NS_COM void |
964 |
nsTraceRefcntImpl::WalkTheStack(FILE* aStream) |
951 |
nsTraceRefcntImpl::WalkTheStack(FILE* aStream) |
965 |
{ |
952 |
{ |
966 |
fprintf(aStream, "write me, dammit!\n"); |
953 |
fprintf(aStream, "write me, dammit!\n"); |
967 |
} |
954 |
} |
968 |
|
955 |
|
969 |
#endif |
956 |
#endif |