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