debug into a library's source

Wed Feb 18 16:14:00 GMT 2009


I am trying but not able to debug into a library's source from my code in
GDB. I firstly build the library with "gcc -g" to generate debug info. The
library ANN, with its sources under "/usr/local/src/ann_1.1.1/src" and
headers under "/usr/local/src/ann_1.1.1/include", has its .a files generated
under "/usr/local/src/ann_1.1.1/lib". I also build my code with "gcc -g".
Next I invoke GDB with my executable, setting the source directory to
include the library's source path by "dir /usr/local/src/ann_1.1.1/src".
With all these, however, I am not able to step into the source of the
library by "s". I was wondering if someone can point out if I am making some

One possibility is that I don't actually generate the debug info for the
library. The library has a Make-config file, where there is what I think is
the options for gcc
	$(MAKE) targets \
	"ANNLIB = libANN.a" \
	"C++ = g++" \
	"CFLAGS = -O3" \
	"MAKELIB = ar ruv" \
	"RANLIB = true"
I change "CFLAGS = -O3" to "CFLAGS = -g". In its Makefile, there is a line
"cd src ; $(MAKE) $@", I believe to be what makes the compilation. The
library source code and documentation can be downloaded from 

The other possibility is that the source path "/usr/local/src/ann_1.1.1/src"
I specified is not correct when prefixed to the path referenced by the .a
file of the library to its source. How to check the path of the source
referenced by the .a file?

View this message in context:
Sent from the Sourceware - gdb list mailing list archive at

More information about the Gdb mailing list