Debug Dump file
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的更多相关文章
- Debug program crash with dump file.
1. Task manager, -> find the process for the program which crashed. 2. Right click the process -& ...
- about !dbgprint to analyze BSOD dump file.
基本规则: 只有debug mode enable的机器,产生的dump file才会保存dbgprint的buffer. 默认!dbgprint的buffer size是4k. 增加buffer s ...
- 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\ ...
- How to Create Dump File for Applications
使用WinDBG这个工具,可以在应用程序异常终止或者无响应时获取它的尸体,以用来解剖研究. Creating Dump File 在Vista环境中抓取Dump文件很方便,在task man ...
- Linux core dump file详解
Linux core dump file详解 http://www.cnblogs.com/langqi250/archive/2013/03/05/2944931.html
- 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 ...
- 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 简述 ...
- Using pg_dump restore dump file on Odoo
pg_restore -C -d postgres db.dump
- executing in nfs will not generate core dump file
最近遇到了一个奇怪的问题. linux系统的pc搭建nfs server,开发板作为nfs client,开发板中全程root权限操作,执行的程序放到 nfs server 中 exports 出的目 ...
随机推荐
- MT 互联网 面试标准
能力模型 业务理解(每项2分) java知识(每项2分) 网络知识(每项1分) 设计模式(每项3分) 数据库知识(每项2分) 框架知识(每项1分) 数据结构与算法(每项1分) 架构知识(每项3分) 操 ...
- jQuery的事件处理
一.页面加载响应事件 $(document).ready()方法,获取文档就绪的时候.他极大地提高了Web相应速度.虽然该方法可以代替传统的window.onload()方法,但是两者之间仍然有差别. ...
- Tenka1 Programmer Contest 2019
C:即要使前一部分为白色后一部分为黑色,枚举分割点前缀和计算答案取min即可. #include<bits/stdc++.h> using namespace std; #define l ...
- Apache的安装与配置+PHP
https://blog.csdn.net/u012130971/article/details/79284937 文件夹名称不要有空格
- Redis 高级部分
一.主从复制 image.png Rdis 的主从复制特点 image.png 1. 配置主从 实现方式同样有两种: 命令方式和配置文件方式 命令方式 只需要在从服务器上执行如下命令即可 sl ...
- 老男孩Python全栈学习 S9 日常作业 008
1.有如下两个集合,pythons是报名python课程的学员名字集合,linuxs是报名linux课程的学员名字集合 pythons={'alex','egon','yuanhao','wupeiq ...
- Python认识到放弃
基础入门 计算机硬件基础 变量 数据类型 基本运算符 变量常量 流程控制 数据类型 数字,字符串,列表 元组,字典,集合 字符编码 python2 python3 文件处理 文件读写 指针移动 函数 ...
- 分库分表后跨分片查询与Elastic Search
携程酒店订单Elastic Search实战:http://www.lvesu.com/blog/main/cms-610.html 为什么分库分表后不建议跨分片查询:https://www.jian ...
- [译]Ocelot - Caching
原文 Ocelot支持基本的缓存,目前Ocelot的缓存是通过CacheManager project实现的. 下面的示例展示了如何启用缓存: s.AddOcelot() .AddCacheManag ...
- manacher最长回文子串
https://www.luogu.org/blog/codesonic/manacheralgorithm 先放上洛谷的链接,毕竟讲的真好 两道例题 luogu4555 SP7586 inline ...