Qt Creator with GCC 4.8.0 -- debugger problems
I downloaded and installed Qt 5.0.1 for MinGW 4.7.2, on Windows 7. But there is a known bug in GCC 4.7.2 that causes an invalid this pointer to be passed to a virtual function under some circumstances that involve virtual and non-virtual inheritance in the same class. The details are on "this Bugzilla page":http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55171.
So I "posted my problem here":http://stackoverflow.com/questions/15597506/gcc-4-7-2-virtual-function-bug/15722969, and decided on the basis of the replies to try compiling Qt 5.0.2 and Qt Creator 2.7.0 from source, using MinGW with the latest GCC 4.8.0.
This may have been a reckless decision, but it succeeded up to a point. I can compile and run my large-ish project, with no known problems. But the debugger is not quite there yet. I can set breakpoints, and gdb will stop at the breakpoints and display the source. I can step through the source code. But there are several problems:
- The call stack is not being displayed.
- Assembly-language mode doesn't work. The source window remains on display, and single-stepping apears to do nothing.
- I can add an expression evaluator for a local variable, but it seems to go out of scope as soon as I single-step.
- The CPU registers are not displayed.
Was this a sensible thing to try? Or is using Qt 5.0.2 with GCC 4.8.0 doomed to failure? After a bit of digging, I discovered two changes to GCC 4.8.0 that might have a bearing on the problem:
- It uses the latest DWARF Version 4 debugging format. So I tried re-compiling my whole project with the -gdwarf-2 parameter, but it didn't help.
- It uses, not sjlj, not dw2, but SEH (see "Structured Exception Handling":http://www.programmingunlimited.net/siteexec/content.cgi?page=mingw-seh) for exception handling. Could this be to blame?
Have you "filed a bug report":https://bugreports.qt-project.org/ about this issue?
Creator has so far not been tested with GCC 4.8.0 at all AFAIK. It is on my todo list once Archlinux updates the compiler:-)
Try adding these flags to your project:
-g together with -gdwarf-2
This may fix your issue. My guess is that gcc 4.8 is outputting
dwarf 4 when you probably have an older gdb which can read
bq. once Archlinux updates the compiler
Problem is that Kubuntu already updated gcc to 4.8 for a long time ago...
Dimantle: So has arch... my post was from 2nd April after all. It works fine for me.
Ubuntu does currently have a bit of trouble with gdb though: Ubuntu updated the python built into gdb to 3.x, which is -- from what I read -- not fully supported by GDB yet and does also break the pretty printers Qt Creator ships. Qt Creator 3.0 should have the pretty printers fixed though.
bq. Qt Creator 3.0 should have the pretty printers fixed though.
Yes, you are right, I installed QtCreator 3.0 beta today, and all debugging stuff start working