[ale] 'gdb' and *.so libs

John Mills johnmills at speakeasy.net
Tue Nov 4 23:18:07 EST 2003


ALErs -

This may be a building question, or a 'gdb' question.

I am trying to debug a shared library I built, but find I can't step down 
from my top-level app into the library routines. I built the individual 
function objects with:

$ g++ -g -O0 -W -march=i586 -Wall -Wpointer-arith -fexceptions -c \
-shared <objname>.cpp $(INCLUDES) -o <objname>.o

and pulled them together by:
$ g++ -g -march=i586 -shared -o <libname>.so $(OBJS)

I didn't run anything else on the lib. 'nm' shows the expected entries for 
routines.

When I run 'gdb' on the top-level app, I can step along fine until it uses 
one of my lib routines, then I can't set breaks or step into that code.

Questions:
 1) Did I make the lib in a sensible way? It seems to have linked OK.

 2) Should I be able to debug into it from the app which uses it?

I expect if the answer to (2) is NO, I need to make a statically linked
version of the app. This should not be a big problem, but I do want to
know how to work with the shared version. (Ultimately I will be running
multiple threads, which I expect to be another "learning experience" to
debug. &8-)

TIA for any suggestions.

 - John Mills
   john.m.mills at alum.mit.edu



More information about the Ale mailing list