'main' enters in gcc-4.1
Perret Yannick
yperret@in2p3.fr
Mon Jul 11 14:16:00 GMT 2005
(second send, as I never saw my first send on the mailing list.
sorry if duplicated).
Hello,
I'm using '-finstrument-functions' for a while
to make function-level profiling.
Recently, I compiled gcc-4.1 (without problem)
and used it for the same purpose.
Here is the result :
>>>
Enter main (essai.c:41) [0x80490b0] from 0x4003be36 - PID=1774 - elaps=0
Enter main (essai.c:41) [0x80490b0] from 0x4003be36 - PID=1774 - elaps=1
Enter main (essai.c:41) [0x80490b0] from 0x4003be36 - PID=1774 - elaps=0
Exit main (essai.c:41) [0x80490b0] from 0x4003be36 - PID=1774 - elaps=6
Exit main (essai.c:41) [0x80490b0] from 0x4003be36 - PID=1774 - elaps=1
Enter main (essai.c:41) [0x80490b0] from 0x4003be36 - PID=1774 - elaps=176
Enter main (essai.c:41) [0x80490b0] from 0x4003be36 - PID=1774 - elaps=0
Exit main (essai.c:41) [0x80490b0] from 0x4003be36 - PID=1774 - elaps=1
Exit main (essai.c:41) [0x80490b0] from 0x4003be36 - PID=1774 - elaps=1
Enter orig (essai.c:23) [0x8048f20] from 0x8049448 - PID=1774 - elaps=1
(...)
Exit main (essai.c:41) [0x80490b0] from 0x4003be36 - PID=1774 - elaps=198
<<<
This test program is a very small C program with 'main' calling two
functions in a loop, compiled with -O2. These messages are
generated by my __cyg_profile_{enter|exit} functions.
as you can see GCC generates 3 consecutive calls to 'main', then 2
exits, 2 enters, and 2 exits.
At last it is coherent, but this behavior does not appear in older
versions of GCC.
Can you explain me why I see that behavior? Is it "good" or is it a bug?
Of cours this is a little disturbing for people that make the assumption
that 'main' is called once :o)
Thanks in advance.
Regards,
--
Yannick Perret
More information about the Gcc
mailing list