From 2fb7f38dfe18b56bf2e1a8415b868a0129a97759 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Sun, 9 Apr 2006 23:06:18 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=9827 --- checkin_notes | 16 ++++++ lib/stackwalker_win.cpp | 94 +++++++++++++++++++++----------- win_build/installerv2/BOINC.ism | Bin 206336 -> 206336 bytes 3 files changed, 79 insertions(+), 31 deletions(-) diff --git a/checkin_notes b/checkin_notes index a79b843608..ea461e68b4 100755 --- a/checkin_notes +++ b/checkin_notes @@ -3654,3 +3654,19 @@ Rom 8 Apr 2006 lib/ diagnostics.C stackwalker_win.cpp, .h + +Rom 9 Apr 2006 + - Bug Fix: Add a check to stackwalker so that if it detects it is running on + Win9x it'll switch over to the Win9x compatible dbghelp.dll. After + checking it out, it doesn't require any changes to the stack walker code + as it has the 64 bit function exports. So all that was required was + just changing which DLL was used to get the function pointers. + - Bug Fix: Upgrade to the latest stable debugging tools from Microsoft. + + lib/ + stackwalker_win.cpp + win_build/installerv2/redist/Windows/x86/ + dbghelp.dll + dbghelp95.dll (Added) + srcsrv.dll (Added) + symsrv.dll (Added) diff --git a/lib/stackwalker_win.cpp b/lib/stackwalker_win.cpp index 5b028908a7..b6f99ebd95 100644 --- a/lib/stackwalker_win.cpp +++ b/lib/stackwalker_win.cpp @@ -202,13 +202,6 @@ static HINSTANCE g_hSymSrvDll = NULL; static HINSTANCE g_hSrcSrvDll = NULL; static CRITICAL_SECTION g_csFileOpenClose = {0}; -ULONG64 gSymbolBuffer[ - (sizeof(SYMBOL_INFO) + - MAX_SYM_NAME*sizeof(TCHAR) + - sizeof(ULONG64) - 1) / - sizeof(ULONG64) -]; -PSYMBOL_INFO gpSymbol = (PSYMBOL_INFO)gSymbolBuffer; // ########################################################################################## // ########################################################################################## @@ -312,28 +305,56 @@ int DebuggerInitialize() if (g_bInitialized != FALSE) return 0; - g_hDbgHelpDll = LoadLibrary( _T("C:\\Program Files\\BOINC\\dbghelp.dll") ); - if ( g_hDbgHelpDll == NULL ) + OSVERSIONINFO osvi; + ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + + GetVersionEx((OSVERSIONINFO*)&osvi); + + // If Win9x use the old dbghelp.dll (5.0.2195.1) + if (VER_PLATFORM_WIN32_WINDOWS == osvi.dwPlatformId) { - g_hDbgHelpDll = LoadLibrary( _T("dbghelp.dll") ); + // Ours is named dbghelp95.dll + g_hDbgHelpDll = LoadLibrary( _T("C:\\Program Files\\BOINC\\dbghelp95.dll") ); if ( g_hDbgHelpDll == NULL ) { - _ftprintf( stderr, "LoadLibrary( \"dbghelp.dll\" ): GetLastError = %lu\n", gle ); - g_bInitialized = FALSE; - return 1; + // Last ditch effort use original name in case some other + // application installed it into the system path. + g_hDbgHelpDll = LoadLibrary( _T("dbghelp.dll") ); + if ( g_hDbgHelpDll == NULL ) + { + _ftprintf( stderr, "LoadLibrary( \"dbghelp95.dll\" ): GetLastError = %lu\n", gle ); + g_bInitialized = FALSE; + return 1; + } } } - - g_hSymSrvDll = LoadLibrary( _T("C:\\Program Files\\BOINC\\symsrv.dll") ); - if ( g_hSymSrvDll == NULL ) + else { - g_hSymSrvDll = LoadLibrary( _T("symsrv.dll") ); - } + // Anything newer use the latest and greatest + g_hDbgHelpDll = LoadLibrary( _T("C:\\Program Files\\BOINC\\dbghelp.dll") ); + if ( g_hDbgHelpDll == NULL ) + { + g_hDbgHelpDll = LoadLibrary( _T("dbghelp.dll") ); + if ( g_hDbgHelpDll == NULL ) + { + _ftprintf( stderr, "LoadLibrary( \"dbghelp.dll\" ): GetLastError = %lu\n", gle ); + g_bInitialized = FALSE; + return 1; + } + } - g_hSrcSrvDll = LoadLibrary( _T("C:\\Program Files\\BOINC\\srcsrv.dll") ); - if ( g_hSrcSrvDll == NULL ) - { - g_hSrcSrvDll = LoadLibrary( _T("srcsrv.dll") ); + g_hSymSrvDll = LoadLibrary( _T("C:\\Program Files\\BOINC\\symsrv.dll") ); + if ( g_hSymSrvDll == NULL ) + { + g_hSymSrvDll = LoadLibrary( _T("symsrv.dll") ); + } + + g_hSrcSrvDll = LoadLibrary( _T("C:\\Program Files\\BOINC\\srcsrv.dll") ); + if ( g_hSrcSrvDll == NULL ) + { + g_hSrcSrvDll = LoadLibrary( _T("srcsrv.dll") ); + } } pIAV = (tIAV) GetProcAddress( g_hDbgHelpDll, "ImagehlpApiVersion" ); @@ -431,8 +452,8 @@ int DebuggerInitialize() // SymGetOptions() symOptions = pSGO(); - symOptions |= SYMOPT_LOAD_LINES; symOptions |= SYMOPT_DEBUG; + symOptions |= SYMOPT_LOAD_LINES; symOptions |= SYMOPT_NO_PROMPTS; symOptions &= ~SYMOPT_UNDNAME; pSSO( symOptions ); // SymSetOptions() @@ -535,6 +556,15 @@ static void ShowStackRM(HANDLE hThread, CONTEXT& Context, HANDLE hSWProcess) IMAGEHLP_LINE64 Line; STACKFRAME64 StackFrame; + ULONG64 SymbolBuffer[ + (sizeof(SYMBOL_INFO) + + MAX_SYM_NAME*sizeof(TCHAR) + + sizeof(ULONG64) - 1) / + sizeof(ULONG64) + ]; + PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)SymbolBuffer; + + if (g_bInitialized == FALSE) { _ftprintf(stderr, _T("Stackwalker not initialized (or was not able to initialize)!\n")); @@ -576,9 +606,9 @@ static void ShowStackRM(HANDLE hThread, CONTEXT& Context, HANDLE hSWProcess) StackFrame.AddrFrame.Offset = Context.Ebp; StackFrame.AddrFrame.Mode = AddrModeFlat; - memset( gpSymbol, '\0', sizeof(gSymbolBuffer) ); - gpSymbol->SizeOfStruct = sizeof(SYMBOL_INFO); - gpSymbol->MaxNameLen = MAX_SYM_NAME; + memset( pSymbol, '\0', sizeof(SymbolBuffer) ); + pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO); + pSymbol->MaxNameLen = MAX_SYM_NAME; memset( &Line, '\0', sizeof(IMAGEHLP_LINE64) ); Line.SizeOfStruct = sizeof(IMAGEHLP_LINE64); @@ -617,15 +647,17 @@ static void ShowStackRM(HANDLE hThread, CONTEXT& Context, HANDLE hSWProcess) // show procedure info (SymFromAddr()) undName[0] = 0; offsetFromSymbol = 0; - if ( !pSFA( hSWProcess, StackFrame.AddrPC.Offset, &offsetFromSymbol, gpSymbol ) ) + if ( !pSFA( hSWProcess, StackFrame.AddrPC.Offset, &offsetFromSymbol, pSymbol ) ) { if ( gle != 487 ) - _ftprintf(stderr, _T("SymFromAddr(): GetLastError = %lu\n"), gle ); + { + _ftprintf(stderr, _T("SymFromAddr(): GetLastError = '%lu' Address = '%.8x'\n"), gle, StackFrame.AddrPC.Offset); + } } else { // UnDecorateSymbolName() - pUDSN( gpSymbol->Name, undName, MAX_SYM_NAME, UNDNAME_NAME_ONLY ); + pUDSN( pSymbol->Name, undName, MAX_SYM_NAME, UNDNAME_NAME_ONLY ); } // show line number info (SymGetLineFromAddr()) @@ -634,14 +666,14 @@ static void ShowStackRM(HANDLE hThread, CONTEXT& Context, HANDLE hSWProcess) { if ( (gle != 487) && (frameNum > 0) ) // ignore error for first frame { - _ftprintf(stderr, _T("SymGetLineFromAddr(): GetLastError = %lu\n"), gle ); + _ftprintf(stderr, _T("SymGetLineFromAddr(): GetLastError = '%lu' Address = '%.8x'\n"), gle, StackFrame.AddrPC.Offset); } } // show module info (SymGetModuleInfo()) if ( !pSGMI( hSWProcess, StackFrame.AddrPC.Offset, &Module ) ) { - _ftprintf(stderr, _T("SymGetModuleInfo(): GetLastError = %lu\n"), gle ); + _ftprintf(stderr, _T("SymGetModuleInfo(): GetLastError = '%lu' Address = '%.8x'\n"), gle, StackFrame.AddrPC.Offset); } } // we seem to have a valid PC diff --git a/win_build/installerv2/BOINC.ism b/win_build/installerv2/BOINC.ism index 4bffef0b64da01a5969acc5f5c4b3ed07b3fa096..2cef616b59a24f5e0c6e12a80603c73534fb7388 100644 GIT binary patch delta 947 zcmY*XZETZO6n@V+cm2Na=onq?-0V8HkzvX<+s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