Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Creator only stopping on some breakpoints
Forum Update on Monday, May 27th 2025

Qt Creator only stopping on some breakpoints

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 5 Posters 3.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    udirub
    wrote on last edited by udirub
    #1

    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?

    Thanks!

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0
      • U Offline
        U Offline
        udirub
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #5

            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.

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            0
            • U Offline
              U Offline
              udirub
              wrote on last edited by
              #6

              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
              {
              public:
                  static void initInstance();
                  static Environment* getInstance();
              
                  Environment();
              
              private:
                  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;
              }
              
              Environment::Environment()
              {
                  _idToItem = new QMap<QUuid, MetaItem>();
                  _templateToitem = new QMap<Template, MetaItem>();
              
                  _loadedBaseTemplates = false;
              
                  loadJson();
              }
              
              void Environment::loadJson()
              {
                  qWarning(QDir::currentPath().toLatin1());
                  QFile file(":/Files/Environment.json");
              
                  if ( ! file.open(QIODevice::ReadOnly))
                  {
                      qWarning("Error loading Environment.json");
                      return;
                  }
              
                  QByteArray fileData = file.readAll();
              
                  QJsonDocument jsonDocument = QJsonDocument::fromJson(fileData);
              
                  QJsonObject root = jsonDocument.object();
              }
              
              kshegunovK 1 Reply Last reply
              0
              • U udirub

                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
                {
                public:
                    static void initInstance();
                    static Environment* getInstance();
                
                    Environment();
                
                private:
                    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;
                }
                
                Environment::Environment()
                {
                    _idToItem = new QMap<QUuid, MetaItem>();
                    _templateToitem = new QMap<Template, MetaItem>();
                
                    _loadedBaseTemplates = false;
                
                    loadJson();
                }
                
                void Environment::loadJson()
                {
                    qWarning(QDir::currentPath().toLatin1());
                    QFile file(":/Files/Environment.json");
                
                    if ( ! file.open(QIODevice::ReadOnly))
                    {
                        qWarning("Error loading Environment.json");
                        return;
                    }
                
                    QByteArray fileData = file.readAll();
                
                    QJsonDocument jsonDocument = QJsonDocument::fromJson(fileData);
                
                    QJsonObject root = jsonDocument.object();
                }
                
                kshegunovK Offline
                kshegunovK Offline
                kshegunov
                Moderators
                wrote on last edited by kshegunov
                #7

                @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.

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                0
                • U Offline
                  U Offline
                  udirub
                  wrote on last edited by
                  #8

                  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.

                  kshegunovK 1 Reply Last reply
                  0
                  • U udirub

                    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.

                    kshegunovK Offline
                    kshegunovK Offline
                    kshegunov
                    Moderators
                    wrote on last edited by
                    #9

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

                    Read and abide by the Qt Code of Conduct

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Hi,

                      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.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      mrjjM 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        Hi,

                        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.

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @SGaist
                        "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 ?

                        1 Reply Last reply
                        0
                        • U Offline
                          U Offline
                          udirub
                          wrote on last edited by
                          #12

                          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!

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

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

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            1
                            • K Offline
                              K Offline
                              kimonsatan
                              wrote on last edited by
                              #14

                              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 ?

                              cheers

                              1 Reply Last reply
                              0

                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved