On Thu, 12 Feb 2009, Michael Ellerman wrote:
quoted
The function graph tracer not only traces the start of a function
(uses the function tracer part for that) but also uses the kprobes
trick to replace the return address with a hook to trace the exit
of the function.
You use the "kprobes trick", but none of the kprobes code (AFAICS).
Couldn't there be some common code between the two?
I'm not 100% sure how kprobes work, but I believe they use traps. And then
they set the return address to take another trap, to fix it. I could be
totally off here, on how kprobes does this.
But ftrace is about executing the code directly. The return code jumps to
a another function in asm that will set up the call to do the tracing, and
then fix the return pointer back. The only thing that is similar between
the two approaches that I can tell, is that we both modify the return
address of the function. I took a quick peek at the kprobes code and I
see no easy way to share it.
-- Steve