RMTDBG(5spp) RISC/os Reference Manual RMTDBG(5spp)
NAME
rmtdbg - description of remote debugging protocol
DESCRIPTION
The remote debugging protocol is spoken by the UMIPS
debuggers pdbx(1), sdbx(1), the standalone debugging monitor
dbgmon(1spp), and the R2000 architecture simulator
sable(1spp), to implement symbolic debugging of standalone
programs. The remote debugging protocol is layered on top
of the serial line protocol and relies upon the serial line
protocol for reliable, sequenced transmission, see
slp(5spp).
The protocol transports "requests" from pdbx or sdbx to
dbgmon or sable and also transports "replies" from dbgmon or
sable back to pdbx or sdbx. All packets are ASCII encoded
and made up of four blank separated fields.
Request packets have the following general format:
PID REQUEST ADDR DATA
0x%x %c 0x%x 0x%x
The use of these fields follows closely the equivalent
fields in the ptrace(2) system call. Use of the fields are:
PID For sdbx/sable this field is the UNIX process
id of the sable simulator; for pdbx/dbgmon
this field is zero. Sable verifies that the
PID in the request matches its PID when pro-
cessing requests.
REQUEST This is a single ASCII character that encodes
the type of request being made.
ADDR An address where the request is to be
applied.
DATA For write requests, the data is to be stored;
ignored for other requests.
Reply packets have this general format:
PID REQUEST ERRFLG RESPONSE
0x%x %c 0x%x 0x%x
All replies have the PID and REQUEST field identical to the
corresponding request packet. In general, ERRFLG is 0 if
the request could be completed successfully and the RESPONSE
field is request dependent (see the request descriptions
Printed 1/6/92 Page 1
RMTDBG(5spp) RISC/os Reference Manual RMTDBG(5spp)
below). If ERRFLG is -1, the request could not be satis-
fied, and the reason for failure is indicated in the
RESPONSE field as a UNIX errno (see intro(2)).
The following REQUEST characters are recognized:
i Read 32 bit word from instruction space at
ADDR. ADDR must be word aligned. Read data
is returned in the RESPONSE field of the
reply packet. On R2000, equivalent to 'd'
request.
d Read 32 bit word from data space at ADDR.
ADDR must be word aligned. Read data is
returned in the RESPONSE field of the reply
packet. On R2000, equivalent to 'i' request.
I Write 32 bit word DATA to instruction space
address ADDR. ADDR must be word aligned.
Reply returns previous contents of ADDR in
RESPONSE field. On R2000, equivalent to 'D'
request.
D Write 32 bit word DATA to data space address
ADDR. ADDR must be word aligned. Reply
returns previous contents of ADDR in RESPONSE
field. On R2000, equivalent to 'I' request.
r Read register indicated by ADDR field.
Registers are identified by register numbers
in the UNIX include file <ptrace.h>. Regis-
ter contents are returned in the RESPONSE
field of the reply packet.
R Write register indicated by ADDR field with
value in DATA field. Registers are identi-
fied by register numbers in the UNIX include
file <ptrace.h>. Previous register contents
is returned in the RESPONSE field of the
reply packet.
c Continue execution of the process being
debugged. If the ADDR field of the request
packet is 1, continue execution at the
current pc of the process being debugged;
otherwise, set the pc of the process being
debugged to the contents of the ADDR field of
the request packet. Execution continues
until the process being debugged takes an
exception. The exception may be a breakpoint
or any other R2000 detected exception. No
reply packet is sent until the exception
Page 2 Printed 1/6/92
RMTDBG(5spp) RISC/os Reference Manual RMTDBG(5spp)
occurs. The reply packet sent after the
exception has the ERRFLG field set to zero
and the RESPONSE field set to the value like
that of a UNIX wait(2) system call, indicat-
ing a UNIX signal appropriate to the excep-
tion and an exit status of WSTOPPED. R2000
exceptions are mapped to the following UNIX
signals:
interrupt SIGINT
TLB mod SIGSEGV
TLB read miss SIGSEGV
TLB write miss SIGSEGV
user TLB miss SIGSEGV
read address error SIGBUS
write address error SIGBUS
instruction bus error SIGBUS
data bus error SIGBUS
syscall trap SIGILL
illegal instruction SIGILL
coprocessor unusable SIGILL
overflow SIGFPE
breakpoint SIGTRAP
s Execute one instruction of the process being
debugged. If the ADDR field of the request
packet is 1, execute the instruction at the
current pc of the process being debugged;
otherwise, set the pc of the process being
debugged to the contents of the ADDR field of
the request packet. A single instruction is
executed by placing a breakpoint instruction
after the single instruction to be executed.
Branches and the instruction in the branch
delay slot are considered "atomic" and in
this case a single step executes two instruc-
tions. No reply packet is sent until either
the breakpoint occurs due to the inserted
breakpoint instruction or the single instruc-
tion to be executed causes an exception
itself. The reply packet sent has the ERRFLG
field set to zero and the RESPONSE field set
to the value like that of a UNIX wait(2) sys-
tem call, indicating a UNIX signal appropri-
ate to the exception and an exit status of
WSTOPPED. The mapping between R2000 excep-
tions and UNIX signals is the same as for the
'c' request.
Printed 1/6/92 Page 3