I'm using cmake to build the debug version via cmake -DCMAKE_BUILD_TYPE=Debug ..
I got CMakeCache.txt, CMakeFiles, Makefile, cmake_install.cmake files/folders and the compiled binary, say test, in the build folder.
when I start the gdb by gdb ./test
I got the following out put
GNU gdb (GDB) 8.0.1 Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-apple-darwin17.0.0". Type "show configuration" for configuration details.
For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
BFD: /Users/sln/Project/repos/C++/Primer/debug/test: unknown load command 0x32
BFD: /Users/sln/Project/repos/C++/Primer/debug/test: unknown load command 0x32
"/Users/sln/Project/repos/C++/Primer/debug/./test": not in executable format: File format not recognized
And I add the break point to main function by (gdb) break main
and the following message was print out
No symbol table is loaded. Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n])
By input y
to the upper question I got
Breakpoint 1 (main) pending.
Then (gdb) run
command gives the error
Starting program:
No executable file specified.
Use the "file" or "exec-file" command.
And finally (gdb) file
leads to
No executable file now.
No symbol file now.
Question: I wonder which part was wrong?
Here is my CmakeList.txt file
cmake_minimum_required(VERSION 2.8)
project(Test)
set(CMAKE_CXX_STANDARD 11)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
add_executable( test
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test_nav.h
)