This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
gprof and shared libraries
- From: Thomas Pollinger <tpolling at rhone dot ch>
- To: binutils at sources dot redhat dot com
- Date: Thu, 13 Mar 2003 10:21:00 -0800
- Subject: gprof and shared libraries
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