On Wed, 4 Feb 2009, Roland McGrath wrote:
> > Or you could take my advice of many moons ago now and find
less cockamamy
> > ways to implement this. ;-)
>
> By what? Rewriting gcc?
Only a wee little bit. ;-) Seriously, -pg is eight kinds of wrong, and not
even what you really want anyway. (If your probe points are at actual
entry points instead of inside prologues, then you can get the function
arguments directly, assuming you know which calling convention that
particular function has, which you don't really but you'd probably be happy
pretending you did.)
kprobes are quite expensive on the tracer to trace every function.
You do not really need any kind of magical list of spots generated at
compile time. You can just do insertion anywhere it works. (If you're
willing to fall back to kprobes, it works most anywhere.) You can keep it
real primitive like now and just only work where there is exactly NOP5
sitting there. Then all you're really asking for at build time is to
insert a gratuitous NOP5 at entry points. A compiler tweak for that is a
pretty simple kludge, not even tied in to actual code generation magic.
You could probably even do it with crazy-ass asm/.o fiddling as is your wont.
Hacking gcc is not an option. What? Are we to wait till this hack in gcc
comes out to be able to do this. Not to mention, dynamic ftrace runs on
x86, powerpc, arm, and I think even superH. With more archs probably to
come. Each has their own crap to deal with. The gcc for each arch will
need to handle the jumps needed for modules, which on other archs is no
easy task.
-- Steve