gprof and shared libraries

Thomas Pollinger tpolling@rhone.ch
Thu Mar 13 18:22:00 GMT 2003


Apologies if that subject has already been discussed - however I could 
not find recent relevant info on that subject.

I have a small application as a shared library that is loaded by the 
Java VM and executed. I'd like to get profiling info of that library 
only. I tried instrumenting the code with gcc -pg and then executing 
gprof java (.. some options...) that will dynamically load my shared 
library and execute it. It looks like the gmon.out does not get generated.

I've seen some related info in older mailing lists that suggested that 
it is not possible to profile shared libraries. Work around was given by 
using sprof, a sampling profile that however cannot produce call stack 
traces that I am primarily interested in.

Is there a way (maybe by writing small custom code that could get called 
from instrumented code on entry and exit of a function in my shared 
library) to profile a shared object file only?

Thanks for any hints,
-Thomas




More information about the Binutils mailing list