Re: [PATCH 2.6.12-rc1-mm3] [1/2] kprobes += function-return
From: Prasanna S Panchamukhi
Date: Mon Apr 04 2005 - 03:16:06 EST
Hi Hien,
This patch looks good to me, but I have some comments on this patch.
>This patch adds function-return probes (AKA exit probes) to kprobes.
> When establishing a probepoint at the entry to a function, you can also
>establish a handler to be run when the function returns.
>The subsequent post give example of how function-return probes can be used.
>Two new registration interfaces are added to kprobes:
>int register_kretprobe(struct kprobe *kp, struct rprobe *rp);
>Registers a probepoint at the entry to the function whose address is
>kp->addr. Each time that function returns, rp->handler will be run.
>int register_jretprobe(struct jprobe *jp, struct rprobe *rp);
>Like register_kretprobe, except a jprobe is established for the probed
>function.
Why two interfaces for the same feature?
You can provide a simple interface like
register_exitprobe(struct rprobe *rp) {
....................
}
or
int register_returnprobe(struct rprobe *rp) {
....................
}
whichever you feel is a good name.
independent of kprobe and jprobe.
This routine should take care to register entry handler internally if not
present. This routine can check if there are already entry point kprobe/jprobe
and use some flags internally to say if the entry jprobe/kprobe already exists.
>To unregister, you still use unregister_kprobe or unregister_jprobe. To
>probe only a function's returns, call register_kretprobe() and specify
>NULL handlers for the kprobe.
make unregister exitprobes independent of kprobe/jprobe.
To unregister provide this interface
unregister_exitprobe(struct rpobe *rp) {
....................
}
This routine should check if entry point kprobe/jprobe belows to user/
registered by exit probe. Remove the entry probe if no user has registered
entry point kprobe/jprobe. If user has already registered entry point probes,
just leave the entry point probes and remove only the exit point probes.
Please let me know if you need more information.
Thanks
Prasanna
-
Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Ph: 91-80-25044636
<prasanna@xxxxxxxxxx>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/