help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gprof output for shared libraries


From: chanaka Nanayakkara
Subject: gprof output for shared libraries
Date: Thu, 28 Dec 2006 20:49:21 -0800 (PST)

I'm working with, solaris-9 and using g++ compiler.

 

I’m trying to get gprof output for a binary file which includes a shared library.

So I wrote a library like this,

It contains one .cpp file called comp.cpp.

So I compiled it like this,

            g++ -c –fPIC –pg comp.cpp

Then I linked it like this,

            ld –G comp.o –o libmitTest.so

Likewise I made a library called libmitTest.so

 

And I wrote a program with two .cpp files.

Let’s say cat.cpp and zoo.cpp

So I compiled those files like this,

            g++ -c –pg cat.cpp

            g++ -c –pg zoo.cpp

Then I linked that program like this,

            g++ -pg –L. –lmitTest zoo.o cat.o –o y.out

After that I changed the environment variables like this,

            export LD_PROFILE=y.out:libmitTest.so

After that using  ./y.out I ran the program to generate gmon.out file.

Then I tried to get gprof output using the command.

            gprof –b y.out gmon.out

But it only shows details about functions in y.out file only. It won’t show details about function in that shared library. Instead those library functions there’s a syntax called <external>. But I want to get details about those shared library functions.

If I delete that shared library functions in my program, previous <external> command will disappear from the gprof output.

 

Could you please tell me what did I do wrong here? I think I did something wrong while linking my shared library using command,

            ld –G comp.o –o libmitTest.so

have I done anything wrong here?

Or please tell me the way to get details about a shared library.


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
reply via email to

[Prev in Thread] Current Thread [Next in Thread]