【问题标题】:Debugging QT app in WinDbg在 WinDbg 中调试 QT 应用程序
【发布时间】:2014-10-17 13:00:30
【问题描述】:

我使用 QT creator 开发了一个 QT 应用程序。该程序有时会在 Windows 7 和 XP 上崩溃。上次发生这种情况时,我使用任务管理器创建了转储文件。我尝试使用 WinDbg,但遇到很多关于它无法找到 QT 的“符号”文件的错误:

*** ERROR: Symbol file could not be found.  Defaulted to export symbols for QtWebKit4.dll - 
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for QtCore4.dll - 
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for QtGui4.dll - 
*** ERROR: Module load completed but symbols could not be loaded for MyApp1.1b.exe
*** WARNING: symbols timestamp is wrong 0x522be0b3 0x522bdb3e for mswsock.dll
*** WARNING: symbols timestamp is wrong 0x4a5be0b0 0x4ce7ba42 for winmm.dll
*** WARNING: symbols timestamp is wrong 0x4a5be093 0x4a5bdb3c for uxtheme.dll
*** WARNING: symbols timestamp is wrong 0x53b9ff75 0x53b9f968 for AudioSes.dll

有谁知道如何使用 WinDbg 或类似工具在 QT 应用程序中调试应用程序崩溃?

【问题讨论】:

  • 您正在调试发布版本。该应用程序的调试版本将链接到 QtCore4D.dll 等...我希望在这种情况下可以找到符号。

标签: qt debugging windbg crash-dumps


【解决方案1】:

您需要有 Qt 的调试符号(.pdb 文件)才能调试故障转储。预构建 SDK 中提供的库不附带调试符号,因此您必须自己构建库为了让他们确保设置以下编译器标志:

QMAKE_CXXFLAGS_RELEASE += -Zi
QMAKE_LFLAGS_RELEASE += /DEBUG /OPT:REF

假设您使用的是 MSVC 和 QMake。您当然需要使用相同的标志构建自己的应用程序。然后确保在调试器中设置了符号路径,对于 WinDbg,您需要使用 .symfix.sympathFile > Symbol File Path 并将其指向包含 .pdb 文件的所有目录。如果您使用的是 Visual Studio,它还需要原始二进制文件可用,因为它使用一个完全不同的调试器,似乎表现不同。如果您想对此进行更深入的了解,请查看symstore 或breakpad。

查看我的问答here了解更多信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多