How to create a plugin to instrument function calls
Paul Sery
pgsery@swcp.com
Mon Sep 21 20:08:00 GMT 2009
Hi,
I want to create a plugin that inserts custom code before function calls. The
plugin would mimic the way fprofile-arcs instruments function calls, but not
other structures. For instance, I'd like to modify the following code,
..
void main(...) {
f1();
f2();
}
as follows,
..
void main(...) {
_mystuff('f1');
f1();
_mystuff('f2');
f2();
}
I think/guess the best place for this to occur is in the assembler, like
finstrument-functions?
I've got the basic plugin mechanics working under gcc 4.5 - i.e.,
dumb_plugin.c from testsuite - and would appreciate any suggestions about how
to proceed from here.
Regards,
Paul
More information about the Gcc-help
mailing list