[Qt-interest] GDB on Windows?

Garth Dahlstrom ironstorm at gmail.com
Sat Nov 28 19:23:31 CET 2009


On 2009-11-28, at 11:35 AM, Josiah Bryan wrote:
> I'm having a rough time debugging crashes (segfaults and the like) under 
> windows with Qt Creator. With linux, I find it easy to use: Run program 
> in gdb, when crash, type 'bt' to get the stack trace. Simple in my 
> little brain.
> 
> But on Win32 with Qt Creator, the program crashes, and it gives me a 
> list of threads, and the thread it stops in frequently has none of my 
> code in the stack - nor do any of the other threads. In fact, when the 
> crash hits, it's normally all a "light gray" stack - not even indicating 
> where it crashed in any useful form for debugging (at least, that I can 
> understand.)
> 
> I'm old school linux - used to gdb - so please be patient as I likely do 
> have a block of wood up there in that cranial cavity. Regardless, can 
> anyone offer pointers on how to use the debugger in Qt Creator on 
> windows to find where the segfaults hit? Or even better, use gdb from 
> the command line? ("Qt Command Prompt" (or whatever its called) in the 
> start menu that Qt installed doesn't have 'gdb' in its path.)



Stuff to check:
1) You are building with a "Debug" target, and linking against a Qt install that has the symbols in it...  if you are building against a "Release" target you aren't going to get anything. 
2) You have built the "debugging helper" (got a green checkbox) where you set-up your Qt library paths in Preferences. 
3) Some libraries may not have debug symbols (the only one I know of is QtWebKit4d.dll because with full debug symbols the DLL is 982 MB)
4) You have gdbmacros.cpp in your build path so you will be able to inspect Qt structures (Mixxx actually bundles gdb.exe for Windows debug builds, you can check the project file out -> http://bazaar.launchpad.net/~mixxxdevelopers/mixxx/trunk/annotate/head%3A/mixxx/mixxx.pro#L47)
5) If your executable crashes with weird error number, it likely can mean a DLL is missing...  double click on it in the file system window and the error will tell you what file to copy to the executables's directory to get it to run. (may have to do that a few times to get all the DLLs)

If you want to see how we include gdb in Mixxx you can check out the bit of the Mixxx installer script that sets up GDB shortcuts on windows @ http://bazaar.launchpad.net/~mixxxdevelopers/mixxx/trunk/annotate/head%3A/mixxx/build/nsis/Mixxx.nsi#L121
[Mixxx is GPL DJ Software built using Qt]

Not sure what else to suggest atm....

Cheers,

-G



More information about the Qt-interest-old mailing list