[RFA,01/10] Rationalize "backtrace" command line parsing

Message ID 87shi5me8i.fsf@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey July 9, 2017, 10:34 p.m. UTC
  >>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> It might be good to clarify "help bt", to show something around:
Pedro>   Usage: backtrace [QUALIFIERS]... COUNT

How about the appended?

Tom

commit 46ab61faf8412739124639aac528d2b7df387632
Author: Tom Tromey <tom@tromey.com>
Date:   Sun Jul 9 16:31:11 2017 -0600

    Improve "backtrace" help text
    
    This improves help text in stack.c in two ways.  First, it removes
    trailing newlines from various help strings.  I think these are never
    needed.  Second, it adds a "Usage" line to the "backtrace" text, as
    suggested by Pedro.
    
    ChangeLog
    2017-07-09  Tom Tromey  <tom@tromey.com>
    
            * stack.c (_initialize_stack): Remove trailing newlines from help
            text.  Add "Usage" line to "backtrace" help.
  

Comments

Eli Zaretskii July 10, 2017, 4:48 p.m. UTC | #1
> From: Tom Tromey <tom@tromey.com>
> Cc: Tom Tromey <tom@tromey.com>,  gdb-patches@sourceware.org
> Date: Sun, 09 Jul 2017 16:34:21 -0600
> 
> >>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
> 
> Pedro> It might be good to clarify "help bt", to show something around:
> Pedro>   Usage: backtrace [QUALIFIERS]... COUNT
> 
> How about the appended?
> 
> Tom
> 
> commit 46ab61faf8412739124639aac528d2b7df387632
> Author: Tom Tromey <tom@tromey.com>
> Date:   Sun Jul 9 16:31:11 2017 -0600
> 
>     Improve "backtrace" help text
>     
>     This improves help text in stack.c in two ways.  First, it removes
>     trailing newlines from various help strings.  I think these are never
>     needed.  Second, it adds a "Usage" line to the "backtrace" text, as
>     suggested by Pedro.
>     
>     ChangeLog
>     2017-07-09  Tom Tromey  <tom@tromey.com>
>     
>             * stack.c (_initialize_stack): Remove trailing newlines from help
>             text.  Add "Usage" line to "backtrace" help.

Fine with me, thanks.
  
Pedro Alves July 14, 2017, 12:08 p.m. UTC | #2
On 07/09/2017 11:34 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
> 
> Pedro> It might be good to clarify "help bt", to show something around:
> Pedro>   Usage: backtrace [QUALIFIERS]... COUNT
> 
> How about the appended?

Thanks, LGTM, with a minor nit:

> +Usage: backtrace [QUALIFIERS]... [COUNT]\n\

I should have suggested "[QUALIFIER]..." (singular).
The "..." already indicates you can have multiple instances.

The output of 

  $ grep -rn "]\.\.\." -rn

seems to agree.

and so does "ls --help", etc.

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 210bebc..73b463e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@ 
+2017-07-09  Tom Tromey  <tom@tromey.com>
+
+	* stack.c (_initialize_stack): Remove trailing newlines from help
+	text.  Add "Usage" line to "backtrace" help.
+
 2017-04-25  Tom Tromey  <tom@tromey.com>
 
 	PR python/16486:
diff --git a/gdb/stack.c b/gdb/stack.c
index 4f6b117..5df25c4 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -2589,22 +2589,23 @@  This is useful in command scripts."));
 Select and print a stack frame.\nWith no argument, \
 print the selected stack frame.  (See also \"info frame\").\n\
 An argument specifies the frame to select.\n\
-It can be a stack frame number or the address of the frame.\n"));
+It can be a stack frame number or the address of the frame."));
 
   add_com_alias ("f", "frame", class_stack, 1);
 
   add_com_suppress_notification ("select-frame", class_stack, select_frame_command, _("\
 Select a stack frame without printing anything.\n\
 An argument specifies the frame to select.\n\
-It can be a stack frame number or the address of the frame.\n"),
+It can be a stack frame number or the address of the frame."),
 		 &cli_suppress_notification.user_selected_context);
 
   add_com ("backtrace", class_stack, backtrace_command, _("\
 Print backtrace of all stack frames, or innermost COUNT frames.\n\
-With a negative argument, print outermost -COUNT frames.\nUse of the \
-'full' qualifier also prints the values of the local variables.\n\
+Usage: backtrace [QUALIFIERS]... [COUNT]\n\
+With a negative argument, print outermost -COUNT frames.\n\
+Use of the 'full' qualifier also prints the values of the local variables.\n\
 Use of the 'no-filters' qualifier prohibits frame filters from executing\n\
-on this backtrace.\n"));
+on this backtrace."));
   add_com_alias ("bt", "backtrace", class_stack, 0);
 
   add_com_alias ("where", "backtrace", class_alias, 0);
@@ -2622,7 +2623,7 @@  on this backtrace.\n"));
   if (dbx_commands)
     add_com ("func", class_stack, func_command, _("\
 Select the stack frame that contains <func>.\n\
-Usage: func <name>\n"));
+Usage: func <name>"));
 
   add_setshow_enum_cmd ("frame-arguments", class_stack,
 			print_frame_arguments_choices, &print_frame_arguments,