"Start debugging of startup project" with a project with "Run in terminal" checked fails with message box "Command aborted" with Title "Executable Failed - Qt..."
The problem appeared after upgrading qtcreator from 4.14.1 to 5.0.1
Going back to 4.14.1 resolves the issue.
New project -> Application (Qt) -> Qt Console Application
Build system qmake, next, next, ...
(the standard kit x64, no cross compiling)
The qtcreator will create a simple app with main.cpp and a pro file.
Place a breakpoint wherever within int main and press "Start debugging of startup project". At this point everything works as expected: the program hits the breakpoint
Now choose: Project -> <Your kit> -> Run and check "Run in terminal" and try to debug again. You will get a popup saying "Command aborted" with Title "Executable Failed - Qt..."
The debugger log yields:
>&"Cannot insert breakpoint 1.\n"
>&"Cannot access memory at address 0x1205\n"
dCOOKIE FOR TOKEN 70 ALREADY EATEN (InferiorRunOk). TWO RESPONSES FOR ONE COMMAND?
dNOTE: INFERIOR SPONTANEOUS STOP
dState changed from InferiorRunOk(7) to InferiorStopOk(10)
Executable failed: Command aborted.
>~"$1 = 0\n"
dCOOKIE FOR TOKEN 0 ALREADY EATEN (InferiorStopOk). TWO RESPONSES FOR ONE COMMAND?
I can reproduce it on both Ubuntu 18.04 and 20.04 and also on kubuntu 18.04.All with distribution default GDB and gcc/g++.
Affected version of QT creator: 5.0.1
Switching back to 4.14.1 solves the problem.
My system GDB (on ubuntu 20.04) is 9.2. I thought that it may be an issue with GDB so I have tried some older one (8.1.1) but the problem persists.
One may find it interesting that by default the binary created by the gcc with default .pro file is:
untitled: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=3e415d6a4d24ef946d2b4418657a50680db34ca5, for GNU/Linux 3.2.0, with debug_info, not stripped
and in the case above (shared object) the problem exists.
If one adds to the .pro file QMAKE_LFLAGS += -no-pie and rebuild we get:
untitled: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=46458e9cf4c5b29d6259edfb2875b9589d54822d, for GNU/Linux 3.2.0, with debug_info, not stripped
And now the debugging works even with 5.0.1 however only if the project does not consist of any shared library subprojects (I meam TEMPLATE = subdirs and some shared library and main program witging the project).