posts - 36, comments - 30, trackbacks - 0, articles - 0

dumpfile test

Posted on 2007-03-24 19:23 vcommon 阅读(631) 评论(0)  编辑 收藏 引用
1:Download Windows XP Service Pack 2 Support Tools from microsoft web site or from xp install CD.
2:打开控制面板,系统,高级,启动与故障恢复,设置,小内存转储,minidump.
3:coding to test(using vista SDK and unicode and link with Dbghelp.lib)(see code 1):(reference MSDN-
DirectX SDK (February 200...Technical Articles Crash Dump Analysis)
4:got file-Local Settings\Temp\AppName\v1.0-20070324-183348-684-2388.dmp only 507K size.
5:using dumpchk v1.0-20070324-183348-684-2388.dmp to check the file.(got debugclient cannot open dumpfile  0x80070003 error,so I change the dump file to c:\APPNAME.)(for reference--There must be a paging file configured on the system boot partition.  If you have changed the paging file location to a different drive letter then a memory dump cannot be saved).
6:see dumpcheck details as code2(so the file is correct):
7:anasyis the dump file. Open Visual Studio --Select File->Open->Project --Select the minidump file --Run the debugger
8:see the crash position-see picture1

~code1:
         #include <dbghelp.h>
         #include <shellapi.h>
         #include <shlobj.h>
         #include <strsafe.h>
         int GenerateDump(EXCEPTION_POINTERS* pExceptionPointers)
         {
             BOOL bMiniDumpSuccessful;
    WCHAR szPath[MAX_PATH];
    WCHAR szFileName[MAX_PATH];
    WCHAR* szAppName = L"AppName";
    WCHAR* szVersion = L"v1.0";
    DWORD dwBufferSize = MAX_PATH;
    HANDLE hDumpFile;
    SYSTEMTIME stLocalTime;
    MINIDUMP_EXCEPTION_INFORMATION ExpParam;
    GetLocalTime( &stLocalTime );
    GetTempPath( dwBufferSize, szPath );
    StringCchPrintf( szFileName, MAX_PATH, L"%s%s", szPath, szAppName );
    CreateDirectory( szFileName, NULL );
    StringCchPrintf( szFileName, MAX_PATH, L"%s%s\\%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp",
               szPath, szAppName, szVersion,
               stLocalTime.wYear, stLocalTime.wMonth, stLocalTime.wDay,
               stLocalTime.wHour, stLocalTime.wMinute, stLocalTime.wSecond,
               GetCurrentProcessId(), GetCurrentThreadId());
    hDumpFile = CreateFile(szFileName, GENERIC_READ|GENERIC_WRITE,
                FILE_SHARE_WRITE|FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0);
    ExpParam.ThreadId = GetCurrentThreadId();
    ExpParam.ExceptionPointers = pExceptionPointers;
    ExpParam.ClientPointers = TRUE;
    bMiniDumpSuccessful = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
                    hDumpFile, MiniDumpWithDataSegs, &ExpParam, NULL, NULL);
    return EXCEPTION_EXECUTE_HANDLER;
}
void SomeFunction()
{
    __try
    {
        int *pBadPtr = NULL;
        *pBadPtr = 0;
    }
    __except(GenerateDump(GetExceptionInformation()))
    {
    }
}
void CdumptestDlg::OnBnClickedButton1()
{
 // TODO: Add your control notification handler code here
 SomeFunction();
}



~code2:
H:\Program Files\Support Tools>dumpchk C:\AppName\v1.0-20070324-190603-3984-2932
.dmp
Loading dump file C:\AppName\v1.0-20070324-190603-3984-2932.dmp
----- User Mini Dump Analysis

MINIDUMP_HEADER:
Version         A793 (5128)
NumberOfStreams 8
Flags 1

Streams:
Stream 0: type ThreadListStream (3), size 00000064, RVA 00000178
Stream 1: type ModuleListStream (4), size 00000BD4, RVA 000001DC
  28 modules
  RVA 000001E0, 00400000 - 00411000: 'h:\documents and settings\peter\my documen
ts\visual studio 2005\Projects\dumptest\debug\dumptest.exe'
  RVA 0000024C, 7c920000 - 7c9b4000: 'H:\WINDOWS\system32\ntdll.dll'
  RVA 000002B8, 7c800000 - 7c91c000: 'H:\WINDOWS\system32\kernel32.dll'
  RVA 00000324, 68d60000 - 68e01000: 'H:\WINDOWS\system32\dbghelp.dll'
  RVA 00000390, 77be0000 - 77c38000: 'H:\WINDOWS\system32\msvcrt.dll'
  RVA 000003FC, 77bd0000 - 77bd8000: 'H:\WINDOWS\system32\version.dll'
  RVA 00000468, 77da0000 - 77e49000: 'H:\WINDOWS\system32\advapi32.dll'
  RVA 000004D4, 77e50000 - 77ee1000: 'H:\WINDOWS\system32\rpcrt4.dll'
  RVA 00000540, 782e0000 - 7852b000: 'H:\WINDOWS\WinSxS\x86_Microsoft.VC80.Debug
MFC_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_c8452471\mfc80ud.dll'
  RVA 000005AC, 10200000 - 10320000: 'H:\WINDOWS\WinSxS\x86_Microsoft.VC80.Debug
CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_f75eb16c\msvcr80d.dll'
  RVA 00000618, 77ef0000 - 77f37000: 'H:\WINDOWS\system32\gdi32.dll'
  RVA 00000684, 77d10000 - 77d9f000: 'H:\WINDOWS\system32\user32.dll'
  RVA 000006F0, 77f40000 - 77fb6000: 'H:\WINDOWS\system32\shlwapi.dll'
  RVA 0000075C, 77180000 - 77283000: 'H:\WINDOWS\WinSxS\x86_Microsoft.Windows.Co
mmon-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll'
  RVA 000007C8, 76300000 - 7631d000: 'H:\WINDOWS\system32\imm32.dll'
  RVA 00000834, 62c20000 - 62c29000: 'H:\WINDOWS\system32\lpk.dll'
  RVA 000008A0, 73fa0000 - 7400b000: 'H:\WINDOWS\system32\usp10.dll'
  RVA 0000090C, 5d360000 - 5d36a000: 'H:\WINDOWS\WinSxS\x86_Microsoft.VC80.MFCLO
C_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_3415f6d0\mfc80CHS.dll'
  RVA 00000978, 5a800000 - 5a81e000: 'I:\Media-Tools\Software\Windows'
  RVA 000009E4, 770f0000 - 7717c000: 'H:\WINDOWS\system32\oleaut32.dll'
  RVA 00000A50, 76990000 - 76acd000: 'H:\WINDOWS\system32\ole32.dll'
  RVA 00000ABC, 74680000 - 746cb000: 'H:\WINDOWS\system32\MSCTF.dll'
  RVA 00000B28, 10000000 - 10004000: 'H:\Program Files\Unlocker\UnlockerHook.dll
'
  RVA 00000B94, 7d590000 - 7dd82000: 'H:\WINDOWS\system32\shell32.dll'
  RVA 00000C00, 73640000 - 7366e000: 'H:\WINDOWS\system32\MSCTFIME.IME'
  RVA 00000C6C, 5adc0000 - 5adf7000: 'H:\WINDOWS\system32\uxtheme.dll'
  RVA 00000CD8, 01000000 - 01019000: 'H:\Program Files\Rising\AntiSpyware\ieprot
.dll'
  RVA 00000D44, 76bc0000 - 76bcb000: 'H:\WINDOWS\system32\psapi.dll'
Stream 2: type MemoryListStream (5), size 000001F4, RVA 00002538
  31 memory ranges
  range#    Address      Size
       0    7c92eb14   00000100
       1    00409000   00000594
       2    7c99c000   000049e0
       3    7c883000   000043a0
       4    68df0000   00004a70
       5    77c2d000   000067c8
       6    77bd5000   000002fc
       7    77e16000   00004528
       8    77eda000   00000e90
       9    784f9000   000071a4
      10    1030e000   00006acc
      11    77f33000   00000f60
      12    77d70000   00001180
      13    77fad000   00000ff8
      14    77212000   00000a50
      15    76316000   0000088c
      16    62c26000   000001d4
      17    73fe5000   0000f2c0
      18    5a817000   00000e6c
      19    5a819000   00000bbc
      20    77172000   00002038
      21    76ab6000   000069d4
      22    746c2000   000013dc
      23    10002000   00000424
      24    7d78d000   0001c170
      25    73668000   00000568
      26    5adf1000   00000e78
      27    0100f000   00001690
      28    76bc5000   000031e8
      29    0012e198   00001e68
      30    0112fe98   00000168
Stream 3: type ExceptionStream (6), size 000000A8, RVA 000000D0
Stream 4: type SystemInfoStream (7), size 00000038, RVA 00000080
Stream 5: type ??? (15), size 00000018, RVA 000000B8
Stream 6: type UnusedStream (0), size 00000000, RVA 00000000
Stream 7: type UnusedStream (0), size 00000000, RVA 00000000


Windows XP Version 2600 (Service Pack 2) UP Free x86 compatible
Debug session time: Sat Mar 24 19:06:03 2007
System Uptime: not available
The call to LoadLibrary(ext) failed with error 2.
Please check your debugger configuration and/or network access
PEB NULL...
Finished dump check

~pic1

只有注册用户登录后才能发表评论。