1 Index: xpcom/base/nsTraceRefcntImpl.cpp
2 ===================================================================
3 RCS file: /cvs/mozilla/xpcom/base/nsTraceRefcntImpl.cpp,v
4 retrieving revision 1.98
5 diff -p -u -1 -2 -r1.98 nsTraceRefcntImpl.cpp
6 --- xpcom/base/nsTraceRefcntImpl.cpp 3 Feb 2006 19:35:14 -0000 1.98
7 +++ xpcom/base/nsTraceRefcntImpl.cpp 6 Feb 2006 20:30:53 -0000
9 #include "nsISupports.h"
10 #include "nsVoidArray.h"
21 -#elif defined(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC))
25 -// On glibc 2.1, the Dl_info api defined in <dlfcn.h> is only exposed
26 -// if __USE_GNU is defined. I suppose its some kind of standards
29 -#if (__GLIBC_MINOR__ >= 1) && !defined(__USE_GNU)
40 ////////////////////////////////////////////////////////////////////////////////
43 NS_MeanAndStdDev(double n, double sumOfValues, double sumOfSquaredValues,
44 double *meanResult, double *stdDevResult)
46 @@ -451,25 +438,25 @@ static PRIntn PR_CALLBACK DumpSerialNumb
49 fprintf((FILE*) aClosure, "%d (%d references)\n",
53 return HT_ENUMERATE_NEXT;
57 #endif /* NS_BUILD_REFCNT_LOGGING */
61 nsTraceRefcntImpl::DumpStatistics(StatisticsType type, FILE* out)
64 #ifdef NS_BUILD_REFCNT_LOGGING
65 if (gBloatLog == nsnull || gBloatView == nsnull) {
66 return NS_ERROR_FAILURE;
73 @@ -528,25 +515,25 @@ nsTraceRefcntImpl::DumpStatistics(Statis
75 fprintf(out, "\n\nSerial Numbers of Leaked Objects:\n");
76 PL_HashTableEnumerateEntries(gSerialNumbers, DumpSerialNumbers, out);
80 gLogging = wasLogging;
88 nsTraceRefcntImpl::ResetStatistics()
90 #ifdef NS_BUILD_REFCNT_LOGGING
93 PL_HashTableDestroy(gBloatView);
100 @@ -812,43 +799,43 @@ static void InitTraceLog(void)
102 if (gBloatLog || gRefcntsLog || gAllocLog || gLeakyLog || gCOMPtrLog) {
106 gTraceLock = PR_NewLock();
111 #if defined(_WIN32) && defined(_M_IX86) && !defined(WINCE) // WIN32 x86 stack walking code
112 #include "nsStackFrameWin.h"
115 nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
117 DumpStackToFile(aStream);
120 // WIN32 x86 stack walking code
121 // i386 or PPC Linux stackwalking code or Solaris
122 -#elif (defined(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC))) || (defined(__sun) && (defined(__sparc) || defined(sparc) || defined(__i386) || defined(i386)))
123 +#elif (defined(linux) && defined(__GNUC__) && (defined(__i386) || defined(PPC))) || (defined(__sun) && (defined(__sparc) || defined(sparc) || defined(__i386) || defined(i386)))
124 #include "nsStackFrameUnix.h"
127 nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
129 DumpStackToFile(aStream);
132 #else // unsupported platform.
136 nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
138 fprintf(aStream, "write me, dammit!\n");
143 //----------------------------------------------------------------------
145 // This thing is exported by libstdc++
146 // Yes, this is a gcc only hack
147 #if defined(MOZ_DEMANGLE_SYMBOLS)
148 Index: xpcom/base/nsStackFrameUnix.cpp
149 ===================================================================
150 RCS file: /cvs/mozilla/xpcom/base/nsStackFrameUnix.cpp,v
151 retrieving revision 1.14
152 diff -p -u -1 -2 -r1.14 nsStackFrameUnix.cpp
153 --- xpcom/base/nsStackFrameUnix.cpp 3 Feb 2006 19:35:14 -0000 1.14
154 +++ xpcom/base/nsStackFrameUnix.cpp 6 Feb 2006 20:28:06 -0000
155 @@ -74,43 +74,33 @@ void DemangleSymbol(const char * aSymbol
156 /* See demangle.h in the gcc source for the voodoo */
157 char * demangled = abi::__cxa_demangle(aSymbol,0,0,0);
161 strncpy(aBuffer,demangled,aBufLen);
164 #endif // MOZ_DEMANGLE_SYMBOLS
168 -#if defined(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC)) // i386 or PPC Linux stackwalking code
169 +#if defined(linux) && defined(__GNUC__) && (defined(__i386) || defined(PPC)) // i386 or PPC Linux stackwalking code
174 void DumpStackToFile(FILE* aStream)
179 // Stack walking code courtesy Kipp's "leaky".
181 - // Get the frame pointer out of the jmp_buf
182 - void **bp = (void**)
184 - (jb[0].__jmpbuf[JB_BP]);
186 - (jb[0].__jmpbuf[JB_GPR1]);
188 + // Get the frame pointer
189 + void **bp = (void**) __builtin_frame_address(0);
192 for ( ; (void**)*bp > bp; bp = (void**)*bp) {
196 int ok = dladdr(pc, &info);
198 fprintf(aStream, "UNKNOWN %p\n", pc);