Debugging a Static Library with the Eclipse CDT
I'm working on getting set with Eclipse CDT for some embedded development and I'm having difficulty getting source level debugging working for static libraries.
I'm using 开发者_开发技巧my own Makefiles, so that is my first suspect right now, especially since gdb claims that no symbol table info is available for the functions with no source. When using a static library, is the debugging information from the library usually included in the ELF file from the final link stage? Right now I can see the full source/assembly mix if I point objdump -S at the .a file, but none of the debug info makes it into the .elf. The debugging info/source is present for the main application. Am I missing some switch to tell ld to include this?
Otherwise, what is the best way to get gdb to tell me what is looking for (and failing to find) with regard to debug information for a specific function.
Figured it out.
The lesson is very simple: always, always, triple check your makefiles. Was still linking in an old copy of the static library built without debugging information.
I would guess that GDB is simply not finding the source files that go with that debug information. See http://web.mit.edu/gnu/doc/html/gdb_9.html#SEC51 for documentation on how to tell it where to find source files.
精彩评论