I've installed glibc-debuginfo, glibc-debuginfo-common, gcc-debuginfo packages under CentOS 5.5 to be able to step into default libs in the debugger. RPM installed libs (static and dynamic) into separate folder /usr/lib.debug/lib and, also, installed source code into /usr/src/debug.
In contrast to release libs the debug libs have ".debug" file extension. Now I need to link to them in DEBUG build configuration. I added -L switch:
COMPILE=g++ -c "-D_GLIBCXX_DEBUG" -g -O0 -fno-inline -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -g -L/usr/lib/debug/usr/lib -o "$(OUTFILE)" $(ALL_OBJ)
After that, GCC started to link to debug libs and I'm able to step into them (for instance, into wprintf).
But, had executed LDD I was surprised:
linux-gate.so.1 => (0x00ec9000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x02839000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x02702000)
libm.so.6 => /lib/libm.so.6 (0x00bb1000)
libc.so.6 => /lib/libc.so.6 (0x00381000)
It shows, that my program is linked to release libs, not to debug ones! But, nevertheless, with -L/usr/lib/debug/usr/lib option I'm able to step into. So, indeed, my program is linked to debug ones.
Q1. Why LDD shows release libs in dependence list?
Q2. During debugging GDB asks me to point where each source code file is. Could I specify the source code directory in environment variable or somethere else?