This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: jprobe question


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]