gpt4 book ai didi

c++ - Qt 应用程序和 Google Breakpad

转载 作者:行者123 更新时间:2023-12-02 05:53:41 26 4
gpt4 key购买 nike

我目前正在使用一个应用程序,试图将 BreakPad 集成到 Qt 应用程序中。我发现一个页面帮助我解决了很多初始设置和问题。

https://github.com/JPNaude/dev_notes/wiki/Using-Google-Breakpad-with-Qt

我仍然无法让它处理实际的异常。我创建了一个演示应用程序,它也有同样的问题。以下是我要进行测试的步骤。我现在正在调试中进行测试。

  1. 构建应用程序运行 dump_syms.exe BreakpadTest.pdb > BreakpadTest.sym
  2. 运行应用程序并生成转储文件
  3. 运行 minidump_stackwalk dumpfile.dmp 符号 > out.txt 2>&1
  4. 检查 out.txt 以获取放置 BreakpadTest.sym 的文件路径
  5. 将 BreakpadTest.sym 文件移动到正确的位置
  6. 再次运行 minidump_stackwalk dumpfile.dmpsymbols > out.txt 2>&1

这给我留下了一个 out.txt 文件。

当我在执行此代码的演示应用程序中调用 dumpFunc 时

Breakpad::CrashHandler::instance()->writeMinidump();

我得到以下输出

Thread 0 (crashed)
0 BreakpadTest.exe!Breakpad::CrashHandler::writeMinidump() [crashhandler.cpp : 118 + 0xb]
eip = 0x00c03a44 esp = 0x00affe18 ebp = 0x00affe48 ebx = 0x009fe000
esi = 0x00c01960 edi = 0x00c01960 eax = 0x00affaf0 ecx = 0x00affaf0
edx = 0x00affdbc efl = 0x00000216
Found by: given as instruction pointer in context
1 BreakpadTest.exe!dumpFunc() [main.cpp : 13 + 0xb]
eip = 0x00c0364f esp = 0x00affe50 ebp = 0x00affe50
Found by: call frame info
2 BreakpadTest.exe!main [main.cpp : 25 + 0x4]
eip = 0x00c03746 esp = 0x00affe58 ebp = 0x00affea0
Found by: call frame info
3 BreakpadTest.exe!WinMain [qtmain_win.cpp : 113 + 0xc]
eip = 0x00c14d3d esp = 0x00affea8 ebp = 0x00affed4
Found by: call frame info
4 BreakpadTest.exe!invoke_main [exe_common.inl : 94 + 0x1a]
eip = 0x00c13b7e esp = 0x00affedc ebp = 0x00affeec
Found by: call frame info
5 BreakpadTest.exe!__scrt_common_main_seh [exe_common.inl : 253 + 0x4]
eip = 0x00c13a00 esp = 0x00affef4 ebp = 0x00afff44
Found by: call frame info
6 BreakpadTest.exe!__scrt_common_main [exe_common.inl : 295 + 0x4]
eip = 0x00c1389d esp = 0x00afff4c ebp = 0x00afff4c
Found by: call frame info
7 BreakpadTest.exe!WinMainCRTStartup [exe_winmain.cpp : 16 + 0x4]
eip = 0x00c13b98 esp = 0x00afff54 ebp = 0x00afff54
Found by: call frame info
8 kernel32.dll + 0x162c3
eip = 0x76c962c4 esp = 0x00afff5c ebp = 0x00afff68
Found by: call frame info
9 ntdll.dll + 0x60fd8
eip = 0x77850fd9 esp = 0x00afff70 ebp = 0x00afffb0
Found by: previous frame's frame pointer
10 ntdll.dll + 0x60fa3
eip = 0x77850fa4 esp = 0x00afffb8 ebp = 0x00afffc0
Found by: previous frame's frame pointer

这很好,也是我想要的。但是当我实际上用 badFunc() 引发异常时。

int *myNull = NULL;
*myNull = 42;

我得到以下输出

Thread 0 (crashed)
0 ntdll.dll + 0x6e5fc
eip = 0x7785e5fc esp = 0x00eff09c ebp = 0x00eff10c ebx = 0x00000001
esi = 0x00000000 edi = 0x00000368 eax = 0x00000000 ecx = 0x6d278097
edx = 0x00000000 efl = 0x00000206
Found by: given as instruction pointer in context
1 KERNELBASE.dll + 0xcad51
eip = 0x74d7ad52 esp = 0x00eff114 ebp = 0x00eff120
Found by: previous frame's frame pointer
2 BreakpadTest.exe!google_breakpad::ExceptionHandler::WriteMinidumpOnHandlerThread(_EXCEPTION_POINTERS *,MDRawAssertionInfo *) [exception_handler.cc : 720 + 0x11]
eip = 0x009f72d0 esp = 0x00eff128 ebp = 0x00eff138
Found by: previous frame's frame pointer
3 BreakpadTest.exe!google_breakpad::ExceptionHandler::HandleException(_EXCEPTION_POINTERS *) [exception_handler.cc : 504 + 0xd]
eip = 0x009f6d71 esp = 0x00eff140 ebp = 0x00eff178
Found by: call frame info
4 KERNELBASE.dll + 0x15d411
eip = 0x74e0d412 esp = 0x00eff180 ebp = 0x00eff20c
Found by: call frame info
5 ntdll.dll + 0x9e0bc
eip = 0x7788e0bd esp = 0x00eff214 ebp = 0x00effa10
Found by: previous frame's frame pointer
6 ntdll.dll + 0x60fa3
eip = 0x77850fa4 esp = 0x00effa18 ebp = 0x00effa20
Found by: previous frame's frame pointer

这不是发生异常的实际堆栈跟踪。关于出了什么问题或者如何更改它以获得实际堆栈有什么想法吗?

演示应用程序 http://s000.tinyupload.com/?file_id=26352983283926785193

最佳答案

我最近也陷入了同一个兔子洞。我从很多地方获取资源,将我找到的所有内容放在一起in this repo .

可能影响堆栈输出的因素之一是您用于编译应用程序的优化级别。如果强制创建调试符号也没关系。如果您应用任何优化,堆栈有时会显示不正确,因此您可以尝试在发布版本的 Qt 项目(*.pro 文件)中禁用优化,如下所示:

CONFIG *= force_debug_info
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -O2

关于c++ - Qt 应用程序和 Google Breakpad,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41290428/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com