Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Error when trying to set a breakpoint



  • Hello,

    I am having problems to set a breakpoint via Qt Creator debug mode on a remote target.

    The debugger log output is:

    dTAKING OWNERSHIP OF BREAKPOINT 21
    >dRUNNING NEEDS-STOP COMMAND -break-insert  -f "\"main.cpp\":15"
    > Stopping temporarily.
    >dState changed from InferiorRunOk(8) to InferiorStopRequested(10)
    > Stop requested...
    >dTRYING TO INTERRUPT INFERIOR
    >>~"\nThread "
    >>~"1 \"app\" received signal SIGINT, Interrupt.\n"
    >>~"0x00007ffff635604f in ?? ()\n"
    >>*stopped,reason="signal-received",signal-name="SIGINT",signal-meaning="Interrupt",frame={addr="0x00007ffff635604f",func="??",args=[],arch="i386:x86-64"},thread-id="1",stopped-threads="all",core="1"
    >dNOTE: INFERIOR STOP OK
    > Stopped.
    >dState changed from InferiorStopRequested(10) to InferiorStopOk(11)
    > HANDLING QUEUED COMMANDS AFTER TEMPORARY STOP
    ><2026-break-insert  -f "\"main.cpp\":15"
    >dNOTE: INFERIOR RUN REQUESTED
    > Run requested...
    >dState changed from InferiorStopOk(11) to InferiorRunRequested(7)
    > Running requested...
    ><2027-exec-continue
    >
    >>&"p 0\n"
    >>~"$2 = 0\n"
    >>^done
    >
    >>&"No source file named main.cpp.\n"
    >>2026^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="\"main.cpp\":15",times="0",original-location="\"main.cpp\":15"}
    >
    >>2027^running
    >dNOTE: INFERIOR RUN OK
    > Running.
    >dState changed from InferiorRunRequested(7) to InferiorRunOk(8)
    >>*running,thread-id="all"
    >dNOTE: INFERIOR STILL RUNNING IN STATE InferiorRunOk.
    >
    

    It's strange because if I run a command by hand in debugger console a message appears and says that GDB is not responding.

    Thanks.



  • Found the cause, these two lines on my project .pro file cause this behavior.

    QMAKE_CFLAGS_DEBUG = -Wno-cpp
    QMAKE_CXXFLAGS_DEBUG = -Wno-cpp
    

    I inserted these lines to suppress this warning on my environment:

    /opt/SBC-A44-pITX/sysroots/corei7-64-poky-linux/usr/include/features.h:397: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    In file included from /opt/SBC-A44-pITX/sysroots/corei7-64-poky-linux/usr/include/c++/9.3.0/x86_64-poky-linux/bits/os_defines.h:39,
                     from /opt/SBC-A44-pITX/sysroots/corei7-64-poky-linux/usr/include/c++/9.3.0/x86_64-poky-linux/bits/c++config.h:524,
                     from /opt/SBC-A44-pITX/sysroots/corei7-64-poky-linux/usr/include/c++/9.3.0/type_traits:38,
                     from /opt/SBC-A44-pITX/sysroots/corei7-64-poky-linux/usr/include/QtCore/qglobal.h:45,
                     from /opt/SBC-A44-pITX/sysroots/corei7-64-poky-linux/usr/include/QtCore/qchar.h:43,
                     from /opt/SBC-A44-pITX/sysroots/corei7-64-poky-linux/usr/include/QtCore/qstring.h:49,
                     from /opt/SBC-A44-pITX/sysroots/corei7-64-poky-linux/usr/include/QtCore/qdatetime.h:44,
                     from /opt/SBC-A44-pITX/sysroots/corei7-64-poky-linux/usr/include/QtCore/QDateTime:1,
                     from /home/gfleck/t-lite/ValidatorBV600/clockutil.cpp:29:
    /opt/SBC-A44-pITX/sysroots/corei7-64-poky-linux/usr/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
      397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
          |    ^~~~~~~
    

    The official gdb documentation says:

    -Wno-cpp
    
        (C, Objective-C, C++, Objective-C++ and Fortran only) Suppress warning messages emitted by #warning directives.
    


  • It was my fault, the right .pro syntax is:

    QMAKE_CFLAGS_DEBUG += -Wno-cpp
    QMAKE_CXXFLAGS_DEBUG += -Wno-cpp
    

    The precedent syntax removes the -g gcc option from Makefile.