I am using gcc 4.7 and gcc 4.8 together with QtCreator 2.7.1.
The problem is that when I use gcc 4.8, I am unable to see the values of my variables
The reason probably is that gcc 4.8 is using by default newer format for storing debugging information (http://gcc.gnu.org/gcc-4.8/changes.html). If you are using gdb version less than 7.5 (see gdb --version
) you need to provide -gdwarf-3
argument for compiling with debug info using gcc 4.8.
The same symptom can result from having a debugger that is too new, instead of too old!
In this case it's not about the GDB version, it's about the version of Python which was embedded into it when it was built. Ubuntu 13.10 ships with a GDB that's built with embedded Python3 instead of Python2. Qt Creator (at the time of this writing) is not compatible with that.
You can check to see if you've got a Python2 GDB by running it from a terminal and typing:
(gdb) python print sys.version
If you get an invalid syntax error, you've probably got Python3. That requires parentheses around what to print, so try:
(gdb) python print(sys.version)
When that comes back with a 3.x.x
answer, Qt Creator's Python debugging scripts won't work (yet). So you'll need to get a GDB with Python2.
Here's my blog entry about it: QtCreator Debugger Not Showing Locals in Ubuntu 13.10.
In my case, it was what HostileFork described: ubuntu 13.10 + Qt Creator 2.8
This bug has been fixed in Qt Creator 3, not yet released.
To solve this without recompiling GDB, just use the release candidate of Qt Creator 3.
There are builds available on Qt project website or a PPA (ppa:p12/qtcreator) with last git version but build is broken as of today.