dump file is a snapshot of the processs memeory. to debug it, we need use its corresponding executive to help restore the scenario
pdb and source file are also needed to help analyze it.

create dump file

// header file, to generate a dll that will cause crash
#pragma once
#ifndef _DLL_TUTORIAL_H_
#define _DLL_TUTORIAL_H_
#include <iostream> #if defined DLL_EXPORT
#define DECLDIR __declspec(dllexport)
#else
#define DECLDIR __declspec(dllimport)
#endif extern "C"
{
DECLDIR int crash(int a, int b);
DECLDIR void Function(void);
} #endif // source file #define DLL_EXPORT
#include <iostream>
#include "Header.h" void func2(int a)
{
int * p = NULL;
*p = a;
} void func1(int a)
{
func2(a);
} extern "C"
{ DECLDIR int crash(int a, int b)
{
int b1 = a * b;
func1(b1);
return ;
} DECLDIR void Function(void)
{
std::cout << "DLL Called!" << std::endl;
} }
// header file. call functions from above dll and create dump file
#pragma once
#ifndef _DLL_TUTORIAL_H_
#define _DLL_TUTORIAL_H_
#include <iostream> #if defined DLL_EXPORT
#define DECLDIR __declspec(dllexport)
#else
#define DECLDIR __declspec(dllimport)
#endif extern "C"
{
DECLDIR int crash(int a, int b);
DECLDIR void Function(void);
} #endif // source file
#include"Header.h"
#include <Windows.h>
#include <DbgHelp.h> #pragma comment(lib, "DbgHelp.lib")
#pragma comment(lib,"dlls.lib") void call_func(int d)
{
int a = ;
crash(a, d);
} LONG WINAPI MyUnhandledExceptionFilter(_In_ struct _EXCEPTION_POINTERS *ExceptionInfo);
void MyDumpGenerate(); void MyDumpGenerate()
{
SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);
} LONG WINAPI MyUnhandledExceptionFilter(_In_ struct _EXCEPTION_POINTERS *ExceptionInfo)
{
MessageBox(, "DumpGenerate", , ); HANDLE lhDumpFile = CreateFile("C:\\data\\test.dmp", GENERIC_WRITE, , NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); MINIDUMP_EXCEPTION_INFORMATION loExceptionInfo;
loExceptionInfo.ExceptionPointers = ExceptionInfo;
loExceptionInfo.ThreadId = GetCurrentThreadId();
loExceptionInfo.ClientPointers = TRUE;
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), lhDumpFile, MiniDumpNormal, &loExceptionInfo, NULL, NULL); CloseHandle(lhDumpFile); return EXCEPTION_EXECUTE_HANDLER;
} int main()
{
MyDumpGenerate();
int a = ;
call_func(a);
return ;
} // run this binary from command line to create dump file

Debug dump file

Visual Studio
Set symbol path : https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/setting-symbol-and-source-paths-in-visual-studio
Crash dump analysis using the Windows debuggers (WinDbg) : https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/crash-dump-files

使用VS2012调试Dump文件
http://blog.csdn.net/tojohnonly/article/details/72864694

windbg commands
.help show all internal commands
!help show all external commands
.hh open chm file
sympath //search path
symfix //fixed symbol path
reload /i xx.dll ignore versrion mis

Debug Dump file的更多相关文章

  1. Debug program crash with dump file.

    1. Task manager, -> find the process for the program which crashed. 2. Right click the process -& ...

  2. about !dbgprint to analyze BSOD dump file.

    基本规则: 只有debug mode enable的机器,产生的dump file才会保存dbgprint的buffer. 默认!dbgprint的buffer size是4k. 增加buffer s ...

  3. TFS Build Error: CSC : fatal error CS0042: Unexpected error creating debug information file 'xxxx.PDB'

    CSC : fatal error CS0042: Unexpected error creating debug information file 'xxxx.PDB' -- 'c:\Builds\ ...

  4. How to Create Dump File for Applications

    使用WinDBG这个工具,可以在应用程序异常终止或者无响应时获取它的尸体,以用来解剖研究. Creating Dump File      在Vista环境中抓取Dump文件很方便,在task man ...

  5. Linux core dump file详解

    Linux core dump file详解 http://www.cnblogs.com/langqi250/archive/2013/03/05/2944931.html

  6. ORA-39142: incompatible version number 5.1 in dump file

    ORA-39142: incompatible version number 5.1 in dump file http://blog.itpub.net/26664718/viewspace-214 ...

  7. ORA-39095: Dump file space has been exhausted

    ORA-39095: Dump file space has been exhausted Table of Contents 1. 简述 2. 错误信息 3. 分析 4. 解决 5. 扩展 1 简述 ...

  8. Using pg_dump restore dump file on Odoo

    pg_restore -C -d postgres db.dump

  9. executing in nfs will not generate core dump file

    最近遇到了一个奇怪的问题. linux系统的pc搭建nfs server,开发板作为nfs client,开发板中全程root权限操作,执行的程序放到 nfs server 中 exports 出的目 ...

随机推荐

  1. Charles抓包工具使用

    Charles抓包工具使用和进行接口数据模拟 打开软件,选择Tools  >>  Map Local  >>  勾选enable  >>  add  >> ...

  2. H5键盘事件处理

    if (/Android/gi.test(navigator.userAgent)) { const innerHeight = window.innerHeight; window.addEvent ...

  3. hdu4843(NOI2000) 古城之谜 (trie树+DP)

    Description 著名的考古学家石教授在云梦高原上发现了一处古代城市遗址.让教授欣喜的是在这个他称为冰峰城(Ice-Peak City)的城市中有12块巨大石碑,上面刻着用某种文字书写的资料,他 ...

  4. Element类型和HTML元素获取

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...

  5. springboot启动关闭脚本

    springboot项目jar包启动,application.properties.jar包.shell脚本.static目录(静态页面和jar包分离)在同一目录下 [start.sh] #!/bin ...

  6. 在ConoHa上Centos7环境下源码安装部署LNMP

    本文记录了从源码,在Centos 7上手动部署LNMP环境的过程,为了方便以后对nginx和mariadb进行升级,这里采用yum的方式进行安装. 1.建立运行网站和数据库的用户和组 groupadd ...

  7. 利用ir.sequence自动生成序列号

    利用ir.sequence自动生成序列号 什么是序列号 可以这么理解,我有一个产品序号,编码的前缀是SOP,后缀是0001~9999的序号,没生成一个产品就自动流水加一,序列号不会重复,odoo中的i ...

  8. pixy&STM32使用记录(串口&SPI外设)

    先踏踏实实的把stm32的外设串口,SPI搞清楚,不要眼高手低,看不起小事.用SPI通信将pixy的数据读出来,将数据用串口发到串口助手上,然后处理数据,利用STM32的定时器调节pwm,控制电机,先 ...

  9. [NOI 2018] 归程

    Description 传送门 Solution 65分做法 先求出每个点到\(1\)号点的最短路,记为\(d[i]\).然后按照海拔从大到小依次加边,并查集维护每个连通块中\(d[i]\)的最小值, ...

  10. Tenka1 Programmer Contest 2019

    C:即要使前一部分为白色后一部分为黑色,枚举分割点前缀和计算答案取min即可. #include<bits/stdc++.h> using namespace std; #define l ...