MFC程序自动生成dump Windbg文件

dump系列(2)C++程序异常或内存错误,导致闪退的解决办法:分析dump文件 如何在发布后程序中捕获程序的崩溃和异常往往是比较麻烦的事情,一般采用日志记录的方法来记录程序运行的每个流程,但是通常为了程序运行的性能,日志记录的方法只是记录程序运行的每个主要的处理流程,不能进行具体详细的记录,比如for 循环中的崩溃记录。C++语言中调用window API函数CreateFile()和MiniDumpWriteDump(),可以方便的记录程序崩溃时的Dump信息,并保持dum... 阅读详情

转自:http://www.cnblogs.com/hanf/archive/2009/12/16/1625566.html

 

 在客户机器上如何得到应该程序的详细出错信息, 这里使用drwtsn32,在应用程序崩溃的时候自动将调用栈的信息以文件形式保存在磁盘。

  生成dump有drwtsn32, NTSD,CDB等多种工具,drwtsn32 于系统自带。

  在项目中使用以下几个步骤:

 

1. 创建minidmp.h  

 

2、  实现UnhandledExceptionFilter

 

  

 

3.  在异常发生之前调用SetUnhandledExceptionFilter(GPTUnhandledExceptionFilter); 通常在Main()函数开始时调用即可。

 

 

注:必需有dbghlp.dll

MFC程序崩溃时生成dmp文件 我MFC项目崩溃时生成dmp日志总是生成在C:\Users\Administrator\AppData\Local\CrashDumps目录,我想保存在其它的位置。 阅读详情

相关推荐

VC++生成崩溃dump文件(附源码)

VC++开发常用功能一系列文章(欢迎订阅,持续更新...) Dump文件是进程的内存镜像。可以把程序的执行状态通过调试器保存到dump文件中。Dump文件是用来给驱动程序编写人员调试驱动程序用的, 这种文件必须用专用工具软件打开,比如使用WinDbg打开。现在的vs版本都支持直接打开dump文件 调试dump文件最好有pdb文件,不然也不好调试 直接上源码看: 头文件: #ifndef __MSJEXHND_H__ #define __MSJEXHND_H__ #ifdef _W...

Keivin 1899

MFC程序生成dmp文件

#include <dbghelp.h> int GenerateMiniDump(PEXCEPTION_POINTERS pExceptionPointers) { // 定义函数指针 typedef BOOL(WINAPI * MiniDumpWriteDumpT)( HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMIN...

Think88666的博客 1552

C++生成dump文件

C++ windows工程中 简单生成 dump文件,以便问题定位

MFC自动生成dmp文件用以排查exe运行崩溃

/ 从 “DbgHelp.dll” 库中获取 “MiniDumpWriteDump” 函数。//则需要 InitCommonControlsEx()。否则,将无法创建窗口。// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,// 如果一个运行在 Windows XP 上的应用程序清单指定要。// 将它设置为包括所有要在应用程序中使用的。// 这里做一些异常的过滤或提示。//创建dum文件保存的文件夹。

ficitor的博客 1334

C++ 生成Dump文件

利用C++生成Dump文件,以后程序崩溃了,可以找到哪个函数出的问题。非常好用,企业级的应用!

cvtColor +内存泄漏

题目不知道怎么取,因为cvtColor并没有产生内存泄漏,但是我由于没有正确使用cvtColor而出现了内存泄漏的问题,所以暂且以cvtColor+内存泄漏为题 1.应用背景 项目中用到cvtColor的地方是需要将灰度图转为3通道的彩色图(实际上转换后仍然为灰色的,但是电脑认为的是3通道的彩色图了) 因此需要用到以下语句 cvtColor(src_img, cvMtxRGB, C

smilebluesky的专栏 6062

Windows 服务器生成Dump文件

故障转存文件生成 添加头文件: #pragma once #include <tchar.h> #include <Windows.h> #include <DbgHelp.h> #pragma comment(lib, "user32.lib") int GenerateMiniDump(PEXCEPTION_POINTERS pExceptionPointers) { // 定义函数指针 typedef BOOL(WINAPI * MiniDumpWri

u013174817的博客 580

域格4G网优模块获取

1、获取当前小区信息 接口说明 该命令用于获取当前小区信息。 语法结构 命令类型 格式 返回结果 Execute AT+SCELLINFO +SCELLINFO: <cellMode>,<mcc>,<mnc>,<lac>,<cellId>,<afrcn>,<cpi>,<rxLevel>

自由的幻想 2467

转储了dump后,如何用Windbg进行分析呢?

上一篇向大家介绍了如何在程序“死”的时候转储Dump文件以及如何进行一些其他的处理(请戳蓝色字体:《程序又“死”了,但是还好我转储了dump!》)。那么,今天笔者将继续向大家详细介绍如何使用Windbg对dump文件进行调试分析。-- 准备工作 --Windbg是一款功能十分强大的调试工具,它设计了极其丰富的功能来支持各种调试任务,包括用户态调试、内核态调试、调试转储文件、远程调试等等。 ● ST...

ShiQW5696的博客 7480

Unity 接入 Steam 平台

Unity 接入 steam sdk 的登录和应用内购买功能

MarinaTsang的博客 3912

C语言版数字锁相放大器实现指南:从复数运算到嵌入式MCU移植的坑我都帮你踩了

本文详细介绍了C语言实现数字锁相放大器的关键技术,包括复数运算优化、嵌入式MCU移植的实战经验及内存管理策略。针对STM32等资源受限平台,提供了从浮点到定点数转换的优化方案,帮助工程师高效处理微弱信号提取问题。

weixin_30721077的博客 435

dump后,如何用Windbg进行分析呢?

转载自:https://blog.csdn.net/iwilldoitx/article/details/81048500 文章来源:http://rdc.hundsun.com/portal/article/dump2-610.html?from=CSDN 上一篇向大家介绍了如何在程序“死”的时候转储Dump文件以及如何进行一些其他的处理(请戳蓝色字体:《程序又“死”了,但是还好我转储了du...

hnzwx888的专栏 2025

Research Proposal:自动驾驶 行人运动预测

Research Proposal about Pedestrian/Cyclist Motion Prediction for Self-Driving Vehicles   If I can be provided with the opportunity to conduct PhD research in pedestrian/cyclist motion prediction for...

Poetry Wanderer的博客 3089

windbg dump分析

-- 准备工作 -- Windbg是一款功能十分强大的调试工具,它设计了极其丰富的功能来支持各种调试任务,包括用户态调试、内核态调试、调试转储文件、远程调试等等。 ●STEP 1:打开Windbg,在file中选择open crash Dump来打开所需要调试的Dump文件。 ●STEP 2:在file菜单中分别设置好Symbol file path 和 Source file pat...

大余里,大余的干货分享 1373

【对比学习+分割】CRIS:CLIP驱动RIS图像分割(CVPR 2022)

CRIS: CLIP-Driven Referring Image Segmentation

这个博客太懒了什么都没说 3330

【车载以太网】【SOMEIP】Wireshark测试someip

一、 Wireshark SOMEIP plugin 1.1 插件安装 Wireshark插件目录:Help -> About Wireshark -> Folders/Pluginshttps://github.com/jamores/eth-ws-someip 解压后,将所有后缀是lua的文件拷贝到Wireshark安装目录plugins/2.4.10/下。 1.2时间戳调整为UTC显示格式 View -> Time Display Format -> Date and Tim.

专注汽车软件开发、AutoSAR、车载以太网、SOA、EE架构。 9740

如何在程序中生成崩溃转储dump文件以及如何分析dump

关于更详细的内容,如果有兴趣,可以访问下面的视频 https://edu.csdn.net/course/detail/28915 程序崩溃的时候如何生成dump文件 话不多说,直接上代码,下面的程序会崩溃,而且会在崩溃的时候在运行目录生成dump文件。 #include "stdafx.h" #include <Windows.h> #include <Dbghelp.h> #include <stdio.h> LONG WINAPI handle_e.

zhanghaiyang9999的专栏 1641

基于 高斯过程回归(Gaussian Process Regression, GPR) 的 时间序列区间预测 的 MATLAB 示例代码

基于 高斯过程回归(Gaussian Process Regression, GPR) 的 时间序列区间预测 的 MATLAB 示例代码

算法如诗的博客 156

Windows应用程序在崩溃时如何抓取dump分析文件

文档声明: 以下资料均属于本人在学习过程中产出的学习笔记,如果错误或者遗漏之处,请多多指正。并且该文档在后期会随着学习的深入不断补充完善。感谢各位的参考查看。 笔记资料仅供学习交流使用,转载请标明出处,谢谢配合。 作者:Aliven888 1、方法一:配置注册表 ...

Aliven888的博客 4280

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

使用dump和pdb文件定位程序崩溃位置

用法参考链接: 用dump和pdb文件定位程序崩溃的位置_lemon-l的博客-CSDN博客_dump pdb用到的核心API函数MiniDumpWriteDump详解:( minidump详细介绍_huanongying131的博客-CSDN博客_minidumpTips:1.使用参数MiniDumpWithFullMemory能保存变量的值,但生成的dump会大很多.2.发布exe时,切记保存同版本的pdb文件;或一起发布,客户回传时将exe,pdb,dump一起回传.3.将dump,pdb放入生成ex

qq_38416262的博客 1090

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

vc++程序崩溃后不生成dump文件

转自https://blog.csdn.net/lixiangminghate/article/details/50413924     这几天给自己的程序通过SetUnhandleExceptionFilte加dump机制。实测时发现不是所有的崩溃,都能生成dump文件:比如assert(false);语句就没有生成dump文件。上网查了一下发现跟我有相同困惑的人还不少,比如...

NBA_1的博客 1649

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

调试技巧 —— 如何利用windbg + dump + map分析程序异常

之前碰到论坛里有几个好友,说程序不时的崩溃,什么xxoo不能read的! 如果光要是这个内存地址,估计你会疯掉~~ 所以分享一下基本的调试技巧,需要准备的工具有WinDbg + VC6.0, 下面是自己整理的一份自动生成DUMP文件的源代码,只需要添加到工程即可,源代码如下: MiniDump.h [cpp] view plaincopyprint?

王伟挺的专栏 1027
上一篇: DMP文件的生成和使用
下一篇: 通往WinDbg的捷径(一)(二)
UU_Yang
博客等级 码龄23年 926粉丝 213原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址