4

我目前正在使用一个试图将 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.dmp symbols > 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

4

1 回答 1

1

我最近也在同一个兔子洞里。从许多地方获取资源,我将我在这个 repo 中找到的所有内容放在一起。

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

CONFIG *= force_debug_info
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -O2
于 2019-11-26T11:21:34.213 回答