Remove nsTraceRefcnt::LoadLibrarySymbols, which is no longer needed due to the error handling in SymGetModuleInfoEspecial. b=391793 r+a=bsmedberg

This commit is contained in:
dbaron@dbaron.org 2007-08-13 12:36:57 -07:00
parent 7bc732995c
commit 35c35b77da
4 changed files with 5 additions and 76 deletions

View File

@ -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;

View File

@ -50,11 +50,6 @@
#include <math.h>
#include "nsStackWalk.h"
#if defined(_WIN32)
#include <windows.h>
#include "nsStackFrameWin.h" // XXX LoadLibrarySymbols no longer belongs here
#endif
#ifdef HAVE_LIBDL
#include <dlfcn.h>
#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()
{

View File

@ -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);

View File

@ -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);