OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rtems-20020807/] [doc/] [rgdb_specs/] [interfacing.t] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
@c
2
@c  RTEMS Remote Debugger Server Specifications
3
@c
4
@c  Written by: Eric Valette 
5
@c              Emmanuel Raguet 
6
@c
7
@c
8
@c  interfacing.t,v 1.3 2002/01/17 21:47:46 joel Exp
9
@c
10
 
11
@chapter Interfacing GDB with RTEMS as a Target
12
 
13
@c XXX figure reference
14
So, basically, porting GDB to RTEMS environment requires implementing
15
the functions contained in the target_ops structure. The native debugger implementation
16
(where the host machine is also the target one) uses direct function calls.
17
For our needs (remote debugging), these functions must be implemented to support
18
the encapsulation in UDP/IP layers and communications between different types
19
of host machines : the best solution is use the SUN Remote Procedure Calls API
20
(SUN RPC). This SUN RPC module will be explained below (see paragraph @b{Communication with GDB}).
21
 
22
We can note that the functions described in the target_ops structure
23
are high-level functions. The main reason is that GDB was designed in order
24
to be able to use monitor firmware as a debug server. In the case of a Unix
25
OS target, these high-level functions are implemented themselves using a lower
26
level POSIX API. Because we want to simplify the code running on the target
27
and decrease its size of this code, we propose to use the POSIX layer API used
28
for the debug like @b{waitpid}, @b{ptrace}, ... Due to the GDB working
29
mode and due to our requirements, we can establish here a non-exhaustive list
30
of some commands required to implement the previously described functions :
31
 
32
@itemize @bullet
33
@item set up a connection with a target,
34
@item close a connection,
35
@item send a signal to the specified process,
36
@item get a list of process/thread/connection running,
37
@item control process under debug,
38
@item ...
39
@end itemize
40
Control means that, with this function, we can read, write the memory
41
of the debuggee, insert breakpoint to stop the process and resume the process
42
execution. This command can be implemented by emulating in the RTEMS environment
43
a Unix function called ``ptrace''. This function allows the control of a child
44
process. The ``ptrace'' function has some sub-functions which are described
45
below (some of these actions and standardized, the others are added due to our
46
needs) :
47
 
48
@itemize @bullet
49
@item PTRACE_PEEKTEXT, PTRACE_PEEKDATA : read word at address,
50
@item PTRACE_POKETEXT, PTRACE_POKEDATA :write word at address,
51
@item PTRACE_CONT : restart after signal,
52
@item PTRACE_KILL : send the child a SIGKILL to make it exit,
53
@item PTRACE_SINGLESTEP : set the trap flag for single stepping,
54
@item PTRACE_ATTACH : attach to the process specified,
55
@item PTRACE_DETACH : detach a process that was previously attached.
56
@end itemize
57
This list only contains the command that are described in the ptrace
58
Unix manpage. For some specific needs (debug of one task among several ones,
59
register read/write,...), it is possible to create some special ptrace commands
60
as described after :
61
 
62
@itemize @bullet
63
@item get current task registers,
64
@item set current task registers,
65
@item list of the threads,
66
@item identifier of the target thread,
67
@item restart to address,
68
@item set breakpoint at address,
69
@item clear breakpoint,
70
@item get breakpoints,
71
@item load dynamically a task,
72
@item ...
73
@end itemize
74
This list is not exhaustive and can be increased due to the needs.
75
All the described functions will not be implemented in a first version, only
76
the strictly needed. If some commands are added, the modifications must be implemented
77
both in RTEMS and in GDB.
78
 
79
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.