Important: Please read the Qt Code of Conduct - in native gdb fails

  • I'm trying to use the qtcreator extensions in native gdb. According to this page I should be able to just add the appropriate commands to my .gdbinit and I should have the "pp" command available. I do get that command but it always fails. For example, which a break at line 128 in the below it claims that "app" is undefined but it clearly is. I get the same error message for any variable I try to print.

    Does anyone know what's wrong?

    (gdb) list
    123	    QApplication::setAttribute(Qt::AA_X11InitThreads);
    124	#ifdef Q_OS_MAC
    125	    QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
    126	#endif
    127	    QApplication app(argc, argv);
    128	    setGlobalFont(app); // BREAK IS HERE
    130	    QFile styleSheetFile(":/theme/rdsTheme.qs");
    131	    if (
    132	    {
    (gdb) pp app
    Python Exception <class 'NameError'> name 'app' is not defined: 
    Error occurred in Python command: name 'app' is not defined

    For reference, here's my .gdbinit:

    import sys
    sys.path.insert(0, '/home/me/Software/gdb_printers/python')
    sys.path.insert(1, '/usr/share/qtcreator/debugger/')
    from libstdcxx.v6.printers import register_libstdcxx_printers
    register_libstdcxx_printers (None)
    from gdbbridge import *

  • Did you have any luck with this?

Log in to reply