Subject: FW: Single Stepping on TX3912
To: , <port-mips@NetBSD.ORG>
From: Robert Smith <roberts@transpond.co.uk>
List: port-mips
Date: 06/28/2001 10:25:40
I have now solved this problem.  It seems that there were some
bugs in /src/sys/arch/mips/mips/trap.c which led to incorrect
memory accesses when attempting to read/decode instructions
for the purpose of single stepping.

If anyone is interested I can send them the fix.  Alternatively, if
someone can give me some guidance, I will submit the fix into
the maintained code.

Kind regards - Robert Smith

 -----Original Message-----
From: 	Robert Smith [mailto:roberts@transpond.co.uk]
Sent:	13 June 2001 10:57
To:	'port-hpcmips@NetBSD.ORG'; 'port-mips@NetBSD.ORG'
Cc:	'Chris Bacon'
Subject:	Single Stepping on TX3912

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