user1578653
user1578653

Reputation: 5038

Debugging QT app in WinDbg

I developed a QT application using QT creator. The program sometimes crashes on Windows 7 and XP. The last time this happened, I used task manager to create a dump file. I tried using WinDbg but got loads of errors about it not being able to find 'symbol' files for 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

Does anyone know how to debug an app crash in a QT app using WinDbg or similar tool?

Upvotes: 2

Views: 2398

Answers (1)

sjdowling
sjdowling

Reputation: 3022

You need to have the debug symbols (.pdb files) for Qt in order to debug a crash dump.The libraries shipped in the pre-built SDK do not come with debugging symbols and so you will have to build the libraries yourself in order to get them making sure to set the following compiler flags:

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

Assuming your are using MSVC and QMake. You will of course need to build your own application with the same flags. Then make sure you have the symbol paths set up in your debugger, for WinDbg you will need to use .symfix or .sympath or File > Symbol File Path and point it at all directories containing the .pdb files. If you are using Visual Studio it will also require that the original binaries are available since it uses an entirely different debugger that seems to behave differently. If you want to get more sophisticated about this then look into symstore or maybe breakpad.

See my question and answer here for more information.

Upvotes: 2

Related Questions