Subject: Single Stepping on TX3912
To: , <port-mips@NetBSD.ORG>
From: Robert Smith <roberts@transpond.co.uk>
List: port-hpcmips
Date: 06/13/2001 10:57:22
I seem to have a problem single stepping applications on port of
NetBSD to the TX3912 MIPS CPU.  To achieve the single step
operation I use the ptrace(...) library as follows:

1) I fork from my parent application, use ptrace (PT_TRACE_ME, 0, 0, 0)
    to "register" my child for tracing, and then use execv(...) to launch
    my child application.

2) From my main application I use wait(...) to wait for my child
    to stop (after forking and after attempting to single step).

3) Immediately after forking, wait(...) returns indicating that
    the child has stopped.  I then use ptrace (PT_STEP, child_pid, (caddr_t)
1, 0)
    in an attempt to single step the child.  However, the child
    executes to completion, and the subsequent call to wait(...) from
    the parent returns indicating that the child has completed.

In order to enable the single step functionality, I had to modify the file
src/sys/arch/mips/include/ptrace.h since the definition of the macro PT_STEP
had been commented out.  With this commenting out "undone" I compiled
the kernel so that it had single step support (all the code seems to be
there)
and my test application.  However, as indicated above the single stepping
did
not work.  The reason for PT_STEP being commented out in the file
src/sys/arch/mips/include/ptrace.h does not seem to be documented.  It
implies that there is a problem with single stepping on the MIPS, but
again this does not seem to be documented.

Is this a known problem?

If so, is there a workaround?

Kind regards - Robert Smith