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 出的目 ...
随机推荐
- array_map、array_walk、array_reduce
不同情境下替换foreach,且效果更佳 array_map 遍历原数组,array_map()参数中有几个数组,自定义函数就接收几个参数, 在每个值上进行自定义函数处理,具有返回值,需要一个新数组 ...
- Linux学习之路4——文件IO打开、创建、读写操作
1.使用man 2 open.man 2 creat.man 2 write.man 2 read命令获取头文件 语法: int open(const char *pathname, int flag ...
- nodejs搭建web服务器
一.代码结构 //1.引入相关模块 var http=require("http") var url=require("url") var fs=require ...
- 《AutoCAD Civil 3D .NET二次开发》勘误1
第十三章atc文件中Displayname应为DisplayName,注意Name的N为大写,否则参数名称无法正常显示. 给您带来的不便深表歉意!
- 【LOJ#3097】[SNOI2019]通信(费用流)
[LOJ#3097][SNOI2019]通信(费用流) 题面 LOJ 题解 暴力就直接连\(O(n^2)\)条边. 然后分治/主席树优化连边就行了. 抄zsy代码,zsy代码是真的短 #include ...
- 使用sshpass同时更新一台ubuntu和一台CentOS
1.在ubuntu上安装sshpass sudo apt install sshpass 2.分别在两台的root路径下放上升级脚本: cent:/root/upgrade.sh #!/bin/bas ...
- ADC采样工作原理详解
如何利用单片机的ADC模块(或者独立的ADC芯片)得到接入ADC管脚上的实际电压值?这个问题,是第一次接触ADC时候,大家都会遇到的问题.会读到什么值单片机会读到什么值?需要看一个特性,就是几位的AD ...
- 理解依赖注入,laravel IoC容器
在看laravel文档的时候,有一个服务容器(IoC)的概念.它是这样介绍的:Laravel 服务容器是一个用于管理类依赖和执行依赖注入的强大工具.依赖注入听上去很花哨,其实质是通过构造函数或者某些情 ...
- Hadoop 生产配置文件V2
Hadoop 生产配置文件V2 生产环境的配置文件调优 !!! Apache Hadoop 2.7.3 && NN HA && RM HA且仅针对于HDFS & ...
- SpringBoot整合阿里云OSS文件上传、下载、查看、删除
1. 开发前准备 1.1 前置知识 java基础以及SpringBoot简单基础知识即可. 1.2 环境参数 开发工具:IDEA 基础环境:Maven+JDK8 所用技术:SpringBoot.lom ...