Debugging code and cleanup from fixing Windows stack traces to work on VC8-compiled builds in addition to VC7.1-compiled builds. b=391848 r=bsmedberg a=bzbarsky

This commit is contained in:
dbaron@dbaron.org 2007-08-19 14:37:55 -07:00
Родитель 8bd5aed229
Коммит 3c01b39a9d
1 изменённых файлов: 13 добавлений и 4 удалений

Просмотреть файл

@ -283,7 +283,8 @@ void PrintError(char *prefix)
0, 0,
NULL NULL
); );
fprintf(stderr, "### ERROR: %s: %s", prefix, lpMsgBuf); fprintf(stderr, "### ERROR: %s: %s",
prefix, lpMsgBuf ? lpMsgBuf : "(null)\n");
fflush(stderr); fflush(stderr);
LocalFree( lpMsgBuf ); LocalFree( lpMsgBuf );
} }
@ -635,7 +636,7 @@ NS_StackWalk(NS_WalkStackCallback aCallback, PRUint32 aSkipFrames,
::GetCurrentProcess(), ::GetCurrentProcess(),
::GetCurrentProcess(), ::GetCurrentProcess(),
&myProcess, &myProcess,
THREAD_ALL_ACCESS, FALSE, 0)) { PROCESS_ALL_ACCESS, FALSE, 0)) {
PrintError("DuplicateHandle (process)"); PrintError("DuplicateHandle (process)");
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@ -695,6 +696,8 @@ static BOOL CALLBACK callbackEspecial(
: (addr <= aModuleBase && addr >= (aModuleBase - aModuleSize)) : (addr <= aModuleBase && addr >= (aModuleBase - aModuleSize))
) { ) {
retval = _SymLoadModule(GetCurrentProcess(), NULL, aModuleName, NULL, aModuleBase, aModuleSize); retval = _SymLoadModule(GetCurrentProcess(), NULL, aModuleName, NULL, aModuleBase, aModuleSize);
if (!retval)
PrintError("SymLoadModule");
} }
return retval; return retval;
@ -725,6 +728,8 @@ static BOOL CALLBACK callbackEspecial64(
: (addr <= aModuleBase && addr >= (aModuleBase - aModuleSize)) : (addr <= aModuleBase && addr >= (aModuleBase - aModuleSize))
) { ) {
retval = _SymLoadModule64(GetCurrentProcess(), NULL, aModuleName, NULL, aModuleBase, aModuleSize); retval = _SymLoadModule64(GetCurrentProcess(), NULL, aModuleName, NULL, aModuleBase, aModuleSize);
if (!retval)
PrintError("SymLoadModule64");
} }
return retval; return retval;
@ -767,7 +772,7 @@ BOOL SymGetModuleInfoEspecial(HANDLE aProcess, DWORD aAddr, PIMAGEHLP_MODULE aMo
* Not loaded, here's the magic. * Not loaded, here's the magic.
* Go through all the modules. * Go through all the modules.
*/ */
enumRes = _EnumerateLoadedModules(aProcess, (PENUMLOADED_MODULES_CALLBACK)callbackEspecial, (PVOID)&aAddr); enumRes = _EnumerateLoadedModules(aProcess, callbackEspecial, (PVOID)&aAddr);
if (FALSE != enumRes) if (FALSE != enumRes)
{ {
/* /*
@ -775,6 +780,8 @@ BOOL SymGetModuleInfoEspecial(HANDLE aProcess, DWORD aAddr, PIMAGEHLP_MODULE aMo
* If it fails, then well, we have other problems. * If it fails, then well, we have other problems.
*/ */
retval = _SymGetModuleInfo(aProcess, aAddr, aModuleInfo); retval = _SymGetModuleInfo(aProcess, aAddr, aModuleInfo);
if (!retval)
PrintError("SymGetModuleInfo");
} }
} }
@ -817,7 +824,7 @@ BOOL SymGetModuleInfoEspecial64(HANDLE aProcess, DWORD64 aAddr, PIMAGEHLP_MODULE
* Not loaded, here's the magic. * Not loaded, here's the magic.
* Go through all the modules. * Go through all the modules.
*/ */
enumRes = _EnumerateLoadedModules64(aProcess, (PENUMLOADED_MODULES_CALLBACK64)callbackEspecial64, (PVOID)&aAddr); enumRes = _EnumerateLoadedModules64(aProcess, callbackEspecial64, (PVOID)&aAddr);
if (FALSE != enumRes) if (FALSE != enumRes)
{ {
/* /*
@ -825,6 +832,8 @@ BOOL SymGetModuleInfoEspecial64(HANDLE aProcess, DWORD64 aAddr, PIMAGEHLP_MODULE
* If it fails, then well, we have other problems. * If it fails, then well, we have other problems.
*/ */
retval = _SymGetModuleInfo64(aProcess, aAddr, aModuleInfo); retval = _SymGetModuleInfo64(aProcess, aAddr, aModuleInfo);
if (!retval)
PrintError("SymGetModuleInfo64");
} }
} }