This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: jprobe question
- From: Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>
- To: "Zhang, Yanmin" <yanmin dot zhang at intel dot com>
- Cc: systemtap at sources dot redhat dot com, "Keshavamurthy, Anil S" <anil dot s dot keshavamurthy at intel dot com>, "Mao, Bibo" <bibo dot mao at intel dot com>
- Date: Tue, 29 Nov 2005 11:05:40 +0530
- Subject: Re: jprobe question
- References: <8126E4F969BA254AB43EA03C59F44E8404056CD6@pdsmsx404>
- Reply-to: ananth at in dot ibm dot com
On Tue, Nov 29, 2005 at 11:54:44AM +0800, Zhang, Yanmin wrote:
> Mostly, jprobe handler has parameters. If the parameters are changed in
> the jprobe handler, should the original function use the changed values?
>
>
> For example, function store_online calls cpu_down. If we register a
> jprobe at cpu_down, see below function.
>
>
> int cpu_down_handler(unsigned int cpu)
> {
> cpu += 1;
> return cpu;
> }
>
> Assume store_online calls cpu_down with parameter cpu=2, when
> cpu_down_handler exits back to original function cpu_down, should
> cpu_down use the new parameter value 3(orig_cpu +1) instead of the 2
> (the original value)?
It shouldn't and it won't
> My answer is no. Because c compiler might change the parameter values
> even though we don't change them in c codes sometimes.
>
> What's your idea?
If you look closely at the jprobes code, care is taken to reset the
stack/pt_regs to the original values after returning from the jprobe
handler. Changes to the parameters in the handlers should not affect
the original parameter values.
Ananth