Allow builds compiled with VC8 to function with older versions of dbghelp.dll. b=391848 r+a=bsmedberg

This commit is contained in:
dbaron@dbaron.org 2007-08-19 14:38:31 -07:00
parent 7344964330
commit 3d844b932b

View File

@ -798,6 +798,21 @@ BOOL SymGetModuleInfoEspecial(HANDLE aProcess, DWORD aAddr, PIMAGEHLP_MODULE aMo
return retval;
}
// New members were added to IMAGEHLP_MODULE64 (that show up in the
// Platform SDK that ships with VC8, but not the Platform SDK that ships
// with VC7.1, i.e., between DbgHelp 6.0 and 6.1), but we don't need to
// use them, and it's useful to be able to function correctly with the
// older library. (Stock Windows XP SP2 seems to ship with dbghelp.dll
// version 5.1.) Since Platform SDK version need not correspond to
// compiler version, and the version number in debughlp.h was NOT bumped
// when these changes were made, ifdef based on a constant that was
// added between these versions.
#ifdef SSRVOPT_SETCONTEXT
#define NS_IMAGEHLP_MODULE64_SIZE (((offsetof(IMAGEHLP_MODULE64, LoadedPdbName) + sizeof(DWORD64) - 1) / sizeof(DWORD64)) * sizeof(DWORD64))
#else
#define NS_IMAGEHLP_MODULE64_SIZE sizeof(IMAGEHLP_MODULE64)
#endif
#ifdef USING_WXP_VERSION
BOOL SymGetModuleInfoEspecial64(HANDLE aProcess, DWORD64 aAddr, PIMAGEHLP_MODULE64 aModuleInfo, PIMAGEHLP_LINE64 aLineInfo)
{
@ -806,7 +821,7 @@ BOOL SymGetModuleInfoEspecial64(HANDLE aProcess, DWORD64 aAddr, PIMAGEHLP_MODULE
/*
* Init the vars if we have em.
*/
aModuleInfo->SizeOfStruct = sizeof(IMAGEHLP_MODULE64);
aModuleInfo->SizeOfStruct = NS_IMAGEHLP_MODULE64_SIZE;
if (nsnull != aLineInfo) {
aLineInfo->SizeOfStruct = sizeof(IMAGEHLP_LINE64);
}
@ -916,7 +931,6 @@ NS_DescribeCodeAddress(void *aPC, nsCodeAddressDetails *aDetails)
DWORD64 addr = (DWORD64)aPC;
IMAGEHLP_MODULE64 modInfo;
IMAGEHLP_LINE64 lineInfo;
modInfo.SizeOfStruct = sizeof(modInfo);
BOOL modInfoRes;
modInfoRes = SymGetModuleInfoEspecial64(myProcess, addr, &modInfo, &lineInfo);
@ -954,7 +968,6 @@ NS_DescribeCodeAddress(void *aPC, nsCodeAddressDetails *aDetails)
DWORD addr = (DWORD)aPC;
IMAGEHLP_MODULE modInfo;
IMAGEHLP_LINE lineInfo;
modInfo.SizeOfStruct = sizeof(modInfo);
BOOL modInfoRes;
modInfoRes = SymGetModuleInfoEspecial(myProcess, addr, &modInfo, &lineInfo);