Important: Please read the Qt Code of Conduct -

Debugger doesn't hit breakpoints

  • I've read tons of threads with this title to solve my problem but no one worked.

    My problem is easy: everytime i create a Non-QT project (only with Non-QT) debugger doesn't hit breakpoints.
    I tried to see if my project was in release mode but it wasn't.
    I tried to see if g++ added -g option.
    I tried to erase "" file, clean all and rebuild it.
    I Thought was gdb, so tried to do manual debugging, but manual debugging doesn't have any problem with breakpoints...

    What else should i do in order to check if there is something wrong?

    I'm currently using QT Creator 4.0.2 (QT 5.7.0) with Debian (Linux).

    [Moved to Tools ~kshegunov]

  • @Daniele_B

    Hi and welcome to devnet forum

    Typically this happens when the source is not compiled for debugging or the linker removes debug information.

    First you should check with "top", if the debugger is started when you hit run.
    Also you should find the proper compile and linkage flags in the "Compile output" pane of creator.

    Easiest do all this it is probably easiest to start out with a fresh non-Qt application through the new project template. Just generate a "hello world" program for this test.

  • @koahnig
    Thank you for your answer.

    I made a new non-qt project, but nothing changed. This is the compile output (project name is "Secondaprova"):

    23:20:23: Running steps for project Secondaprova...
    23:20:23: Configuration unchanged, skipping qmake step.
    23:20:23: Starting: "/usr/bin/make" 
    g++ -c -pipe -g -std=gnu++11 -Wall -W -fPIC -DQT_QML_DEBUG -I../Secondaprova -I. -I/opt/Qt5.7.0/5.7/gcc_64/mkspecs/linux-g++ -o main.o ../Secondaprova/main.cpp
    g++  -o Secondaprova main.o    
    23:20:23: The process "/usr/bin/make" exited normally.
    23:20:23: Elapsed time: 00:00.

    I tried also to see if gdb started with "top" shell command, i can confirm gdb starts when i hit debug button.

  • Qt Champions 2017

    Check this one:
    And if it doesn't solve it for you, post the debugger log here so we can see what's going on.

  • This is what Debug Log shows:

    1show version
    2show debug-file-directory
    3set print object on
    4set breakpoint pending on
    5set print elements 10000
    6handle SIGSEGV nopass stop print
    7set unwindonsignal on
    8set width 0
    9set height 0
    10set substitute-path /var/tmp/qt-src /opt/Qt5.7.0/5.7/gcc_64
    11-interpreter-exec console "set auto-solib-add on"
    12python sys.path.insert(1, '/opt/Qt5.7.0/Tools/QtCreator/share/qtcreator/debugger/')
    13python sys.path.append('/usr/bin/data-directory/python')
    14python from gdbbridge import *
    15python theDumper.loadDumpers({"token":15})
    16-interpreter-exec console "set target-async off"
    17-break-insert  -f "\"main.cpp\":7"
    18attach 1618
    22python theDumper.exitGdb({"token":22})
    23show version
    24show debug-file-directory
    25set print object on
    26set breakpoint pending on
    27set print elements 10000
    28handle SIGSEGV nopass stop print
    29set unwindonsignal on
    30set width 0
    31set height 0
    32set substitute-path /var/tmp/qt-src /opt/Qt5.7.0/5.7/gcc_64
    33-interpreter-exec console "set auto-solib-add on"
    34python sys.path.insert(1, '/opt/Qt5.7.0/Tools/QtCreator/share/qtcreator/debugger/')
    35python sys.path.append('/usr/bin/data-directory/python')
    36python from gdbbridge import *
    37python theDumper.loadDumpers({"token":37})
    38-interpreter-exec console "set target-async off"
    39-break-insert  -f "\"main.cpp\":8"
    40attach 1743
    44python theDumper.exitGdb({"token":44})
    45show version
    46show debug-file-directory
    47set print object on
    48set breakpoint pending on
    49set print elements 10000
    50handle SIGSEGV nopass stop print
    51set unwindonsignal on
    52set width 0
    53set height 0
    54set substitute-path /var/tmp/qt-src /opt/Qt5.7.0/5.7/gcc_64
    55-interpreter-exec console "set auto-solib-add on"
    56python sys.path.insert(1, '/opt/Qt5.7.0/Tools/QtCreator/share/qtcreator/debugger/')
    57python sys.path.append('/usr/bin/data-directory/python')
    58python from gdbbridge import *
    59python theDumper.loadDumpers({"token":59})
    60-interpreter-exec console "set target-async off"
    61-break-insert  -f "\"main.cpp\":8"
    62-break-insert  -f "\"main.cpp\":7"
    63attach 1836
    67python theDumper.exitGdb({"token":67})
    68show version
    69show debug-file-directory
    70set print object on
    71set breakpoint pending on
    72set print elements 10000
    73handle SIGSEGV nopass stop print
    74set unwindonsignal on
    75set width 0
    76set height 0
    77set substitute-path /var/tmp/qt-src /opt/Qt5.7.0/5.7/gcc_64
    78-interpreter-exec console "set auto-solib-add on"
    79python sys.path.insert(1, '/opt/Qt5.7.0/Tools/QtCreator/share/qtcreator/debugger/')
    80python sys.path.append('/usr/bin/data-directory/python')
    81python from gdbbridge import *
    82python theDumper.loadDumpers({"token":82})
    83-interpreter-exec console "set target-async off"
    84-break-insert  -f "\"main.cpp\":8"
    85-break-insert  -f "\"main.cpp\":7"
    86attach 2003
    90python theDumper.exitGdb({"token":90})

  • Qt Champions 2017


    50 handle SIGSEGV nopass stop print

    shouldn't be there I believe. What code are you testing with? An empty project? Do you have global variables that could be segfaulting before you enter main?

  • @kshegunov I'm testing a standard "hello world" program, but gdb doesn't hit breakpoints with any code...

  • Qt Champions 2017

    I don't know, nothing else comes to mind. Just for completeness if someone else has other ideas would you post your g++ and gdb version and your test program (I assume 3-4 lines long). Also could you test with a newer creator (e.g. 4.3.x or 4.4.x)?

  • gcc:

    gcc version 6.4.0 20170820 (Debian 6.4.0-4)


    GNU gdb 7.11.1

    Program code:

    #include <iostream>
    using namespace std;
    int main()
        cout << "Hello World!" << endl;
        return 0;

Log in to reply