~ubuntu-branches/debian/sid/gdb/sid

« back to all changes in this revision

Viewing changes to gdb/doc/gdbserver.1

  • Committer: Package Import Robot
  • Author(s): Samuel Bronson, Héctor Orón Martínez, Gabriele Giacone, Samuel Bronson, Hector Oron
  • Date: 2014-08-09 13:11:35 UTC
  • mfrom: (1.4.16)
  • Revision ID: package-import@ubuntu.com-20140809131135-jnyo39dc7u7bf18u
Tags: 7.7.1+dfsg-1
[ Héctor Orón Martínez ]
* d/changelog: replace nickname by real name in previous block

[ Gabriele Giacone ]
* Fix FTBFS on Hurd.
  + Cherry-pick from upstream:
    hurd-new-RPC-reply-stub-functions.patch
    hurd-adapt-to-changed-MIG-output.patch
    hurd-adjust-to-startup-with-shell-changes.patch
    hurd-make-MIG-output-parsing-more-robust.patch
  (Closes: #752574)

[ Samuel Bronson ]
* Ship /usr/lib/libinproctrace.so with gdbserver.
  This enables the "agent" features.
* d/copyright: correct a licensecheck error; add required license texts/blurbs
* d/gdb.install: Include gcore in gdb package (Closes: #752317).
  Thanks to Lorenzo Beretta for the report.
* New patch to fix the build on kFreeBSD.
  Thanks to Steven Chamberlain for a fix (Closes: #752390, #752295).
* d/watch: Update to be more flexible about upstream tarball format.

Last but not least,
* Use correct tarball, with non-free upstream manpages stripped.
  Restores DFSG-compliance.

[ Hector Oron ]
* Rename upstream tarball to not conflict with the one in archive.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16)
2
 
.\"
3
 
.\" Standard preamble:
4
 
.\" ========================================================================
5
 
.de Sp \" Vertical space (when we can't use .PP)
6
 
.if t .sp .5v
7
 
.if n .sp
8
 
..
9
 
.de Vb \" Begin verbatim text
10
 
.ft CW
11
 
.nf
12
 
.ne \\$1
13
 
..
14
 
.de Ve \" End verbatim text
15
 
.ft R
16
 
.fi
17
 
..
18
 
.\" Set up some character translations and predefined strings.  \*(-- will
19
 
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20
 
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21
 
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22
 
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23
 
.\" nothing in troff, for use with C<>.
24
 
.tr \(*W-
25
 
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26
 
.ie n \{\
27
 
.    ds -- \(*W-
28
 
.    ds PI pi
29
 
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30
 
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31
 
.    ds L" ""
32
 
.    ds R" ""
33
 
.    ds C` ""
34
 
.    ds C' ""
35
 
'br\}
36
 
.el\{\
37
 
.    ds -- \|\(em\|
38
 
.    ds PI \(*p
39
 
.    ds L" ``
40
 
.    ds R" ''
41
 
'br\}
42
 
.\"
43
 
.\" Escape single quotes in literal strings from groff's Unicode transform.
44
 
.ie \n(.g .ds Aq \(aq
45
 
.el       .ds Aq '
46
 
.\"
47
 
.\" If the F register is turned on, we'll generate index entries on stderr for
48
 
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
49
 
.\" entries marked with X<> in POD.  Of course, you'll have to process the
50
 
.\" output yourself in some meaningful fashion.
51
 
.ie \nF \{\
52
 
.    de IX
53
 
.    tm Index:\\$1\t\\n%\t"\\$2"
54
 
..
55
 
.    nr % 0
56
 
.    rr F
57
 
.\}
58
 
.el \{\
59
 
.    de IX
60
 
..
61
 
.\}
62
 
.\"
63
 
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64
 
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
65
 
.    \" fudge factors for nroff and troff
66
 
.if n \{\
67
 
.    ds #H 0
68
 
.    ds #V .8m
69
 
.    ds #F .3m
70
 
.    ds #[ \f1
71
 
.    ds #] \fP
72
 
.\}
73
 
.if t \{\
74
 
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75
 
.    ds #V .6m
76
 
.    ds #F 0
77
 
.    ds #[ \&
78
 
.    ds #] \&
79
 
.\}
80
 
.    \" simple accents for nroff and troff
81
 
.if n \{\
82
 
.    ds ' \&
83
 
.    ds ` \&
84
 
.    ds ^ \&
85
 
.    ds , \&
86
 
.    ds ~ ~
87
 
.    ds /
88
 
.\}
89
 
.if t \{\
90
 
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91
 
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92
 
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93
 
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94
 
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95
 
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
96
 
.\}
97
 
.    \" troff and (daisy-wheel) nroff accents
98
 
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99
 
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100
 
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101
 
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102
 
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103
 
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104
 
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105
 
.ds ae a\h'-(\w'a'u*4/10)'e
106
 
.ds Ae A\h'-(\w'A'u*4/10)'E
107
 
.    \" corrections for vroff
108
 
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109
 
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
110
 
.    \" for low resolution devices (crt and lpr)
111
 
.if \n(.H>23 .if \n(.V>19 \
112
 
\{\
113
 
.    ds : e
114
 
.    ds 8 ss
115
 
.    ds o a
116
 
.    ds d- d\h'-1'\(ga
117
 
.    ds D- D\h'-1'\(hy
118
 
.    ds th \o'bp'
119
 
.    ds Th \o'LP'
120
 
.    ds ae ae
121
 
.    ds Ae AE
122
 
.\}
123
 
.rm #[ #] #H #V #F C
124
 
.\" ========================================================================
125
 
.\"
126
 
.IX Title "GDBSERVER 1"
127
 
.TH GDBSERVER 1 "2014-05-05" "gdb-7.7.1" "GNU Development Tools"
128
 
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
129
 
.\" way too many mistakes in technical documents.
130
 
.if n .ad l
131
 
.nh
132
 
.SH "NAME"
133
 
gdbserver \- Remote Server for the GNU Debugger
134
 
.SH "SYNOPSIS"
135
 
.IX Header "SYNOPSIS"
136
 
gdbserver \fIcomm\fR \fIprog\fR [\fIargs\fR...]
137
 
.PP
138
 
gdbserver \-\-attach \fIcomm\fR \fIpid\fR
139
 
.PP
140
 
gdbserver \-\-multi \fIcomm\fR
141
 
.SH "DESCRIPTION"
142
 
.IX Header "DESCRIPTION"
143
 
\&\fBgdbserver\fR is a program that allows you to run \s-1GDB\s0 on a different machine
144
 
than the one which is running the program being debugged.
145
 
.PP
146
 
Usage (server (target) side):
147
 
.PP
148
 
First, you need to have a copy of the program you want to debug put onto
149
 
the target system.  The program can be stripped to save space if needed, as
150
 
\&\fBgdbserver\fR doesn't care about symbols.  All symbol handling is taken care of by
151
 
the \s-1GDB\s0 running on the host system.
152
 
.PP
153
 
To use the server, you log on to the target system, and run the \fBgdbserver\fR
154
 
program.  You must tell it (a) how to communicate with \s-1GDB\s0, (b) the name of
155
 
your program, and (c) its arguments.  The general syntax is:
156
 
.PP
157
 
.Vb 1
158
 
\&        target> gdbserver <comm> <program> [<args> ...]
159
 
.Ve
160
 
.PP
161
 
For example, using a serial port, you might say:
162
 
.PP
163
 
.Vb 1
164
 
\&        target> gdbserver /dev/com1 emacs foo.txt
165
 
.Ve
166
 
.PP
167
 
This tells \fBgdbserver\fR to debug emacs with an argument of foo.txt, and
168
 
to communicate with \s-1GDB\s0 via \fI/dev/com1\fR.  \fBgdbserver\fR now
169
 
waits patiently for the host \s-1GDB\s0 to communicate with it.
170
 
.PP
171
 
To use a \s-1TCP\s0 connection, you could say:
172
 
.PP
173
 
.Vb 1
174
 
\&        target> gdbserver host:2345 emacs foo.txt
175
 
.Ve
176
 
.PP
177
 
This says pretty much the same thing as the last example, except that we are
178
 
going to communicate with the \f(CW\*(C`host\*(C'\fR \s-1GDB\s0 via \s-1TCP\s0.  The \f(CW\*(C`host:2345\*(C'\fR argument means
179
 
that we are expecting to see a \s-1TCP\s0 connection from \f(CW\*(C`host\*(C'\fR to local \s-1TCP\s0 port
180
 
2345.  (Currently, the \f(CW\*(C`host\*(C'\fR part is ignored.)  You can choose any number you
181
 
want for the port number as long as it does not conflict with any existing \s-1TCP\s0
182
 
ports on the target system.  This same port number must be used in the host
183
 
GDBs \f(CW\*(C`target remote\*(C'\fR command, which will be described shortly.  Note that if
184
 
you chose a port number that conflicts with another service, \fBgdbserver\fR will
185
 
print an error message and exit.
186
 
.PP
187
 
\&\fBgdbserver\fR can also attach to running programs.
188
 
This is accomplished via the \fB\-\-attach\fR argument.  The syntax is:
189
 
.PP
190
 
.Vb 1
191
 
\&        target> gdbserver \-\-attach <comm> <pid>
192
 
.Ve
193
 
.PP
194
 
\&\fIpid\fR is the process \s-1ID\s0 of a currently running process.  It isn't
195
 
necessary to point \fBgdbserver\fR at a binary for the running process.
196
 
.PP
197
 
To start \f(CW\*(C`gdbserver\*(C'\fR without supplying an initial command to run
198
 
or process \s-1ID\s0 to attach, use the \fB\-\-multi\fR command line option.
199
 
In such case you should connect using \f(CW\*(C`target extended\-remote\*(C'\fR to start
200
 
the program you want to debug.
201
 
.PP
202
 
.Vb 1
203
 
\&        target> gdbserver \-\-multi <comm>
204
 
.Ve
205
 
.PP
206
 
Usage (host side):
207
 
.PP
208
 
You need an unstripped copy of the target program on your host system, since
209
 
\&\s-1GDB\s0 needs to examine it's symbol tables and such.  Start up \s-1GDB\s0 as you normally
210
 
would, with the target program as the first argument.  (You may need to use the
211
 
\&\fB\-\-baud\fR option if the serial line is running at anything except 9600 baud.)
212
 
That is \f(CW\*(C`gdb TARGET\-PROG\*(C'\fR, or \f(CW\*(C`gdb \-\-baud BAUD TARGET\-PROG\*(C'\fR.  After that, the only
213
 
new command you need to know about is \f(CW\*(C`target remote\*(C'\fR
214
 
(or \f(CW\*(C`target extended\-remote\*(C'\fR).  Its argument is either
215
 
a device name (usually a serial device, like \fI/dev/ttyb\fR), or a \f(CW\*(C`HOST:PORT\*(C'\fR
216
 
descriptor.  For example:
217
 
.PP
218
 
.Vb 1
219
 
\&        (gdb) target remote /dev/ttyb
220
 
.Ve
221
 
.PP
222
 
communicates with the server via serial line \fI/dev/ttyb\fR, and:
223
 
.PP
224
 
.Vb 1
225
 
\&        (gdb) target remote the\-target:2345
226
 
.Ve
227
 
.PP
228
 
communicates via a \s-1TCP\s0 connection to port 2345 on host `the\-target', where
229
 
you previously started up \fBgdbserver\fR with the same port number.  Note that for
230
 
\&\s-1TCP\s0 connections, you must start up \fBgdbserver\fR prior to using the `target remote'
231
 
command, otherwise you may get an error that looks something like
232
 
`Connection refused'.
233
 
.PP
234
 
\&\fBgdbserver\fR can also debug multiple inferiors at once,
235
 
described in
236
 
the \s-1GDB\s0 manual in node \f(CW\*(C`Inferiors and Programs\*(C'\fR
237
 
\&\*(-- shell command \f(CW\*(C`info \-f gdb \-n \*(AqInferiors and Programs\*(Aq\*(C'\fR.
238
 
In such case use the \f(CW\*(C`extended\-remote\*(C'\fR \s-1GDB\s0 command variant:
239
 
.PP
240
 
.Vb 1
241
 
\&        (gdb) target extended\-remote the\-target:2345
242
 
.Ve
243
 
.PP
244
 
The \fBgdbserver\fR option \fB\-\-multi\fR may or may not be used in such
245
 
case.
246
 
.SH "OPTIONS"
247
 
.IX Header "OPTIONS"
248
 
There are three different modes for invoking \fBgdbserver\fR:
249
 
.IP "\(bu" 4
250
 
Debug a specific program specified by its program name:
251
 
.Sp
252
 
.Vb 1
253
 
\&        gdbserver <comm> <prog> [<args>...]
254
 
.Ve
255
 
.Sp
256
 
The \fIcomm\fR parameter specifies how should the server communicate
257
 
with \s-1GDB\s0; it is either a device name (to use a serial line),
258
 
a \s-1TCP\s0 port number (\f(CW\*(C`:1234\*(C'\fR), or \f(CW\*(C`\-\*(C'\fR or \f(CW\*(C`stdio\*(C'\fR to use
259
 
stdin/stdout of \f(CW\*(C`gdbserver\*(C'\fR.  Specify the name of the program to
260
 
debug in \fIprog\fR.  Any remaining arguments will be passed to the
261
 
program verbatim.  When the program exits, \s-1GDB\s0 will close the
262
 
connection, and \f(CW\*(C`gdbserver\*(C'\fR will exit.
263
 
.IP "\(bu" 4
264
 
Debug a specific program by specifying the process \s-1ID\s0 of a running
265
 
program:
266
 
.Sp
267
 
.Vb 1
268
 
\&        gdbserver \-\-attach <comm> <pid>
269
 
.Ve
270
 
.Sp
271
 
The \fIcomm\fR parameter is as described above.  Supply the process \s-1ID\s0
272
 
of a running program in \fIpid\fR; \s-1GDB\s0 will do everything
273
 
else.  Like with the previous mode, when the process \fIpid\fR exits,
274
 
\&\s-1GDB\s0 will close the connection, and \f(CW\*(C`gdbserver\*(C'\fR will exit.
275
 
.IP "\(bu" 4
276
 
Multi-process mode \*(-- debug more than one program/process:
277
 
.Sp
278
 
.Vb 1
279
 
\&        gdbserver \-\-multi <comm>
280
 
.Ve
281
 
.Sp
282
 
In this mode, \s-1GDB\s0 can instruct \fBgdbserver\fR which
283
 
command(s) to run.  Unlike the other 2 modes, \s-1GDB\s0 will not
284
 
close the connection when a process being debugged exits, so you can
285
 
debug several processes in the same session.
286
 
.PP
287
 
In each of the modes you may specify these options:
288
 
.IP "\fB\-\-help\fR" 4
289
 
.IX Item "--help"
290
 
List all options, with brief explanations.
291
 
.IP "\fB\-\-version\fR" 4
292
 
.IX Item "--version"
293
 
This option causes \fBgdbserver\fR to print its version number and exit.
294
 
.IP "\fB\-\-attach\fR" 4
295
 
.IX Item "--attach"
296
 
\&\fBgdbserver\fR will attach to a running program.  The syntax is:
297
 
.Sp
298
 
.Vb 1
299
 
\&        target> gdbserver \-\-attach <comm> <pid>
300
 
.Ve
301
 
.Sp
302
 
\&\fIpid\fR is the process \s-1ID\s0 of a currently running process.  It isn't
303
 
necessary to point \fBgdbserver\fR at a binary for the running process.
304
 
.IP "\fB\-\-multi\fR" 4
305
 
.IX Item "--multi"
306
 
To start \f(CW\*(C`gdbserver\*(C'\fR without supplying an initial command to run
307
 
or process \s-1ID\s0 to attach, use this command line option.
308
 
Then you can connect using \f(CW\*(C`target extended\-remote\*(C'\fR and start
309
 
the program you want to debug.  The syntax is:
310
 
.Sp
311
 
.Vb 1
312
 
\&        target> gdbserver \-\-multi <comm>
313
 
.Ve
314
 
.IP "\fB\-\-debug\fR" 4
315
 
.IX Item "--debug"
316
 
Instruct \f(CW\*(C`gdbserver\*(C'\fR to display extra status information about the debugging
317
 
process.
318
 
This option is intended for \f(CW\*(C`gdbserver\*(C'\fR development and for bug reports to
319
 
the developers.
320
 
.IP "\fB\-\-remote\-debug\fR" 4
321
 
.IX Item "--remote-debug"
322
 
Instruct \f(CW\*(C`gdbserver\*(C'\fR to display remote protocol debug output.
323
 
This option is intended for \f(CW\*(C`gdbserver\*(C'\fR development and for bug reports to
324
 
the developers.
325
 
.IP "\fB\-\-wrapper\fR" 4
326
 
.IX Item "--wrapper"
327
 
Specify a wrapper to launch programs
328
 
for debugging.  The option should be followed by the name of the
329
 
wrapper, then any command-line arguments to pass to the wrapper, then
330
 
\&\f(CW\*(C`\-\-\*(C'\fR indicating the end of the wrapper arguments.
331
 
.IP "\fB\-\-once\fR" 4
332
 
.IX Item "--once"
333
 
By default, \fBgdbserver\fR keeps the listening \s-1TCP\s0 port open, so that
334
 
additional connections are possible.  However, if you start \f(CW\*(C`gdbserver\*(C'\fR
335
 
with the \fB\-\-once\fR option, it will stop listening for any further
336
 
connection attempts after connecting to the first \s-1GDB\s0 session.
337
 
.SH "SEE ALSO"
338
 
.IX Header "SEE ALSO"
339
 
The full documentation for \s-1GDB\s0 is maintained as a Texinfo manual.
340
 
If the \f(CW\*(C`info\*(C'\fR and \f(CW\*(C`gdb\*(C'\fR programs and \s-1GDB\s0's Texinfo
341
 
documentation are properly installed at your site, the command
342
 
.PP
343
 
.Vb 1
344
 
\&        info gdb
345
 
.Ve
346
 
.PP
347
 
should give you access to the complete manual.
348
 
.PP
349
 
\&\fIUsing \s-1GDB:\s0 A Guide to the \s-1GNU\s0 Source-Level Debugger\fR,
350
 
Richard M. Stallman and Roland H. Pesch, July 1991.
351
 
.SH "COPYRIGHT"
352
 
.IX Header "COPYRIGHT"
353
 
Copyright (c) 1988\-2014 Free Software Foundation, Inc.
354
 
.PP
355
 
Permission is granted to copy, distribute and/or modify this document
356
 
under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3 or
357
 
any later version published by the Free Software Foundation; with the
358
 
Invariant Sections being \*(L"Free Software\*(R" and \*(L"Free Software Needs
359
 
Free Documentation\*(R", with the Front-Cover Texts being \*(L"A \s-1GNU\s0 Manual,\*(R"
360
 
and with the Back-Cover Texts as in (a) below.
361
 
.PP
362
 
(a) The \s-1FSF\s0's Back-Cover Text is: \*(L"You are free to copy and modify
363
 
this \s-1GNU\s0 Manual.  Buying copies from \s-1GNU\s0 Press supports the \s-1FSF\s0 in
364
 
developing \s-1GNU\s0 and promoting software freedom.\*(R"