Re: [doc patch] gdbserver.1: Document all the options and --multi

Eli Zaretskii
2013-04-06T08:45:00Z

> Date: Sat, 6 Apr 2013 08:47:24 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: gdb-patches@sourceware.org
>
> > This is OK, but perhaps will be even better if you describe the last
> > mode first. Then you can put the description of @var{comm} there, and
> > in the other 2 modes say something like "In addition to @var{comm} as
> > above, supply ...".
>
> I do not think it would be good, (1) the --multi mode is IMO an unusual one,
> a special case and (2) I also tried to generally keep the "gdbserver --help"
> output order.

Then let me suggest something specific:

There are three different modes for invoking @command{gdbserver}:

@itemize @bullet

@item
Debug a specific program specified by its program name:

@smallexample
gdbserver @var{comm} @var{prog} [@var{args}@dots{}]
@end smallexample

The @var{comm} parameter specifies how should the server communicate
with @value{GDBN}; it is either a device name (to use a serial line),
a TCP port number (@code{:1234}), or @code{-} or @code{stdio} to use
stdin/stdout of @code{gdbserver}. Specify the name of the program to
debug in @var{prog}. Any remaining arguments will be passed to the
program verbatim. When the program exits, @value{GDBN} will close the
connection, and @code{gdbserver} will exit.

@item
Debug a specific program by specifying the process ID of a running
program:

@smallexample
gdbserver --attach @var{comm} @var{pid}
@end smallexample

The @var{comm} parameter is as described above. Supply the process ID
of a running program in @var{pid}; @value{GDBN} will do everything
else. Like with the previous mode, when the process @var{pid} exits,
@value{GDBN} will close the connection, and @code{gdbserver} will exit.

@item
Multi-process mode -- debug more than one program/process:

@smallexample
gdbserver --multi @var{comm}
@end smallexample

In this mode, @value{GDBN} can instruct @command{gdbserver} which
command(s) to run. Unlike the other 2 modes, @value{GDBN} will not
close the connection when a process being debugged exits, so you can
debug several processes in the same session.
@end itemize

In each of the modes you may specify these options: