2012-04-19 Pedro Alves <palves@redhat.com>
[deliverable/binutils-gdb.git] / gdb / gdbserver / gdbserver.1
CommitLineData
0b302171 1.\" Copyright (C) 1993, 2011-2012 Free Software Foundation, Inc.
c906108c
SS
2.\" See section COPYING for conditions for redistribution
3.TH gdbserver 1 "2 November 1993" "Cygnus Support" "GNU Development Tools"
4.SH NAME
5gdbserver \- Remote Server for the GNU Debugger
6.SH SYNOPSIS
7.na
8.TP
9.B gdbserver
10.RB tty
11.RB prog
12.RB "[\|" args... "\|]"
8656e7d8
DJ
13.PP
14.B gdbserver
15.RB tty
16.B --attach
17.RB PID
c906108c
SS
18.ad b
19.SH DESCRIPTION
20GDBSERVER is a program that allows you to run GDB on a different machine
21than the one which is running the program being debugged.
22
23Usage (server (target) side):
24
25First, you need to have a copy of the program you want to debug put onto
26the target system. The program can be stripped to save space if needed, as
27GDBserver doesn't care about symbols. All symbol handling is taken care of by
28the GDB running on the host system.
29
30To use the server, you log on to the target system, and run the `gdbserver'
31program. You must tell it (a) how to communicate with GDB, (b) the name of
32your program, and (c) its arguments. The general syntax is:
33
34 target> gdbserver COMM PROGRAM [ARGS ...]
35
36For example, using a serial port, you might say:
37
38 target> gdbserver /dev/com1 emacs foo.txt
39
40This tells gdbserver to debug emacs with an argument of foo.txt, and to
41communicate with GDB via /dev/com1. Gdbserver now waits patiently for the
42host GDB to communicate with it.
43
44To use a TCP connection, you could say:
45
46 target> gdbserver host:2345 emacs foo.txt
47
48This says pretty much the same thing as the last example, except that we are
49going to communicate with the host GDB via TCP. The `host:2345' argument means
50that we are expecting to see a TCP connection from `host' to local TCP port
512345. (Currently, the `host' part is ignored.) You can choose any number you
52want for the port number as long as it does not conflict with any existing TCP
53ports on the target system. This same port number must be used in the host
54GDBs `target remote' command, which will be described shortly. Note that if
55you chose a port number that conflicts with another service, gdbserver will
56print an error message and exit.
57
8656e7d8
DJ
58On some targets, gdbserver can also attach to running programs.
59This is accomplished via the --attach argument. The syntax is:
60
61 target> gdbserver COMM --attach PID
62
63PID is the process ID of a currently running process. It isn't
64necessary to point gdbserver at a binary for the running process.
65
c906108c
SS
66Usage (host side):
67
68You need an unstripped copy of the target program on your host system, since
69GDB needs to examine it's symbol tables and such. Start up GDB as you normally
70would, with the target program as the first argument. (You may need to use the
71--baud option if the serial line is running at anything except 9600 baud.)
72Ie: `gdb TARGET-PROG', or `gdb --baud BAUD TARGET-PROG'. After that, the only
73new command you need to know about is `target remote'. It's argument is either
74a device name (usually a serial device, like `/dev/ttyb'), or a HOST:PORT
75descriptor. For example:
76
77 (gdb) target remote /dev/ttyb
78
79communicates with the server via serial line /dev/ttyb, and:
80
81 (gdb) target remote the-target:2345
82
83communicates via a TCP connection to port 2345 on host `the-target', where
84you previously started up gdbserver with the same port number. Note that for
85TCP connections, you must start up gdbserver prior to using the `target remote'
86command, otherwise you may get an error that looks something like
87`Connection refused'.
88.SH OPTIONS
89You have to supply the name of the program to debug
90and the tty to communicate on; the remote GDB will do everything else.
91Any remaining arguments will be passed to the program verbatim.
92.SH "SEE ALSO"
93.RB "`\|" gdb "\|'"
94entry in
95.B info\c
96\&;
97.I
98Using GDB: A Guide to the GNU Source-Level Debugger\c
99, Richard M. Stallman and Roland H. Pesch, July 1991.
100.SH COPYING
101Copyright (c) 1993 Free Software Foundation, Inc.
102.PP
103Permission is granted to make and distribute verbatim copies of
104this manual provided the copyright notice and this permission notice
105are preserved on all copies.
106.PP
107Permission is granted to copy and distribute modified versions of this
108manual under the conditions for verbatim copying, provided that the
109entire resulting derived work is distributed under the terms of a
110permission notice identical to this one.
111.PP
112Permission is granted to copy and distribute translations of this
113manual into another language, under the above conditions for modified
114versions, except that this permission notice may be included in
115translations approved by the Free Software Foundation instead of in
116the original English.
This page took 0.873019 seconds and 4 git commands to generate.