gdbserver (1)
Leading comments
Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) Standard preamble: ========================================================================
NAME
gdbserver - Remote Server for the GNU DebuggerSYNOPSIS
gdbserver comm prog [args...]gdbserver --attach comm pid
gdbserver --multi comm
DESCRIPTION
gdbserver is a program that allows you to runUsage (server (target) side):
First, you need to have a copy of the program you want to debug put onto the target system. The program can be stripped to save space if needed, as gdbserver doesn't care about symbols. All symbol handling is taken care of by the
To use the server, you log on to the target system, and run the gdbserver program. You must tell it (a) how to communicate with
target> gdbserver <comm> <program> [<args> ...]
For example, using a serial port, you might say:
target> gdbserver /dev/com1 emacs foo.txt
This tells gdbserver to debug emacs with an argument of foo.txt, and to communicate with
To use a
target> gdbserver host:2345 emacs foo.txt
This says pretty much the same thing as the last example, except that we are going to communicate with the "host"
gdbserver can also attach to running programs. This is accomplished via the --attach argument. The syntax is:
target> gdbserver --attach <comm> <pid>
pid is the process
To start "gdbserver" without supplying an initial command to run or process
target> gdbserver --multi <comm>
Usage (host side):
You need an unstripped copy of the target program on your host system, since
(gdb) target remote /dev/ttyb
communicates with the server via serial line /dev/ttyb, and:
(gdb) target remote the-target:2345
communicates via a
gdbserver can also debug multiple inferiors at once, described in the
(gdb) target extended-remote the-target:2345
The gdbserver option --multi may or may not be used in such case.
OPTIONS
There are three different modes for invoking gdbserver:- *
-
Debug a specific program specified by its program name:
gdbserver <comm> <prog> [<args>...]
The comm parameter specifies how should the server communicate with
GDB; it is either a device name (to use a serial line), aTCPport number (":1234"), or "-" or "stdio" to use stdin/stdout of "gdbserver". Specify the name of the program to debug in prog. Any remaining arguments will be passed to the program verbatim. When the program exits,GDBwill close the connection, and "gdbserver" will exit. - *
-
Debug a specific program by specifying the process IDof a running program:
gdbserver --attach <comm> <pid>
The comm parameter is as described above. Supply the process
IDof a running program in pid;GDBwill do everything else. Like with the previous mode, when the process pid exits,GDBwill close the connection, and "gdbserver" will exit. - *
-
Multi-process mode --- debug more than one program/process:
gdbserver --multi <comm>
In this mode,
GDBcan instruct gdbserver which command(s) to run. Unlike the other 2 modes,GDBwill not close the connection when a process being debugged exits, so you can debug several processes in the same session.
In each of the modes you may specify these options:
- --help
- List all options, with brief explanations.
- --version
- This option causes gdbserver to print its version number and exit.
- --attach
-
gdbserver will attach to a running program. The syntax is:
target> gdbserver --attach <comm> <pid>
pid is the process
IDof a currently running process. It isn't necessary to point gdbserver at a binary for the running process. - --multi
-
To start "gdbserver" without supplying an initial command to run
or process IDto attach, use this command line option. Then you can connect using "target extended-remote" and start the program you want to debug. The syntax is:
target> gdbserver --multi <comm>
- --debug
- Instruct "gdbserver" to display extra status information about the debugging process. This option is intended for "gdbserver" development and for bug reports to the developers.
- --remote-debug
- Instruct "gdbserver" to display remote protocol debug output. This option is intended for "gdbserver" development and for bug reports to the developers.
- --debug-format=option1[,option2,...]
- Instruct "gdbserver" to include extra information in each line of debugging output.
- --wrapper
- Specify a wrapper to launch programs for debugging. The option should be followed by the name of the wrapper, then any command-line arguments to pass to the wrapper, then "--" indicating the end of the wrapper arguments.
- --once
-
By default, gdbserver keeps the listening TCPport open, so that additional connections are possible. However, if you start "gdbserver" with the --once option, it will stop listening for any further connection attempts after connecting to the firstGDBsession.
SEE ALSO
The full documentation for
info gdb
should give you access to the complete manual.
Using
COPYRIGHT
Copyright (c) 1988-2016 Free Software Foundation, Inc.Permission is granted to copy, distribute and/or modify this document under the terms of the
(a) The