This is the mail archive of the 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]

Need help for doing gcc modifications


first, I'm a newcomer in this list, so I hope this mail
is not out of topic.

Here is my "problem":
I'm trying to understand gcc source code (for my own
culture) and I decide to create a modified version of
it (I'm working on source tree 3.4.1) to test and understand

I decided to add a new profiling function "ala"
instrument-functions, which will do exactly the same
job but with transmit additionnal informations to the
__cyg_profile_func_{enter|exit} functions.

As I saw that a function is available in gcc/functions.c
to get the name of the currently treated function
(current_function_name which use the lang_hooks),
I decided to add the name to the parameters of the
profile functions.

I successfully added a new gcc option '-finstrument-functions-full'
with all the needed declarations, and I create the call
code to functions __cyg_profile_function_{enter|exit}_details,
with for the moment the same parameters (from, to).

The modified gcc works fine, recognizing the options and
adding the calls to these functions.

Here is my problem: I tried to add additionnal parameters for these functions, by modifying the emit_library_call (in functions.c). Using other uses of this function I managed to add simple parameters such as intergers, but I do not know how to add a 'const char *'... First the name returned by current_function_name is in a the gcc space, not in the compiled program space, so I think I have to create inside the compiled program space a constant string to hold that name. In addition each parameters need a pair of 'rtx'/'machine_mode', and I can't figure how to generate them. I suppose that if I manage to add the string in the program scope, I will obtain a 'rtx', and that I have to find the 'machine_mode' which correspond to the 'const char *' for the convertion.

Please can you help me for that ? Or give me a good pointer
on a doc which explains that points ?
Maybe also what I'm trying to do is not possible, at least by
this way. Do not hesitate to branch me to other methods.

Thank in advance.

Yannick Perret

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