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 出的目 ...
随机推荐
- Flask自定义转换器,实现路由匹配正则表达式参数
Flask框架动态路由实现参数传递和Django框架有类似之处,但是相比于Django框架,Flask实现复杂的参数就需要自己自定义转换器来实现了,而不能向Django那样直接使用正则表达式 # 路由 ...
- jexus上部署nuget私服vs访问403错误解决方式
因为vs去访问nuget项目的时候是以下面的方式去访问的 http://域名/nuget/Search()?$filter=IsLatestVersion&searchTerm=''& ...
- php函数 array_count_values
(PHP 4, PHP 5, PHP 7) array_count_values — 统计数组中所有的值 array_count_values ( array $array ) : array arr ...
- php 计算两点地理坐标的距离
<?php /** * 计算两点地理坐标之间的距离 * @param Decimal $longitude1 起点经度 * @param Decimal $latitude1 起点纬度 * @p ...
- codeforces675D
Tree Construction CodeForces - 675D During the programming classes Vasya was assigned a difficult pr ...
- docker容器运行后退出,怎么才能一直运行?【转】
现象 启动docker容器 docker run –name [CONTAINER_NAME] [CONTAINER_ID] 查看容器运行状态 docker ps -a 发现刚刚启动的mydocker ...
- python学习日记(面向对象——组合)
组合指的是,在一个类中以另外一个类的对象作为数据属性,称为类的组合 圆环是由两个圆组成的,圆环的面积是外面圆的面积减去内部圆的面积.圆环的周长是内部圆的周长加上外部圆的周长.这个时候,我们就首先实现一 ...
- Nginx-keepalived+Nginx实现高可用集群
Keepalived+Nginx 高可用集群(主从模式) 集群架构图: 说明:Keepalived机器同样是nginx负载均衡器. 1)实验环境准备(此处都是使用的centos7系统) # cat / ...
- vue+elementUI+axios实现的全局loading加载动画
在项目中,很多时候都需要loading加载动画来缓解用户的焦虑等待,比如说,我打开了一个页面,而这个页面有很多接口请求,但浏览器的请求并发数就那么几个,再加上如果网速不行的话,那么这时候,用户很可能就 ...
- Asp.netMVC模型
Model负责在View和控制器之间进行数据的传递:用户输入的内容封装为Model对象,发给Controller:要显示的数据有Controller放到Model中,然后扔给View去显示.Contr ...