Re: [PATCH v2] gdb: improve usage strings

Doug Evans
2012-08-13T20:29:07Z

On Sun, Aug 12, 2012 at 7:05 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> [...]
> diff --git a/gdb/infcmd.c b/gdb/infcmd.c
> index d56503c..78bfc04 100644
> --- a/gdb/infcmd.c
> +++ b/gdb/infcmd.c
> @@ -3017,40 +3017,45 @@ The target will wait for another debugger to connect. Not available for\n\
> all targets."));
>
> c = add_com ("signal", class_run, signal_command, _("\
> -Continue program giving it signal specified by the argument.\n\
> -An argument of \"0\" means continue program without giving it a signal."));
> +Continue program and simultaneously send it the specified signal.\n\
> +Usage: signal SIGNAL\n\
> +An argument of \"0\" means continue the program without sending it a signal."));
> set_cmd_completer (c, signal_completer);

That's ok I guess. How about "Continue program with the specified signal." ?

Also, it would be good to augment the docs for "sig 0" to denote it
can be used to resume a program and discard the signal that is pending
for it, and would otherwise receive if you did a "continue". It's
kinda implicit in the existing wording, but I've seen a few cases
where more clarity would have helped.

How about:

An argument of "0" means continue the program without sending it a signal.
This is useful in cases where the program stopped because of a signal,
and you want to resume the program and discard the signal.

Or some such.

E.g. [I'm just using SIGINT as an example here.]

(gdb) handle SIGINT stop print pass
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) y

Signal Stop Print Pass to program Description
SIGINT Yes Yes Yes Interrupt
(gdb) r
Starting program: /home/dje/forever.x64
C-c C-c
Program received signal SIGINT, Interrupt.
0x00007ffff7b04680 in __nanosleep_nocancel ()
at ../sysdeps/unix/syscall-template.S:82
82 ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) sig 0
Continuing with no signal.
C-c C-c
Program received signal SIGINT, Interrupt.
0x00007ffff7b04680 in __nanosleep_nocancel ()
at ../sysdeps/unix/syscall-template.S:82
82 in ../sysdeps/unix/syscall-template.S
(gdb) c
Continuing.

Program terminated with signal SIGINT, Interrupt.
The program no longer exists.
(gdb)