Important: Please read the Qt Code of Conduct -

QtCreator 2.8.1 local & expressions problem with gdb/python version while debugging

  • Hello, last days I did the step from Qt4.8 to 5.1.1 for my embedded software projects. I did install the newest version of QtCreator (2.8.1) and Qt (5.1.1) on a fresh Ubuntu 13.10 (Saucy Salamander) 32bit.
    Compiling my apps wokred fine. But debugging the apps does work. After stopping at breakpoints no locals and expressions were shown.

    I did open the debugger log window a got some error messages like these

    @>&"Undefined command: "bb". Try "help".\n"

    27^error,msg="Undefined command: \\"bb". Try "help"."
    dDUMPER FAILED: 27^error,data={msg="Undefined command: \\"bb". Try "help"."}

    &"NameError: name 'execfile' is not defined\n"
    &"Error while executing Python code.\n"
    22^error,msg="Error while executing Python code."@

    The last one directs me in the right direction execfile is no langer supported by python 3 which is used for parsing the gdb messages in QtCeator.

    So I add the following line to the debug startup commands to print out the python version (by using exec istead execfile) and gotcha it shows me version3.3.2 for python

    @>&"python exec(open('/home/user/').read())\n"


    My simply calls the python version

    @import sys

    sys.stdout.write('%s.%s.%s\n' % sys.version_info[0:3])@

    The strange thing is that on the system Python 2.7 and Python 3.3 are installed and the current python version which is reachable by the PATH and links is 2.7.5. Buzt from QtCreator version 3.3.2 is used
    user@untunu13.10:~$ python --version
    Python 2.7.5+@

    At the end I found out that it depends from the gdb which is linked against

    @user@ubuntu13.10:~$ ldd /usr/bin/gdb => (0xb76ed000) => /lib/i386-linux-gnu/ (0xb7699000) => /lib/i386-linux-gnu/ (0xb7694000) => /lib/i386-linux-gnu/ (0xb766e000) => /lib/i386-linux-gnu/ (0xb764c000) => /lib/i386-linux-gnu/ (0xb7632000) => /lib/i386-linux-gnu/ (0xb75ef000) => /lib/i386-linux-gnu/ (0xb75d4000) => /usr/lib/i386-linux-gnu/ (0xb720e000) => /lib/i386-linux-gnu/ (0xb71e5000) => /lib/i386-linux-gnu/ (0xb71be000) => /lib/i386-linux-gnu/ (0xb700a000)
    /lib/ (0xb76ee000) => /lib/i386-linux-gnu/ (0xb7006000)@

    I did a new a new fresh installation on a Mint 15 32bit system and check the gdb dependencies which show me that the gdb is linked against

    @user@mint15 ~ $ ldd /usr/bin/gdb => (0xb77bd000) => /lib/i386-linux-gnu/ (0xb776c000) => /lib/i386-linux-gnu/ (0xb7767000) => /lib/i386-linux-gnu/ (0xb7744000) => /lib/i386-linux-gnu/ (0xb7725000) => /lib/i386-linux-gnu/ (0xb770c000) => /lib/i386-linux-gnu/ (0xb76c9000) => /lib/i386-linux-gnu/ (0xb76ae000) => /usr/lib/i386-linux-gnu/ (0xb73b1000) => /lib/i386-linux-gnu/ (0xb7389000) => /lib/i386-linux-gnu/ (0xb71d6000)
    /lib/ (0xb77be000) => /lib/i386-linux-gnu/ (0xb71d2000)@

    I gave the newest QtCreator another chance and like guessed it works. So the result ist that QtCreator likes to use python commands which are different between version 2.7 and 3.3 or does not exists in version 3.3.
    By sure you can compile your own gdb with python 2.7 support but there should be a more comfortable to get the debugging up and running for everybody without digging in the dependencies of executed gdb binaries.
    Or at least there should be a message that Python 2.7 binding in gdb is required and QtCreator can't work without them. No nice but you know why the local & expressions are not available :-(.

    Best regards Michael

  • Thank you, it works!

  • @kuschky: Quite a few Python commands are different between version 2 and 3 and GDB was built and used all over the place with Python 2 (only). If it had been expected that Ubuntu 13.10 shipped a Python 3 based GDB the problem would not have occured. Qt Creator 3.0 can now handle GDB builds with either Python 2 or Python 3, but one cannot go back in time and change the 2.8.1 release in August to handle distribution changes that will occur several weeks later.

Log in to reply