version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
gdbserver |
|
|
2 |
!!!gdbserver |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
OPTIONS |
|
|
7 |
SEE ALSO |
|
|
8 |
COPYING |
|
|
9 |
---- |
|
|
10 |
!!NAME |
|
|
11 |
|
|
|
12 |
|
|
|
13 |
gdbserver - Remote Server for the GNU Debugger |
|
|
14 |
!!SYNOPSIS |
|
|
15 |
|
|
|
16 |
|
|
|
17 |
__gdbserver__ |
|
|
18 |
|
|
|
19 |
|
|
|
20 |
tty prog [[__args...__] |
|
|
21 |
|
|
|
22 |
|
|
|
23 |
__gdbserver__ tty __--attach__ PID |
|
|
24 |
!!DESCRIPTION |
|
|
25 |
|
|
|
26 |
|
|
|
27 |
GDBSERVER is a program that allows you to run GDB on a |
|
|
28 |
different machine than the one which is running the program |
|
|
29 |
being debugged. |
|
|
30 |
|
|
|
31 |
|
|
|
32 |
Usage (server (target) side): |
|
|
33 |
|
|
|
34 |
|
|
|
35 |
First, you need to have a copy of the program you want to |
|
|
36 |
debug put onto the target system. The program can be |
|
|
37 |
stripped to save space if needed, as GDBserver doesn't care |
|
|
38 |
about symbols. All symbol handling is taken care of by the |
|
|
39 |
GDB running on the host system. |
|
|
40 |
|
|
|
41 |
|
|
|
42 |
To use the server, you log on to the target system, and run |
|
|
43 |
the `gdbserver' program. You must tell it (a) how to |
|
|
44 |
communicate with GDB, (b) the name of your program, and (c) |
|
|
45 |
its arguments. The general syntax is: |
|
|
46 |
|
|
|
47 |
|
|
|
48 |
target |
|
|
49 |
|
|
|
50 |
|
|
|
51 |
For example, using a serial port, you might |
|
|
52 |
say: |
|
|
53 |
|
|
|
54 |
|
|
|
55 |
target |
|
|
56 |
|
|
|
57 |
|
|
|
58 |
This tells gdbserver to debug emacs with an argument of |
|
|
59 |
foo.txt, and to communicate with GDB via /dev/com1. |
|
|
60 |
Gdbserver now waits patiently for the host GDB to |
|
|
61 |
communicate with it. |
|
|
62 |
|
|
|
63 |
|
|
|
64 |
To use a TCP connection, you could say: |
|
|
65 |
|
|
|
66 |
|
|
|
67 |
target |
|
|
68 |
|
|
|
69 |
|
|
|
70 |
This says pretty much the same thing as the last example, |
|
|
71 |
except that we are going to communicate with the host GDB |
|
|
72 |
via TCP. The `host:2345' argument means that we are |
|
|
73 |
expecting to see a TCP connection from `host' to local TCP |
|
|
74 |
port 2345. (Currently, the `host' part is ignored.) You can |
|
|
75 |
choose any number you want for the port number as long as it |
|
|
76 |
does not conflict with any existing TCP ports on the target |
|
|
77 |
system. This same port number must be used in the host GDBs |
|
|
78 |
`target remote' command, which will be described shortly. |
|
|
79 |
Note that if you chose a port number that conflicts with |
|
|
80 |
another service, gdbserver will print an error message and |
|
|
81 |
exit. |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
On some targets, gdbserver can also attach to running |
|
|
85 |
programs. This is accomplished via the --attach argument. |
|
|
86 |
The syntax is: |
|
|
87 |
|
|
|
88 |
|
|
|
89 |
target |
|
|
90 |
|
|
|
91 |
|
|
|
92 |
PID is the process ID of a currently running process. It |
|
|
93 |
isn't necessary to point gdbserver at a binary for the |
|
|
94 |
running process. |
|
|
95 |
|
|
|
96 |
|
|
|
97 |
Usage (host side): |
|
|
98 |
|
|
|
99 |
|
|
|
100 |
You need an unstripped copy of the target program on your |
|
|
101 |
host system, since GDB needs to examine it's symbol tables |
|
|
102 |
and such. Start up GDB as you normally would, with the |
|
|
103 |
target program as the first argument. (You may need to use |
|
|
104 |
the --baud option if the serial line is running at anything |
|
|
105 |
except 9600 baud.) Ie: `gdb TARGET-PROG', or `gdb --baud |
|
|
106 |
BAUD TARGET-PROG'. After that, the only new command you need |
|
|
107 |
to know about is `target remote'. It's argument is either a |
|
|
108 |
device name (usually a serial device, like `/dev/ttyb'), or |
|
|
109 |
a HOST:PORT descriptor. For example: |
|
|
110 |
|
|
|
111 |
|
|
|
112 |
(gdb) target remote /dev/ttyb |
|
|
113 |
|
|
|
114 |
|
|
|
115 |
communicates with the server via serial line /dev/ttyb, |
|
|
116 |
and: |
|
|
117 |
|
|
|
118 |
|
|
|
119 |
(gdb) target remote the-target:2345 |
|
|
120 |
|
|
|
121 |
|
|
|
122 |
communicates via a TCP connection to port 2345 on host |
|
|
123 |
`the-target', where you previously started up gdbserver with |
|
|
124 |
the same port number. Note that for TCP connections, you |
|
|
125 |
must start up gdbserver prior to using the `target remote' |
|
|
126 |
command, otherwise you may get an error that looks something |
|
|
127 |
like `Connection refused'. |
|
|
128 |
!!OPTIONS |
|
|
129 |
|
|
|
130 |
|
|
|
131 |
You have to supply the name of the program to debug and the |
|
|
132 |
tty to communicate on; the remote GDB will do everything |
|
|
133 |
else. Any remaining arguments will be passed to the program |
|
|
134 |
verbatim. |
|
|
135 |
!!SEE ALSO |
|
|
136 |
|
|
|
137 |
|
|
|
138 |
`__gdb__' entry in __info__; ''Using GDB: A Guide to |
|
|
139 |
the GNU Source-Level Debugger'', Richard M. Stallman and |
|
|
140 |
Roland H. Pesch, July 1991. |
|
|
141 |
!!COPYING |
|
|
142 |
|
|
|
143 |
|
|
|
144 |
Copyright (c) 1993 Free Software Foundation, |
|
|
145 |
Inc. |
|
|
146 |
|
|
|
147 |
|
|
|
148 |
Permission is granted to make and distribute verbatim copies |
|
|
149 |
of this manual provided the copyright notice and this |
|
|
150 |
permission notice are preserved on all copies. |
|
|
151 |
|
|
|
152 |
|
|
|
153 |
Permission is granted to copy and distribute modified |
|
|
154 |
versions of this manual under the conditions for verbatim |
|
|
155 |
copying, provided that the entire resulting derived work is |
|
|
156 |
distributed under the terms of a permission notice identical |
|
|
157 |
to this one. |
|
|
158 |
|
|
|
159 |
|
|
|
160 |
Permission is granted to copy and distribute translations of |
|
|
161 |
this manual into another language, under the above |
|
|
162 |
conditions for modified versions, except that this |
|
|
163 |
permission notice may be included in translations approved |
|
|
164 |
by the Free Software Foundation instead of in the original |
|
|
165 |
English. |
|
|
166 |
---- |