debugging

Started by
6 comments, last by NIm 18 years, 8 months ago
Occasionally, usually when I do a partial compile with make, gdb doesn't have symbol tables, and I get a memory address instaead of a line number. here is my makefile:

yarl: main.o mapgen.o mersenne.o
	g++ -onimrl -lncurses -lefence main.o mapgen.o mersenne.o

main.o: nimrl.cpp nimrl.h
	g++ -c -ggdb -omain.o nimrl.cpp

magpgen.o: mapgen.cpp nimrl.h
	g++ -c -ggdb -omapgen.o mapgen.cpp

mersenne.o: mersenne.cpp
	g++ -c -ggdb -omersenne.o mersenne.cpp

clean:
	rm -rf *.o nimrl



I noticed that if I do a make clean before make, it works correctly. but if I do that, I might as well be using a script! Thanks in advance [Edited by - NIm on July 25, 2005 8:23:50 PM]
Advertisement
What do you use as a linker and what version is it?
	g++ -onimrl -lncurses -lefence main.o mapgen.o mersenne.o



g++, version 3.3.5

[Edited by - NIm on July 26, 2005 9:31:58 PM]
g++ isn't a linker. g++ will call a linker when you ask it to link files like that. To find out what linker g++ is calling try using g++ -Xlinker --version
Did you try "-g3" for maximum debugging information and "-O0" for no optimisations?
ld version 2.15. sorry.

something else I noticed was that as my code is now, it segfaults and there's no line number info, but make clean, make and it doesn't even segfault, but there is line number info.

[Edited by - NIm on July 26, 2005 10:52:31 PM]
Sounds like you've missed a dependency or so in the makefile. That's often the problem when you get different results from partial makes compared to complete makes.
I've done somehting else wrong, cause now no line number info is in at all. the following command compiles debug info in
g++ -lncurses -onimrl nimrl.cpp mapgen.cpp mersenne.cpp


[Edited by - NIm on July 27, 2005 9:49:22 PM]

This topic is closed to new replies.

Advertisement