Patch for debug setcontext

Corey Minyard minyard at acm.org
Wed Jul 28 14:09:13 EST 2004


The attached patch adds the ability to do a setcontext and set up debug
information in the kernel.  It lets you set a context and turn on
single-stepping and branch tracing.

I am using this to enable an in-application debugger.  Basically, you
can insert traps and cause a signal (or cause a signal via other
means).  From the signal handler you can single step or branch trace
using this patch.  The single-stepping is important so that an
instruction may be emulated in a different location so the trap doesn't
have to be replaced.  It is also used to step threads out of critical
areas in some cases.

In the future, even cooler things could be added to this framework like
support for setting up hardware breakpoints.  I have done this in the
past in another job and it can be quite handy.

I have tested this on 440GP and 750.  The patch is relative to stock 2.6.7.

The most problematic part of this patch is probably the 4xx part using
the values in the dbcr0 register to figure out if it needs to be
loaded.  I did it this way because it seems the easiest way to do it
since you can't just use PT_PTRACE to know if the register needs to be
loaded.  I didn't see any problems but I don't know if there are any
races that might cause problems with this method.

Signed-off-by: Corey Minyard <minyard at acm.org>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ppc_debug_setcontext.diff
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20040727/e12626c5/attachment.txt>


More information about the Linuxppc-dev mailing list