Reputation: 57
I'm want to debugging my application with gdb. I build project with makefile and here you can see the results of the project build:
Rule of compile
%.o : %.cpp
g++ -o $@ -c $< $(COMPILE_FLAGS) $(build_flags) $(addprefix -I , $(INCLUDE_DIRS))
Where
build_flags := -O0 -g -DEBUG
COMPILE_FLAGS := -Wall -MD -pipe -Wno-deprecated
Compilation and building
mkdir -p src/. src/Object
g++ -o src/./main.o -c ../../src/./main.cpp -Wall -MD -pipe -Wno-deprecated -O0 -g -DEBUG -I ../../include
g++ -o src/Object/Object.o -c ../../src/Object/Object.cpp -Wall -MD -pipe -Wno-deprecated -O0 -g -DEBUG -I ../../include
g++ -o ../../bin/myApp_debuq src/./main.o src/Object/Object.o -s -pipe
make: Leaving directory `{project_name}/obj/debug'
I was removed the unnecessary and redundant information. There you can see a lot of information about building and also you can see flag -g when source file are compiling. After there I want to debug and I see
(gdb) file myApp_debuq
Reading symbols from {project}/bin/myApp_debuq...(no debugging symbols found)...done.
(gdb) list
No symbol table is loaded. Use the "file" command.
How I know, this message telling me that there is no debug information.
Why ?
Upvotes: 1
Views: 1337
Reputation: 476960
Don't strip the debug symbols from the executable! Remove the -s
from the link command.
Upvotes: 3