1gdbserver(1)                 GNU Development Tools                gdbserver(1)
2
3
4

NAME

6       gdbserver - Remote Server for the GNU Debugger
7

SYNOPSIS

9       gdbserver
10              tty prog [args...]
11
12       gdbserver tty --attach PID
13

DESCRIPTION

15       GDBSERVER  is  a  program  that  allows  you  to run GDB on a different
16       machine 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
21       onto  the  target system.  The program can be stripped to save space if
22       needed, as GDBserver doesn't care about symbols.  All  symbol  handling
23       is taken care of by the GDB running on the host system.
24
25       To  use  the server, you log on to the target system, and run the `gdb‐
26       server' program.  You must tell it (a) how to communicate with GDB, (b)
27       the  name  of  your program, and (c) its arguments.  The general syntax
28       is:
29
30            target> gdbserver COMM PROGRAM [ARGS ...]
31
32       For example, using a serial port, you might say:
33
34            target> gdbserver /dev/com1 emacs foo.txt
35
36       This tells gdbserver to debug emacs with an argument of foo.txt, and to
37       communicate  with GDB via /dev/com1.  Gdbserver now waits patiently for
38       the host GDB to communicate with it.
39
40       To use a TCP connection, you could say:
41
42            target> gdbserver host:2345 emacs foo.txt
43
44       This says pretty much the same thing as the last example,  except  that
45       we are going to communicate with the host GDB via TCP.  The `host:2345'
46       argument means that we are expecting  to  see  a  TCP  connection  from
47       `host'  to  local  TCP  port  2345.   (Currently,  the  `host'  part is
48       ignored.)  You can choose any number you want for the  port  number  as
49       long  as it does not conflict with any existing TCP ports on the target
50       system.  This same port number must be used in the  host  GDBs  `target
51       remote'  command,  which  will  be described shortly.  Note that if you
52       chose a port number that conflicts with another service, gdbserver will
53       print an error message and exit.
54
55       On  some  targets, gdbserver can also attach to running programs.  This
56       is accomplished via the --attach argument.  The syntax is:
57
58            target> gdbserver COMM --attach PID
59
60       PID is the process ID of a currently running process.  It isn't  neces‐
61       sary to point gdbserver at a binary for the running process.
62
63       Usage (host side):
64
65       You  need an unstripped copy of the target program on your host system,
66       since GDB needs to examine it's symbol tables and such.  Start  up  GDB
67       as  you  normally would, with the target program as the first argument.
68       (You may need to use the --baud option if the serial line is running at
69       anything except 9600 baud.)  Ie: `gdb TARGET-PROG', or `gdb --baud BAUD
70       TARGET-PROG'.  After that, the only new command you need to know  about
71       is  `target  remote'.  It's argument is either a device name (usually a
72       serial device, like `/dev/ttyb'), or a HOST:PORT descriptor.  For exam‐
73       ple:
74
75            (gdb) target remote /dev/ttyb
76
77       communicates with the server via serial line /dev/ttyb, and:
78
79            (gdb) target remote the-target:2345
80
81       communicates  via  a  TCP connection to port 2345 on host `the-target',
82       where you previously started up gdbserver with the  same  port  number.
83       Note  that  for  TCP  connections, you must start up gdbserver prior to
84       using the `target remote' command, otherwise you may get an error  that
85       looks something like `Connection refused'.
86

OPTIONS

88       You have to supply the name of the program to debug and the tty to com‐
89       municate on; the remote GDB will do  everything  else.   Any  remaining
90       arguments will be passed to the program verbatim.
91

SEE ALSO

93       `gdb'  entry in info; Using GDB: A Guide to the GNU Source-Level Debug‐
94       ger, Richard M. Stallman and Roland H. Pesch, July 1991.
95

COPYING

97       Copyright (c) 1993 Free Software Foundation, Inc.
98
99       Permission is granted to make and distribute verbatim  copies  of  this
100       manual  provided  the  copyright  notice and this permission notice are
101       preserved on all copies.
102
103       Permission is granted to copy and distribute modified versions of  this
104       manual  under  the  conditions  for verbatim copying, provided that the
105       entire resulting derived work is distributed under the terms of a  per‐
106       mission notice identical to this one.
107
108       Permission  is granted to copy and distribute translations of this man‐
109       ual into another language, under the above conditions for modified ver‐
110       sions,  except  that this permission notice may be included in transla‐
111       tions approved by the Free Software Foundation instead of in the origi‐
112       nal English.
113
114
115
116Cygnus Support                  2 November 1993                   gdbserver(1)
Impressum