[prev in list] [next in list] [prev in thread] [next in thread]
List: glibc-alpha
Subject: sprof failed to load shared object
From: Kunal Parmar <kunal.parmar () celunite ! com>
Date: 2007-04-25 8:47:29
Message-ID: 1177490129.5484.72.camel () kunal
[Download RAW message or body]
Hello,
I am trying to profile a shared library.
Here are the files I am using :
--- the shared library
#include <stdio.h>
int a(void) {
int i=0,g=0;
while(i++<100000)
{
g+=i;
}
return g;
}
int b(void) {
int i=0,g=0;
while(i++<400000)
{
g+=i;
}
return g;
}
--- the application
#include <stdio.h>
#include <stdlib.h>
int a();
int b();
int main(int argc, char** argv)
{
int iterations;
if(argc != 2)
{
printf("Usage %s <No of Iterations>\n", argv[0]);
exit(-1);
}
else
iterations = atoi(argv[1]);
printf("No of iterations = %d\n", iterations);
while(iterations--)
{
a();
b();
}
}
The steps I follow to compile and run are :
gcc -g -pg -fPIC -c foo.c
gcc -g -pg -shared foo.o -o libfoo.so
gcc bar.c -L`pwd` -Wl,-rpath=`pwd` -lfoo -o bar
LD_PROFILE=libfoo.so LD_PROFILE_OUTPUT=`pwd` ./bar 10000
This generates the file libfoo.so.profile as expected. But when I run
sprof, I get the following error :
sprof: failed to load shared object `libfoo.so'
sprof was run as:
LD_LIBRARY_PATH=`pwd` sprof libfoo.so libfoo.so.profile
sprof version is - sprof (GNU libc) 2.4
Please add me to the CC list since I have not subscribed to the mailing
list.
Thanks in advance.
--
Kunal Parmar
Tools Team,
Celunite Inc. (www.celunite.com)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic