Changes in 'finstrument-functions' option

2005-06-02 Thread Perret Yannick

Hi all,

some times ago I wrote about a modification
of the '-finstrument-functions' option of 'gcc'.
My goal was (and is still) to obtain additionnal
informations about functions (as symbols
addresses is sometime not enough).

So I made a patch to allow to send more data
to the __cyg_profile_func_enter/exit :
- function name (level 0, 1 and 2)
- file name
- line number
- function Id

I'm currently building the patch for the 4.1 last
snapshot...


My questions are:
- is it better to create a new option (i.e.
instrument-functions-full) or to modify the
behavior of 'instrument-functions' ?
- maybe the user should be able to indicate
at compilation time what are the informations
he wants to get (i.e. -fintrument-functions
-finstrument-format "").
Any idea/suggestion ?

Thank in advance.

Regards,
--
Yannick Perret



'main' enters in gcc-4.1

2005-07-07 Thread Perret Yannick

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 the 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



'main' enters in gcc-4.1

2005-07-11 Thread Perret Yannick

(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




Re: coding style: type* variable or type *varible

2005-09-14 Thread Perret Yannick



Dave Korn wrote:


Original Message
 


From: Mike Stump
Sent: 13 September 2005 20:28
   



 


On Sep 13, 2005, at 12:23 PM, Rafael EspĂ­ndola wrote:
   


I have seen both in gcc. I have found that "type* variable" is
preferred in C++ code but I haven't found any guidelines for C code.
 


If you ask gcc, you find:

mrs $ grep 'int\* ' *.c | wc -l
   4
mrs $ grep 'int \*' *.c | wc -l
 369

pretty clear to me.
   



 


My two cents...

Well, for my version of gcc (gcc-4.1-20050528), I only get 3 'int*', and all
the three are in comments, not in C code.

I also get 10 'int * '.

By my side, the only place I put int* is for casts.

Regards,
--
Yannick