This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

small 'instrument-functions' patch


Hello,

I ask some question few days ago about modifying the
-finstrument-function behavior (this idea comes from the
fact that I built some years ago a profiler based on this
feature).

I manage to create the modification. As I'm not familiar
with how patches are managed for gcc (in particular
because it is not a bug correction but a modification of
an existing feature) I prefer first to describe the modification
and wait for indications.

Here is what it does:

this modification goal is to allow to generate calls to
__cyg_profile_func_enter with more details that are available
at compilation time.

A new option is added: -finstrument-functions-full
If activated, the "prototype" of __cyg_profile_func_enter is
changed for the following one:

__cyg_profile_func_enter(void *sym, void *call,
	                 char *fnc0, char *fnc1, char *fnc2,
			 char *file, int line, int id);
where:
 sym   is the symbol address of the function  \ same than the
 call  is the symbol address of the call site / original ones
 fnc0  is the 'level 0' name (declaration name)
 fnc1  is the 'level 1' name (scope information)
 fnc2  is the 'level 2' name (all including C++ full style)
 file  is the function's file name
 line  is the line of the function declaration in the file
 id    is the unique identifier generated by gcc for profile

The __cyg_profile_func_exit is not changed.

Of course the behavior of the -finstrument-function option is not modified at all.


Modifications are very smalls. Some small modifications in toplevel.c, opts.c,
c-opts.c and flags.h for the definition of the new option, and a new set of code in
function.c (expand_function_start, inside the original profiling code).



So now ? Does the new code needs to be "approved" to decide if it is usefull and
if it is well writen ?
Does I create a patch and send it on the list ?


Thank in advance.


Regards, -- Yannick Perret



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]