From d7487e5e644dfe4f9f6447ee137dabd315636f49 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Mon, 13 Aug 2007 19:36:57 +0000 Subject: [PATCH] Remove nsTraceRefcnt::LoadLibrarySymbols, which is no longer needed due to the error handling in SymGetModuleInfoEspecial. b=391793 r+a=bsmedberg git-svn-id: svn://10.0.0.236/trunk@231969 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/base/nsStackFrameWin.cpp | 7 +- mozilla/xpcom/base/nsTraceRefcntImpl.cpp | 64 ------------------- mozilla/xpcom/base/nsTraceRefcntImpl.h | 4 -- .../components/nsNativeComponentLoader.cpp | 6 -- 4 files changed, 5 insertions(+), 76 deletions(-) diff --git a/mozilla/xpcom/base/nsStackFrameWin.cpp b/mozilla/xpcom/base/nsStackFrameWin.cpp index f8064f7461a..02f9acc886b 100644 --- a/mozilla/xpcom/base/nsStackFrameWin.cpp +++ b/mozilla/xpcom/base/nsStackFrameWin.cpp @@ -451,8 +451,8 @@ NS_StackWalk(NS_WalkStackCallback aCallback, PRUint32 aSkipFrames, DWORD walkerReturn; struct WalkStackData data; - if (!EnsureSymInitialized()) - return NS_ERROR_FAILURE; + if (!EnsureImageHlpInitialized()) + return PR_FALSE; // Have to duplicate handle to get a real handle. if (!::DuplicateHandle(::GetCurrentProcess(), @@ -739,6 +739,9 @@ NS_DescribeCodeAddress(void *aPC, nsCodeAddressDetails *aDetails) aDetails->function[0] = '\0'; aDetails->foffset = 0; + if (!EnsureSymInitialized()) + return NS_ERROR_FAILURE; + HANDLE myProcess = ::GetCurrentProcess(); BOOL ok; diff --git a/mozilla/xpcom/base/nsTraceRefcntImpl.cpp b/mozilla/xpcom/base/nsTraceRefcntImpl.cpp index f5649374ec0..04ebf85566b 100644 --- a/mozilla/xpcom/base/nsTraceRefcntImpl.cpp +++ b/mozilla/xpcom/base/nsTraceRefcntImpl.cpp @@ -50,11 +50,6 @@ #include #include "nsStackWalk.h" -#if defined(_WIN32) -#include -#include "nsStackFrameWin.h" // XXX LoadLibrarySymbols no longer belongs here -#endif - #ifdef HAVE_LIBDL #include #endif @@ -883,65 +878,6 @@ nsTraceRefcntImpl::DemangleSymbol(const char * aSymbol, //---------------------------------------------------------------------- -NS_COM void -nsTraceRefcntImpl::LoadLibrarySymbols(const char* aLibraryName, - void* aLibrayHandle) -{ -#ifdef NS_IMPL_REFCNT_LOGGING -#if defined(_WIN32) && defined(_M_IX86) /* Win32 x86 only */ - if (!gInitialized) - InitTraceLog(); - - if (gAllocLog || gRefcntsLog) { - fprintf(stdout, "### Loading symbols for %s\n", aLibraryName); - fflush(stdout); - - HANDLE myProcess = ::GetCurrentProcess(); - BOOL ok = EnsureSymInitialized(); - if (ok) { - const char* baseName = aLibraryName; - // just get the base name of the library if a full path was given: - PRInt32 len = strlen(aLibraryName); - for (PRInt32 i = len - 1; i >= 0; i--) { - if (aLibraryName[i] == '\\') { - baseName = &aLibraryName[i + 1]; - break; - } - } - DWORD baseAddr = _SymLoadModule(myProcess, - NULL, - (char*)baseName, - (char*)baseName, - 0, - 0); - ok = (baseAddr != nsnull); - } - if (!ok) { - LPVOID lpMsgBuf; - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR) &lpMsgBuf, - 0, - NULL - ); - fprintf(stdout, "### ERROR: LoadLibrarySymbols for %s: %s\n", - aLibraryName, lpMsgBuf); - fflush(stdout); - LocalFree( lpMsgBuf ); - } - } -#endif -#endif -} - -//---------------------------------------------------------------------- - - EXPORT_XPCOM_API(void) NS_LogInit() { diff --git a/mozilla/xpcom/base/nsTraceRefcntImpl.h b/mozilla/xpcom/base/nsTraceRefcntImpl.h index 4aebb9d0e69..be79e294c3c 100644 --- a/mozilla/xpcom/base/nsTraceRefcntImpl.h +++ b/mozilla/xpcom/base/nsTraceRefcntImpl.h @@ -60,10 +60,6 @@ public: static NS_COM void ResetStatistics(void); - static NS_COM void LoadLibrarySymbols(const char* aLibraryName, - void* aLibrayHandle); - - static NS_COM void DemangleSymbol(const char * aSymbol, char * aBuffer, int aBufLen); diff --git a/mozilla/xpcom/components/nsNativeComponentLoader.cpp b/mozilla/xpcom/components/nsNativeComponentLoader.cpp index cfd46a00015..21cf42f2294 100644 --- a/mozilla/xpcom/components/nsNativeComponentLoader.cpp +++ b/mozilla/xpcom/components/nsNativeComponentLoader.cpp @@ -158,12 +158,6 @@ nsNativeModuleLoader::LoadModule(nsILocalFile* aFile, nsIModule* *aResult) return rv; } -#ifdef NS_BUILD_REFCNT_LOGGING - // Inform refcnt tracer of new library so that calls through the - // new library can be traced. - nsTraceRefcntImpl::LoadLibrarySymbols(filePath.get(), data.library); -#endif - #ifdef IMPLEMENT_BREAK_AFTER_LOAD nsCAutoString leafName; aFile->GetNativeLeafName(leafName);