I have a simple project using OpenCV and cmake, and has two source files only segmentation.h and segmentation.cpp.
Here is the cmakefile:
project(Segment)
cmake_minimum_required(VERSION 2.8)
SET(CMAKE_BUILD_TYPE Debug)
SET(CMAKE_VERBOSE_MAKEFILE true)
if(CMAKE_COMPILER_IS_GNUCXX)
message(STATUS "GCC detected, adding compile flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g -std=c++98 -Wall")
endif(CMAKE_COMPILER_IS_GNUCXX)
find_package(OpenCV REQUIRED)
add_executable(Lulu segmentation.cpp segmentation.h)
target_link_libraries(Lulu ${OpenCV_LIBS})
I created a Debug build with argument sent to cmake: -DCMAKE_BUILD_TYPE=Debug . However QtCreator still skip the break points, and can't start gdb properly:
&"warning: GDB: Failed to set controlling terminal: Inappropriate ioctl for device\n"
How to fix this problem?
An unclaimed breakpoint represents a task to interrupt the debugged program and passes the control to you later. It has two states: pending and implanted . Unclaimed breakpoints are stored as a part of a session and exist independently of whether a program is being debugged or not.
GDB and gdbserver communicate via either a serial line or a TCP connection, using the standard GDB remote serial protocol. On the target machine, you need to have a copy of the program you want to debug. gdbserver does not need your program's symbol table, so you can strip the program if necessary to save space.
Go to Project, Run and in the run settings check the box that say Run in Terminal. It will make QT Creator launch the program inside a XTerm (default) that plays well with gdb and makes the &"warning: GDB: Failed to set controlling terminal: Inappropriate ioctl for device\n" problem go away.
By default, when launching the debugger, it will also bring QT Creator to the foreground and thus hide the terminal that was brought up. To stop this behaviour go to: Tools, Options, Debugger. In the General tab, untick the check box that say Bring Qt Creator to foreground when application interrupts.
If you want to change the terminal, you can do so in Options, Environment. In the System section the Terminal to what you want. For native Ubuntu / Gnome terminal, set it to /usr/bin/gnome-terminal -x. The parameters in this setting must tell the terminal to execute an external command or program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With