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: Backward compatibility for insn probe point


Roland McGrath wrote:
> Ok, that is on the verge of ringing a bell.
> 
> The single-step trap hit resets the single-step bit in the registers
> (arch/powerpc/kernel/traps.c:single_step_exception).  That needs to be
> turned on again before resuming.  The only place that this happens is
> utrace_quiescent->tracehook_enable_single_step.  You should get there via
> check_quiescent after each event report when UTRACE_ACTION_STATE_* is set.
> 
> It makes sense that ptrace does not see the same problem.  It always stops
> after each step trap, so it surely goes into utrace_quiescent to stop;
> there it will properly re-enable stepping when it gets resumed.  In the
> itrace scenario, you don't stop, so it's only the (apparently broken)
> bookkeeping that should ensure you get there.
> 
> In a reporting loop, update_action should be keeping UTRACE_ACTION_SINGLESTEP
> in its return value, so that check_quiescent see it and calls utrace_quiescent.
> You can see if some of that is going wrong.
> 
> (This is all entirely different in modern utrace.)

I poked around the kernel source some more, but couldn't see what was
going wrong.  So, I decided to attack the problem from a different
angle, based on what you said above.

I've changed the itrace code to stop the task after each step trap (so
that it acts more like ptrace).  I've tested this on several kernels
(2.6.18-141.el5/ppc, 2.6.18-128.1.10.el5/x86_64/i686, and
2.6.25-14.fc9.ppc64) and it seems to work correctly.

Does this seem like a reasonable work-around?  Could there be problems
with this approach?

Thanks.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)


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