further improve "handle" help string

Pedro Alves
2012-08-23T16:26:55Z

On 08/15/2012 02:58 AM, Mike Frysinger wrote:
> On Tuesday 14 August 2012 14:10:14 Eli Zaretskii wrote:
>>> Date: Tue, 14 Aug 2012 10:34:10 -0700
>>> From: Doug Evans <dje@google.com>
>>> Cc: gdb-patches@sourceware.org, Eli Zaretskii <eliz@gnu.org>
>>>
>>> Ok with me, but I'd wait for Eli to check too.
>>>
>>> Thanks!
>>
>> I'm quite sure I already did. Mike, is that right?
>
> i've tweaked the signal wording, but i think the latest iteration covers
> everyone's concerns, so i'll merge this and we can fight over improving it
> further if need be ;)

I'll byte ;-)

I'd like to add a mention that you can specify more than one signal (though
not complicate and distract the main body of the text with this). I
use this occasionally. Text mostly borrowed from the sources.

Tested on amd64 Fedora 17.

(gdb) help handle
Specify how to handle signals.
Usage: handle SIGNAL [ACTIONS]
Args are signals and actions to apply to those signals.
If no actions are specified, the current settings for the specified signals
will be displayed instead.

Symbolic signals (e.g. SIGSEGV) are recommended but numeric signals
from 1-15 are allowed for compatibility with old versions of GDB.
Numeric ranges may be specified with the form LOW-HIGH (e.g. 1-5).
The special arg "all" is recognized to mean all signals except those
used by the debugger, typically SIGTRAP and SIGINT.

Recognized actions include "stop", "nostop", "print", "noprint",
"pass", "nopass", "ignore", or "noignore".
Stop means reenter debugger if this signal happens (implies print).
Print means print a message if this signal happens.
Pass means let program see this signal; otherwise program doesn't know.
Ignore is a synonym for nopass and noignore is a synonym for pass.
Pass and Stop may be combined.

Multiple signals may be specified. Signal numbers and signal names
may be interspersed with actions, with the actions being performed for
all signals cumulatively specified.
(gdb)

2012-08-23 Pedro Alves <palves@redhat.com>

gdb/
* infrun.c (_initialize_infrun) <handle command help text>:
Mention that multiple signals are supported.

gdb/testsuite/
* gdb.base/help.exp: Adjust to "handle" help text change.
---

gdb/infrun.c | 10 +++++++---
gdb/testsuite/gdb.base/help.exp | 6 +++---
2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 9628170..cbab993 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -7096,10 +7096,10 @@ Specify a signal as argument to print info on that signal only."));
add_info_alias ("handle", "signals", 0);

c = add_com ("handle", class_run, handle_command, _("\
-Specify how to handle a signal.\n\
+Specify how to handle signals.\n\
Usage: handle SIGNAL [ACTIONS]\n\
Args are signals and actions to apply to those signals.\n\
-If no actions are specified, the current settings for the specified signal\n\
+If no actions are specified, the current settings for the specified signals\n\
will be displayed instead.\n\
\n\
Symbolic signals (e.g. SIGSEGV) are recommended but numeric signals\n\
@@ -7114,7 +7114,11 @@ Stop means reenter debugger if this signal happens (implies print).\n\
Print means print a message if this signal happens.\n\
Pass means let program see this signal; otherwise program doesn't know.\n\
Ignore is a synonym for nopass and noignore is a synonym for pass.\n\
-Pass and Stop may be combined."));
+Pass and Stop may be combined.\n\
+\n\
+Multiple signals may be specified. Signal numbers and signal names\n\
+may be interspersed with actions, with the actions being performed for\n\
+all signals cumulatively specified."));
set_cmd_completer (c, handle_completer);

if (xdb_commands)
diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp
index b6582ba..7fffd00 100644
--- a/gdb/testsuite/gdb.base/help.exp
+++ b/gdb/testsuite/gdb.base/help.exp
@@ -219,7 +219,7 @@ gdb_test "help h" "Print list of commands\." "help help \"h\" abbreviation"
# test help help
gdb_test "help help" "Print list of commands\." "help help"
# test help handle
-gdb_test "help handle" "Specify how to handle a signal\..*" "help handle"
+gdb_test "help handle" "Specify how to handle signals\..*" "help handle"
# test help info "i" abbreviation
test_prefix_command_help {"i" "info"} {
"Generic command for showing things about the program being debugged\.\[\r\n\]+"
@@ -699,8 +699,8 @@ gdb_test "help info bogus-gdb-command" "Undefined info command: \"bogus-gdb-comm
# test help gotcha
gdb_test "help gotcha" "Undefined command: \"gotcha\"\. Try \"help\"\." "help gotcha"
# test apropos regex
-gdb_test "apropos \\\(print\[\^ bsiedf\\\".-\]\\\)" "handle -- Specify how to handle a signal"
+gdb_test "apropos \\\(print\[\^ bsiedf\\\".-\]\\\)" "handle -- Specify how to handle signals"
# test apropos >1 word string
-gdb_test "apropos handle a signal" "handle -- Specify how to handle a signal"
+gdb_test "apropos handle signal" "handle -- Specify how to handle signals"
# test apropos apropos
gdb_test "apropos apropos" "apropos -- Search for commands matching a REGEXP"