[Google Breakpad] crash_generation_app例子研究 -- 进程外和进程内dump的区别

本文介绍如何正确配置Breakpad进行进程内外Dump生成,并提供解决编译错误的方法。Breakpad是Google开发的一个开源库,用于生成崩溃转储文件,以便于后续分析。文中详细解释了配置Visual Studio项目的步骤,包括选择多线程运行库、设置附加库目录、添加依赖项等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

src\client\windows\tests\crash_generation_app下的例子编译失败,看了看,有些地方需要更改一下(以release为例)

1.C++ -> Code Generation -> Runtime Library-> Multi-threaded (/MT)

2. Linker -> Additional Library Directories -> ..\..\$(ConfigurationName)\lib

3. Linker -> Input -> Additional Dependencies -> common.lib exception_handler.lib crash_report_sender.lib crash_generation_client.lib crash_generation_server.lib

4.crash_generation_app.cc 中将dump路径"C:\\Dump"之类的改成"."

从网上找了个两个图简单解释一下breakpad的流程

进程外Dump :由独立的Crash Handle Process处理Dump的生成过程,主进程产生异常时,通过IPC方式通知Crash Handle Process。由Crash Handle Process中的crash_generation_server负责写Dump文件。大致流程如下:

进程外捕获方式
上图中,crash_generation_client和crash_generation_server之间是进程间通讯(IPC)。crash_report_sender负责将dump信息发送到google的crash report server( https://clients2.google.com/cr/report)。

进程内Dump :与进程外方式类似,只不过在Browser进程中增加了一个crash_handle_thread线程,由此线程负责写dump.基本流程如下:
进程内捕获方式

在crash_generation_app中,默认的代码是使用了IPC的进程外dump方式
CrashServerStart();
// This is needed for CRT to not show dialog for invalid param
// failures and instead let the code handle it.
_CrtSetReportMode(_CRT_ASSERT, 0);
handler = new ExceptionHandler(L".",
NULL,
google_breakpad::ShowDumpResults,
NULL,
ExceptionHandler::HANDLER_ALL,
MiniDumpNormal,
kPipeName,
&custom_info );
这种方式生成的exe在只运行一个程序crash时,生成的dmp文件,用vs打开无法定位崩溃点
而运行两个程序,第二个程序crash后生成的dump文件,用vs打开可以正确定位崩溃点
说明进程外dump外方式需要一个独立的进程生成dump文件
而要想使用进程内dump方式,需要改成如下代码
//CrashServerStart();
// This is needed for CRT to not show dialog for invalid param
// failures and instead let the code handle it.
_CrtSetReportMode(_CRT_ASSERT, 0);
handler = new ExceptionHandler(L".",
NULL,
google_breakpad::ShowDumpResults,
NULL,
ExceptionHandler::HANDLER_ALL);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值