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 出的目 ...
随机推荐
- [转] package-lock.json
其实用一句话来概括很简单,就是锁定安装时的包的版本号,并且需要上传到git,以保证其他人在npm install时大家的依赖能保证一致. 引用知乎@周载南的回答 根据官方文档,这个package-lo ...
- 安装Cnario提示.Net 3.5安装错误, 检查Windows系统更新提示无法检查到更新, 安装.Net 3.5提示"Windows无法完成请求的更改, 错误代码:0x800F081F"
症状: Windows检查系统更新时提示无法完成, 尝试安装.Net 3.5等组件时都无法完成, 错误代码: 0x800F081F 原因: 可能时设置了禁止Windows自动更新, 需要重新打开 解决 ...
- vue省市区三级联动
仿照小米之家做的一个省市区三级联动,先上代码: HTML: <template> <section class="myAddress"> <secti ...
- CSS3动画效果transition
1.transition的浏览器支持情况 IE10+支持,IE6\7\8\9都不支持!目前,其他浏览器最新版本都支持,不需要再加前缀 -webkit- 之类的了 2. 还是一步一步说说怎么用trans ...
- MyBatis 3
MyBatis 3 学习笔记 一.Mybatis 基础知识 1.MyBatis 3编写步骤: 根据mybatis-config.xml配置文件创建一个SqlSessionFactory对象. sql映 ...
- C语言中结构体内存对齐
先写一个小程序: #include<stdio.h> struct student { int a; char k; short m; }; int main() { st ...
- docker基本使用
1.启动执行一次的容器 2.启动交互式容器 -i:告诉docker守护进程始终打开交互输入 -t:给容器分配一个伪tty终端 3.查看容器 docker ps:查看正在运行的容器 docker ps ...
- C#编程中的Image/Bitmap与base64的转换及 Base-64 字符数组或字符串的长度无效问题 解决
最近用base64编码传图片遇到了点问题,总结下. 首先总结下base64编码的逻辑,来自网络:https://www.cnblogs.com/zhangchengye/p/5432276.html ...
- 2018-2019-2 网络对抗技术 20165232 Exp2 后门原理与实践
2018-2019-2 网络对抗技术 20165232 Exp2 后门原理与实践 1. 后门原理与实践实验说明及预备知识 一.实验说明 任务一:使用netcat获取主机操作Shell,cron启动 ( ...
- java 导出
按钮 <a href="###" class="eui-btn eui-btn-small" onclick="Export()"&g ...