Qt Creator only stopping on some breakpoints

  • Hi all,
    I'm new to Qt and I created a new Qt Widgets application. The wizard automatically created a MainWindow class for me. I then created another empty class of my own.
    Here is the problem: When I place a breakpoint in the MainWindow class it works fine and Qt stops on it, but, when I place a breakpoint in my own class Qt ignores it!!
    The code in my class is running, I can see the printouts, but breakpoints don't work.
    I did notice in the Breakpoints view in Qt that when I start debugging the breakpoints I placed in the MainWindow class receive an address but the breakpoints in my class don't.
    Does anyone know how to solve this?


  • Lifetime Qt Champion

    Hi and welcome
    That sounds a bit odd.
    Please state Qt version and platform and compiler.

    Also just for test. did u do a full clean all and rebuild and then tried debug?

  • Hi @mrjj !
    I'm running Qt Creator 4.1.0 based on Qt 5.7.0 (Clang 7.0 (Apple)) 64 bit on MacOSX 10.11.6.

    I tried cleaning and rebuilding and it didn't help.
    I also tried deleting the .pro.user file.

  • Lifetime Qt Champion

    Hopefull will our champ have an idea. (he uses macintosh )
    Your debugger seems to work so not sure what to check.

  • Moderators

    Two things to check:

    1. There aren't disabled breakpoints that you think are active.
    2. There aren't invalid breakpoints - such that can't be mapped by the debugger. When the debugger starts regular breakpoints will be just a red disk, while invalid ones will be red disk with a tiny hourglass.

    Also give an example at what kind of lines the debugger doesn't want to stop.

  • I checked and when I start the debugger the breakpoints in my class do have a tiny hourglass while the breakpoints in MainWindow don't have the hourglass.
    I pretty much tried putting a breakpoint everywhere in my class: instantiations, ifs, function calls, nothing works..
    Here is my code:

    #include <QObject>
    #include <QUuid>
    #include <QMap>
    #include "MetaItem.h"
    #include "Template.h"
    class Environment
        static void initInstance();
        static Environment* getInstance();
        static Environment* _instance;
        QMap<QUuid, MetaItem>* _idToItem;
        QMap<Template, MetaItem>* _templateToitem;
        Template _templateTemplate;
        bool _loadedBaseTemplates;
        void loadJson();
    void Environment::initInstance()
        _instance = new Environment();
    Environment* Environment::getInstance()
        return _instance;
        _idToItem = new QMap<QUuid, MetaItem>();
        _templateToitem = new QMap<Template, MetaItem>();
        _loadedBaseTemplates = false;
    void Environment::loadJson()
        QFile file(":/Files/Environment.json");
        if ( ! file.open(QIODevice::ReadOnly))
            qWarning("Error loading Environment.json");
        QByteArray fileData = file.readAll();
        QJsonDocument jsonDocument = QJsonDocument::fromJson(fileData);
        QJsonObject root = jsonDocument.object();

  • Moderators

    @udirub said in Qt Creator only stopping on some breakpoints:

    I checked and when I start the debugger the breakpoints in my class do have a tiny hourglass while the breakpoints in MainWindow don't have the hourglass.

    This means the debugger is unable to resolve the breakpoints in your class, so it won't stop at them. Are both classes in the same project, or is one of them in a library? Perhaps you can make sure you're in debug mode? Make sure your class' header and source are listed in your project file as well.

  • All classes are in the same project and in the same folder. I created my class through Qt Creator as an empty class. I haven't added any libraries.
    I know I'm in debug mode because it does stop on the breakpoints in MainWindow.
    Both header and source are listed in my project under Headers and Sources respectively.

  • Moderators

    Okay, then I have no clue why the debugger won't resolve the breakpoints, sorry.

  • Lifetime Qt Champion


    To add to my fellow, you should also add which version of Qt Creator you are using as well as OS X and Xcode version.

  • Lifetime Qt Champion

    "I'm running Qt Creator 4.1.0 based on Qt 5.7.0 (Clang 7.0 (Apple)) 64 bit on MacOSX 10.11.6."

    Xcode version missing ?

  • OK, I created a new class and copied everything into it and now it works :)
    I have no idea what the problem was...
    Thanks for you help!

  • Lifetime Qt Champion

    @mrjj, Yep, I missed that line but indeed the Xcode version was missing.

  • Hi,

    I have the same issue OSX El Capitan , QT Creator 4.1 , Apple LLVM version 7.3.0 (clang-703.0.29), lldb-350.0.21.3

    I can't seem to create a breakpoint without an hour glass on it. I'm doing this with a plain C++ project , hello world.

    Sometimes the breakpoints work sometimes not. Is there something I'm missing re:compiler flags, environment variables ? The .dsym looks sizeable enough and lldb works fine in terminal.

    Is it worth installing gdb and using that instead ?


Log in to reply