Qt debugger breakpoint hit problem

  • Hello,
    i have a simple program, 4 files in total, i set a breakpoint in main.cpp, and it works and program stops there. when i set breakpoint in other files, breakpoints don 't work. What i am doing wrong?.
    I use debug configuation, i reinstalled Qt creator 4.9.0 with qt 5.12.2, windows 10, compiler mingw 7.3.0 64 bit. Please give some hints.

  • @emazed

    Did you do already a "Run qmake" and "Rebuild"?
    In most cases that helps.

  • Yes i did, "clean all", run qmake and rebuild project, nothing changes. This project was originally built with an old qt version, now i rebuilt after a fresh qt installation, i also deleted files in the project folder that are automatically generated by Qt Creator, but with no results...

  • ok, i solved creating a new project, and copying there my sources files. I still don 't know what was fucked up in previous project.

  • I assume that it's very likely that you don't hit the breakpoint simply because the code in question is not being executed. Do you have conditional code that depends on defines and other stuff?

  • @Joel-Bodenmann no, i have the breakpoint at first instruction of the file, now i have the same problem again, i noticed that after 2-3 attempts, could not hit breakpoint anymore, and my application windows printed out this message:

    11:42:19: Debugging starts
    11:42:19: Unexpected run control state RunControlState::Running when worker DebuggerRunTool started.

    what is that?

    thank you

  • Given that your environment is pretty standard you're either hitting a nasty bug/side-effect (such as using a different, binary incompatible version of GDB for some reason (eg. because you manually installed other toolchains such as MinGW, Msys2 or Cygwin which modifies your PATH)) or there's something wrong in your code.

    I think from hereon it's difficult for us to help you unless you can post a minimal test case of your code that allows us to reproduce the problem.

  • yes, i have some old stuff manually installed, and manually modified path variable. i have perl, python, mingw, msys2, cmake, and old nokia qt, i try to remove everything and clean everything, also from PATH, and then reintalling qt, then retry. If it still not work, i ll post code.

  • No need to reinstall anything. Just open the Windows editor variable and edit the PATH variable.
    Alternatively, whenever multiple environments are involved, it can make sense to create scripts which "start" each environment providing a proper version of the PATH variable.

  • the script alternative is interesting, i'll surely use in the future, for now i have removed everything also from path, but with no luck. I have this problem since i upgraded qt from 5.11.x to 5.12.2. the 5.11 version was using mingw 5.3 32 bit to compile, if i am not wrong, but version 5.12.2 uses mingw7.3 64 bit. and with this i have problems, i can also post something if it will help.

  • Make sure that you completely close and reopen QtCreator after you modified your system's environment variables.

    I think we can't do more for you here unless you provide the corresponding code (sample) that allows us to reproduce the issue / to confirm that it's nothing code related.

  • i am trying to reduce size of the program to arrive to something small postable here. I can see that removing huge amount of software, debugger starts to break again, i am trying to understand which part of the program is the problematic one.

  • after one day i still cannot get out of this problem, i use a simple test program, i cannot upload files cause i have no privileges, how can i send files? Should i use an external link?

  • ok, i ll try to manually post here:


    #ifndef INCLUDE_H
    #define INCLUDE_H
    #include <QDebug>
    #include <QElapsedTimer>
    #include <QRegularExpression>
    #include <QStringList>
    // definizione costanti
    #define   WARNING    1000
    // per ricerche
    extern const QString CaratteriValidiRx;
    extern const QString rx_fnome;
    // strutture
    struct OPZIONI {
      bool Help:1;
      bool Versione:1;
      bool SpaziFinali:1;
      bool LabelDebug:1;
      bool MlsimbDuplicati:1;
      bool SpazioPublic:1;
      bool ExternNear:1;
      bool ExternDword:1;
      bool ExternDuplicati:1;
      bool ExternDefiniti:1;
      bool NuovaRiga:1;
      bool BreaksRimasti:1;
      bool Caratteri:1;
      bool SpazioCommenti:1;
      bool BarraEsse:1;
      bool SezioneMem:1;
      bool SintassiVariabili:1;
      bool HFinaleMemprog:1;
      bool VarIndMemprog:1;
      bool VarSenzaMemprog:1;
      bool HFinaleZzmem:1;
      bool IndContinuiZzmem:1;
      bool OrdineSimboli:1;
      bool OrdineFunzml:1;
      bool IndirizziCodos1:1;
      bool CorreggiSpazi:1;
      bool SintassiPuntatori:1;
      bool LabelSpazi:1;
      bool LunghezzaRiga:1;
      bool AnaStack:1;
      bool WarnMov:1;
      bool WarnLea:1;
      bool WarnXchg:1;
      bool WarnAdd:1;
      bool WarnJump:1;
      bool WarnCall:1;
      bool VarProcesso:1;
      bool VarProc2:1;
      // debug
      bool LoadDati:1;
      bool LoadTable:1;
      QString FileOut;
      QString FMemprog;
      QString FMemdati;
      QString FZzmem;
      QString Path;
      QString Eccezioni;
      QString FAnaStack;
      // costruttore
      OPZIONI() {
        Help = false;
        Versione = false;
        SpaziFinali = false;
        LabelDebug = false;
        MlsimbDuplicati = false;
        SpazioPublic = false;
        ExternNear = false;
        ExternDword = false;
        ExternDuplicati = false;
        ExternDefiniti = false;
        NuovaRiga = false;
        BreaksRimasti = false;
        Caratteri = false;
        SpazioCommenti = false;
        BarraEsse = false;
        SezioneMem = false;
        SintassiVariabili = false;
        HFinaleMemprog = false;
        VarIndMemprog = false;
        VarSenzaMemprog = false;
        HFinaleZzmem = false;
        IndContinuiZzmem = false;
        OrdineSimboli = false;
        OrdineFunzml = false;
        IndirizziCodos1 = false;
        CorreggiSpazi = false;
        SintassiPuntatori = false;
        LabelSpazi = false;
        LunghezzaRiga = false;
        AnaStack = false;
        WarnMov = false;
        WarnLea = false;
        WarnXchg = false;
        WarnAdd = false;
        WarnJump = false;
        WarnCall = false;
        VarProcesso = false;
        VarProc2 = false;
        // debug
        LoadDati = false;
        LoadTable = false;
        FileOut = "";
        FMemprog = "";
        FMemdati = "";
        FZzmem = "";
        Path = "";
        Eccezioni = "";
        FAnaStack = "";
    // AnaSIS class
    class as2 : public QObject
      // costruttore
      // funzioni
      int goAnaSis(void);
      int ParserComandi(QStringList arg);
    //  int ErrorHandler(int ne, QStringList str = QStringList());
      // variabili
      QElapsedTimer myTimer;  // per calcolare quanto dura il programma
      // variabili generiche
      long i,j,k,h; // indici di uso generico
      QRegularExpression re; // regular expression di uso generico:
        // N.B. e' piu' nuova e piu' efficente di QregExp,
      QRegularExpressionMatch match;
      // liste dati
      QStringList ListaVarP;    // variabili di processo
      QStringList ListaVarnonP; // variabili non di processo
      QStringList ListaMemprog; // lista routines
      OPZIONI Opzioni; // Opzioni specificabili da riga di comando
    #endif // INCLUDE_H


    #include "include.h"
    // programma principale, in qt/c++ tipo console
    // Emanuele Peruzzi
    // inizio: 7 settembre 2018
    // costruttore per inizializzare gli oggetti
    as2::as2() {
      // inizializza regular expression a case insensitive
      // inizializza liste
    int as2::goAnaSis(void) {
    //  match = re.match(string1);
    //  match.captured().isEmpty()) {
      return 0;
    // EOF


    #include "include.h"
    // costanti del programma
    // Caratteri validi all'interno dei files
    const QString CaratteriValidiRx = "[^\t\n\r\\ !\"#\\$%&\'\\(\\)\\*\\+,-\\./:;<=>\\\\?@\[\]\\^_`\\{\\|\\}~a-z\\d]";
    const QString rx_fnome = "^\\w+[\\w\\d]*.[\\d\\w]{0,3}$";
    // EOF


    #include <QCoreApplication>
    #include "include.h"
    int main(int argc, char *argv[])
      QCoreApplication app(argc, argv);
      int err;
      as2 * pApp = new as2(); // nuova istanza classe Anasis
      // start timer
      // parsing riga di comando
      // programma principale, parte nuova
      err = pApp->goAnaSis();
      if (err != 0) {
        qDebug() << "programma terminato per errore --> " + QString::number(err);
      else {
        qDebug() << "programma terminato correttamente";
      return app.exec();


    #include "include.h"
    // File: messaggi.asm, in qt/c++
    // Emanuele Peruzzi
    // inizio: 7 settembre 2018
    // Uso: il files contiene le routines di gestione dei messaggi a video
    //      e il parsing della riga di comando
    // -------------------------------------------------------------------------------
    // funzione : parsing della riga di comando
    // in : comandi inviati sulla riga
    // out : -
    // -------------------------------------------------------------------------------
    int as2::ParserComandi(QStringList arg) {
      QString string;
      // rimuove eventuali duplicati
      // rimuove il primo argomento che e' il nome programma
      // parsing della riga di comando, e definizione delle opzioni disponibili
      // "HELP"
      if (((i = arg.indexOf("-h")) >= 0)
          || ((i = arg.indexOf("-?")) >= 0)
          || ((i = arg.indexOf("--help")) >= 0)) {
        Opzioni.Help = true;
      // "VERSIONE"
      if (((i = arg.indexOf("-v")) >= 0)
          || ((i = arg.indexOf("--versione")) >= 0)) {
        Opzioni.Versione = true;
      if ((i = arg.indexOf(re)) >= 0) {
        // rimuove fino ai ':'
        string = arg.at(i);
        string.remove(0, string.indexOf(':') + 1);
        Opzioni.Path = string;
      return 0;


    QT -= gui
    QT += core
    CONFIG += c++11 console
    CONFIG -= app_bundle
    TEMPLATE = app
    VERSIONE = 2.12
    DEFINES += MYVER='\\"$${VERSIONE}\\"'
    DEFINES += WINVER=0x0501
    # The following define makes your compiler emit warnings if you use
    # any Qt feature that has been marked deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    # You can also make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    CONFIG += build_all debug_and_release
    CONFIG(debug, debug|release) {
     TARGET = anasisd
    else {
     TARGET = anasis
    DESTDIR = ./build/app
    UI_DIR = ./$$DESTDIR/stuff/ui
    MOC_DIR = ./$$DESTDIR/stuff/moc
    RCC_DIR = ./$$DESTDIR/stuff/rcc
    OBJECTS_DIR = ./$$DESTDIR/stuff/obj
    SOURCES += \
            as2.cpp \
            global.cpp \
            main.cpp \
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    HEADERS += \

    with this simple program, that does nothing special, if i set a break in file "messaggi.cpp", at any line, debugger will not break. Please give any hint if you have,

  • update: i found something: i don 't use shadow build for building the project, and also have debug and release built toghether. I have also ui moc rcc obj dirs specified. changing

    CONFIG += build_all debug_and_release


    CONFIG += debug

    and building for debug only, debugger starts to work again and breaks fine.
    For me this i enought for continuing my work, and i consider this problem solved. I still can t understand why building toghether debug and release causes the problem.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.