
October 13 1995, Draft 1
364
Addendum to –– Evaluating and Programming the 29K RISC Family
sor) generated, like illegal instruction, or externally generated, like interrupt. Then
the traced process enters a stopped state and the tracing process is notified using the
wait() system call. When the traced process is in the stopped state, its core image can
be examined and modified using the ptrace() service. If desired, another ptrace() re-
quest can then cause the traced process either to terminate or to continue. Table 7-3
lists the ptrace() request services available.
Table 7-3.
ptrace() Services
Request
Operation
TraceMe
PeekText
PeekData
PeekUser
PokeText
PokeDate
PokeUser
Cont
Kill
SingleStep
GetRegs
SetRegs
ReadText
ReadData
WriteText
WriteData
SysCall
Declare that the process is being traced
Read one word in the process’s instruction space
Read one word in the proceses’s data space
Examine the processes–control data structure
Write one word in process’s text space
Write one word in process’s data space
Write one word in process–control data structure
Startup process execution
Terminate the process being debugged
Execute the next instruction
Read processor register
Write processor register
Read data from process’s instruction space
Read data from process’s data space
Write data into process’s instruction space
Write data into process’s data space
Continue execution until system call
Because both the process with the user–interface controlling the debugging, and
the application process being debugged, may not be executing on the same processor,
it is not possible to use the ptrace() system call mechanism to debug embedded ap-
plication software. The debugger process (DFE) must run on a separate processor
and communicate with the processor supporting execution of the application code.
The Free Software Foundation’s source level debugger, GDB, makes use of the
ptrace() system call. However, it can alternatively use a collection of procedures
which support communication to a remote processor. These procedures implement
the necessary protocols to control the hardware connecting the remote processor to
the “host” debug processor. By this means, GDB can be used to debug embedded ap-
plication software running on application specific hardware. The following section
discusses the method in more detail.
7.5.4 The GDB–UDI Connection
GDB can, in place of ptrace(), make use of a procedural interface which allows
communication with a remote target processor. Newer versions of GDB (version
3.98 and later) achieve this via procedure pointers which are members of a
target_ops