dump code
来源:互联网 发布:江南作品集软件下载 编辑:程序博客网 时间:2024/06/06 00:43
string AccurateTimeStr(void){ SYSTEMTIME sys; GetLocalTime( &sys ); ostringstream oss; oss << sys.wYear << "-" << sys.wMonth << "-" <<sys.wDay <<"_" <<sys.wHour<<sys.wMinute << sys.wSecond <<sys.wMilliseconds; return oss.str();}void GenerateDump(EXCEPTION_POINTERS * pExPtrs, const string& strDumpFilePath, int nFullDump){ HANDLE hFile = CreateFile(strDumpFilePath.c_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (INVALID_HANDLE_VALUE != hFile) { PEXCEPTION_POINTERS pExceptionInfo = NULL; pExceptionInfo = (PEXCEPTION_POINTERS)pExPtrs; MINIDUMP_EXCEPTION_INFORMATION MiniExceptionInfo = { 0 }; MiniExceptionInfo.ThreadId = GetCurrentThreadId(); MiniExceptionInfo.ExceptionPointers = pExceptionInfo; MiniExceptionInfo.ClientPointers = TRUE; MINIDUMP_TYPE dumpType = nFullDump ? MiniDumpValidTypeFlags : MiniDumpNormal /*MiniDumpWithFullMemory | MiniDumpWithDataSegs | MiniDumpWithHandleData | MiniDumpWithProcessThreadData | MiniDumpScanMemory | MiniDumpWithIndirectlyReferencedMemory*/; MiniDumpWriteDump(GetCurrentProcess(), ::GetCurrentProcessId(), hFile, dumpType, &MiniExceptionInfo, NULL, NULL); CloseHandle(hFile); }}NBFileSystem * g_pFileSystem = NULL;CAdoSqlEx * g_pAdoDB = NULL;GNIManagerOE * g_pGNIManager = NULL;CNBLiveAdapterASImpl* g_pLiveAdapter = NULL;bool g_bInit = false;static BOOL bGetStackTraceString = TRUE ;static BOOL bShowRegs = TRUE ;static BOOL bLetItCrash = FALSE ;static DWORD dwOpts = GSTSO_MODULE | GSTSO_SYMBOL | GSTSO_SRCLINE ;static HINSTANCE g_dllInstance = NULL;static LONG __stdcall MyExceptionFunc( EXCEPTION_POINTERS * pExPtrs ){ //Record Task List FILE* fp = NULL; char buffer[1024]={0}; ::GetModuleFileName( NULL , buffer , MAX_PATH ); char * pFind = strrchr( buffer , '\\' ); if( NULL == pFind ) return EXCEPTION_EXECUTE_HANDLER; pFind[0] = 0; pFind = strrchr( buffer ,'\\'); if( NULL == pFind ) return EXCEPTION_EXECUTE_HANDLER; pFind[1] = 0; char conf[1024] = { '\0' }; strcpy(conf, buffer); strcat(conf, "conf\\fix_graphics.ini"); string logdir = DiscoverInfo::Instance()->RuntimeLogFolder() + string("crashinfo.log"); strcpy( pFind , logdir.c_str()); fp = fopen( logdir.c_str() , "wb" ); char newline[2] = { 0x0d , 0x0a }; if ( TRUE == bShowRegs ) { const char* str = GetRegisterString ( pExPtrs ) ; fwrite( str , strlen( str ) , 1 , fp ); fwrite( newline , 2 , 1 , fp ); } if ( TRUE == bGetStackTraceString ) { const char * str = GetFirstStackTraceString ( dwOpts , pExPtrs ) ; do { fwrite( str , strlen( str ) , 1 , fp ); fwrite( newline , 2 , 1 , fp ); str = GetNextStackTraceString ( dwOpts , pExPtrs ) ; } while ( NULL != str ) ; } fclose( fp ); string strDump = AccurateTimeStr() + string(".dmp"); strDump = DiscoverInfo::Instance()->RuntimeLogFolder() + strDump; int nFullDump = 0; if( access(conf, 0) == 0 ) { nFullDump = GetPrivateProfileInt("BugTrace", "FullDump", 0, conf); } GenerateDump(pExPtrs, strDump, nFullDump); if ( TRUE == bLetItCrash ) { return ( EXCEPTION_CONTINUE_SEARCH ) ; } else { return ( EXCEPTION_EXECUTE_HANDLER ) ; }}
BOOL CMyTestApp::InitInstance()中添加如下 SetCrashHandlerFilter( MyExceptionFunc );
0 0
- dump code
- bmp file dump source code(I write)
- dump
- dump
- Dump
- dump
- dump
- dump
- dump()
- dump
- dump
- 1517584 - Short dump DYNPRO_NOT_FOUND in T-code ME21(N), ME51(N), ME41, ME31(K/L)
- [ARM] [linux master] 调试技术001 GDB-Advanced-001 Code Dump 的调试
- code
- code
- code
- code
- Code
- github简单使用
- python中的变量可变与不可变
- UVA12563Jin Ge Jin Qu hao(01背包变形:两个条件最优化)
- DOM包裹wrapInner()方法
- Android 设计开发及命名规范
- dump code
- 最常见的Mysql数据库优化、索引优化、字段优化等8个方法
- Java读取数据库的数据并转换为json数据
- LayoutTransition介绍
- android.intent.action.MAIN与android.intent.category.LAUNCHER
- Access中创建SQL语句
- WebBrowser页面与WinForm交互技巧
- Q82:三角形网格[Triangle Mesh]图形的平滑着色[Smooth Shading]
- dwz框架的应用