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 mistakes?
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 http://www.cs.umd.edu/~mount/ANN/Fil...n_1.1.1.tar.gz.
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?
Thanks in advance!