首页 > 编程知识 正文

qt程序异常结束解决方案,微软程序crash

时间:2023-05-04 14:29:44 阅读:62646 作者:3236

组件介绍: Camel_CrashReport:程序异常崩溃时生成Dump文件和日志,非开源是振动的串行系列基础开发组件。

Dump文件是进程的内存镜像。 可以在调试器中将程序的运行状态保存在dump文件中。

支持平台: Windows

sxdbq:崩溃报告开发组件测试程序

调用Camel_CrashReport非常简单,提供三个接口:

int cls _ funcrashreportinitialize (; //int cls _ funcrashreportterminate (初始化//int cls _ fungetexception (p exception _ pointerspexceptptrs,WORD srtParam 要捕获//崩溃,请首先浏览界面文件并定义函数指针。 这是加载dll动态库的过程

//Camel_CrashReport函数指针# include windows.h # include ' ././include/wnd qz/camel _ crash report.h ' hinstand LP cls _ funcrashreportterminatefunterminate; LP cls _ fungetexceptionfungetexception; 然后初始化组件:

//camel _ crashreporthcrashreport=初始化loadlibrary (l ' camel _ crash report.dll ' ); funInitialize=NULL; funGetException=NULL; funTerminate=NULL; if(hcrashreport!=null (fun initialize=(LP cls _ funcrashreportinitialize ) getprocaddress(hcrashreport, ' cls_funcrashreportinitialize ) crashreportinialize fungetexception=(LP cls _ fungetexception ) getprocadress (hcrashrrratexce fun termin ate=(LP cls_funcrashreportterminate ) getprocaddress(hcrashreport,' cls _ funcrashreportterminate ); funInitialize (; 用__try __except包装主函数

__try{#endifinit(argc,argv ); # ifdef win32 } _ except (fungetexception (getexceptioninformation ),clsCrashReport_intParam_Normal ); }程序运行结束时卸载组件

if(hcrashreport!=NULL () { funTerminate ); funInitialize=NULL; funGetException=NULL; funTerminate=NULL; 自由库(hcrashreport; hCrashReport=NULL; }这三步就ok了

然后,当程序运行时,它将运行异常崩溃的代码,并启动写入dump文件和日志的过程

//执行异常代码char* chr=NULL; memset(chr,0,10 ); [导出外链图像失败。 源站可能存在防盗链机制。 建议保存图像并直接上传。 (img-T36ERP1n-1607332496075 ) 3359 github.com/zhengtianzuo/camel _ filemanagercexamppport ) ] raw=true(] ()

可以直接在VS中打开和调试生成的dump文件

在VisualStudio下调试异常崩溃时生成的dump文件,并将其直接放置在代码行中。 当然,也可以使用WinDbg进行调试

生成的txt日志文件包含许多有用的信息

注意:为了将:Qt/QML项目正确定位到故障代码行,项目必须使用VisualStudio进行编译

参照Qt/Qml项目迁移到VS项目

如果需要完整的代码,请访问Camel_FileManagerCExamples

联系方式:作者坦率斑马QQ278969898主页http://www.sddtd.cn邮箱健忘的冰棍@163.com博客http://blog.csdn.net/zhengtianzuo 06 ggn

我觉得分享的内容很好,请作者喝咖啡吧~

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。