This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Help with -finstrument-functions
- From: <thulasidhar at soc-soft dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Sat, 12 Nov 2005 12:48:51 +0530
- Subject: Help with -finstrument-functions
Hi,
I am facing a strange problem when I tried to profile the call trace of my application using -finstrument-functions switch in gcc.
We have our application built as a shared library and we use python scripting language to test all the interfaces provided by this shared library.
It is the call trace of this shared library that I want to print.
When I create an executable by linking this shared library to a main.o (as follows), I get the call trace.
$ gcc main.o libtest_app.so -o app
$ app
This main.o contains only a main function that calls one of the interfaces present in libtest_app.so.
But when I import this shared library (libtest_app.so) into python, I do not get the call trace.
I analyzed the scenario in detail and these are my observations.
I have defined the functions __cyg_profile_func_enter and __cyg_profile_func_exit in my application, and I can see them in nm output.
$ nm libtest_app.so | grep __cyg
00177518 T __cyg_profile_func_enter
001775c4 T __cyg_profile_func_exit
Case 1: When I debug my application, built as an exe (app) I see that whenever it enters any function, it jumps to these above defined functions in libtest_app.so
Case 2: But when I debug my application, imported as an module in python, I see that whenever it enters any function it jumps to some symbol of the same name (__cyg_profile_func_enter) in glibc (source filename is displayed as noophooks.c).
The library is the same in both cases. What I don't understand is that if the shared library is built and linked, why should a reference to one function (__cyg_profile_func_enter) result in different jumps in different situations. Ideally all jumps to __cyg_profile_func_enter should have been resolved to refer to the symbol defined in my library, when I build the shared library (as follows),
$ gcc -shared -L/usr/lib/python2.2/config -lpython2.2 -o test/lib/libtest_app.so -lapp.a -lpthread -lrt -lm -ldl -lutil
Why doesn't this happen in the second case? Am I missing something here?
GCC version 3.3.1
Warm regards,
Thulasidhar J.K?
The information contained in this e-mail message and in any annexure is
confidential to the recipient and may contain privileged information. If you are not
the intended recipient, please notify the sender and delete the message along with
any annexure. You should not disclose, copy or otherwise use the information contained
in the message or any annexure. Any views expressed in this e-mail are those of the
individual sender except where the sender specifically states them to be the views of
SoCrates Software India Pvt Ltd., Bangalore.