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?Thanks!
-
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
Hopefull will our champ have an idea. (he uses macintosh )
Your debugger seems to work so not sure what to check. -
Two things to check:
- There aren't disabled breakpoints that you think are active.
- 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 { 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(); }
-
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(); }
@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. -
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.Okay, then I have no clue why the debugger won't resolve the breakpoints, sorry.
-
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.
-
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.
-
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