public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Simon Sobisch <simonsobisch@gnu.org>
To: gdb ml <gdb@sourceware.org>
Subject: help text of aliased commands using "with"
Date: Thu, 9 Jun 2022 11:27:37 +0200	[thread overview]
Message-ID: <ce24a82e-136b-c128-a5b9-65e119e67673@gnu.org> (raw)

Using aliases works fine in general; the help only works if there's a 
direct alias.

1 direct alias - nearly fine help:

(gdb) alias asdf = print
(gdb) help asdf
print, asdf, inspect, p
Print value of expression EXP.
Usage: print [[OPTION]... --] [/FMT] [EXP]
[... rest of print help]


2 alias with default arguments - perfect

(gdb) alias asdfa = print -elements unlimited -elements unlimited
(gdb) help asdfa
print, asdfa, asdf, inspect, p
  alias asdfa = print -elements unlimited -elements unlimited
Print value of expression EXP.
Usage: print [[OPTION]... --] [/FMT] [EXP]
[... rest of print help]


3 alias with potentially nested "with", seems broken

(gdb) alias -- asdfw = with print elements unlimited -- with print \
       repeats unlimited -- print
(gdb) help asdfw
with, asdfw, w
   alias asdfw = with print elements unlimited -- with print repeats 
unlimited -- print
Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING.
Usage: with SETTING [VALUE] [-- COMMAND]
Usage: w SETTING [VALUE] [-- COMMAND]
With no COMMAND, repeats the last executed command.

SETTING is any setting you can change with the "set" subcommands.
E.g.:
with language pascal -- print obj
with print elements unlimited -- print obj

You can change multiple settings using nested with, and use
abbreviations for commands and/or values.  E.g.:
   w la p -- w p el u -- p obj



The second one is better than the first, as it lists the alias, too.


The third one shows that the alias is considered to be aliasing the 
"with" command, which is technically understandable, but from a 
user-point of view it is still the COMMAND that is aliased (in this case 
"print").


Questions:

1 Can the alias always be printed? scenario 1 misses the line
   alias asdf = print"
   I guess that's possibly a small bug fix.

2 Is it possible to adjust "alias --" to let its help point to the
   actual COMMAND?
   Preferably with the help for the parameters requested?

Draft output (as in scenario 2 + output of the "with" entries as shown 
with "help set print elements unlimited"):

(gdb) help asdfw
print, asdfa, asdfw, asdf, inspect, p
  alias -- asdfw = with print elements unlimited
                -- with print repeats unlimited
                print

Print value of expression EXP.
Usage: print [[OPTION]... --] [/FMT] [EXP]
[... rest of print help]

  print repeats unlimited
Set threshold for repeated print elements.
"unlimited" causes all elements to be individually printed.

  print elements unlimited
Set limit on string chars or array elements to print.
"unlimited" causes there to be no limit.


3 If this isn't possible then could the help of "alias --" entries be 
adjusted to "just show the alias? Draft output for that:

(gdb) help asdfw
  alias -- asdfw = with print elements unlimited
                -- with print repeats unlimited
                print
Do "help with", "help print" for info on commands executed.


Simon

             reply	other threads:[~2022-06-09  9:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09  9:27 Simon Sobisch [this message]
2022-06-10  5:36 ` Philippe Waroquiers
2022-06-10  6:01   ` Simon Sobisch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ce24a82e-136b-c128-a5b9-65e119e67673@gnu.org \
    --to=simonsobisch@gnu.org \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).