From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: gdb-patches@sourceware.org
Cc: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Subject: [RFAv3 4/4] Document define-prefix command and the use of . in command names.
Date: Thu, 28 Nov 2019 20:09:00 -0000 [thread overview]
Message-ID: <20191128200901.27511-5-philippe.waroquiers@skynet.be> (raw)
In-Reply-To: <20191128200901.27511-1-philippe.waroquiers@skynet.be>
gdb/ChangeLog
YYYY-MM-DD Philippe Waroquiers <philippe.waroquiers@skynet.be>
* NEWS: Mention define-prefix. Tell that command names can now
contain a . character.
gdb/doc/ChangeLog
YYYY-MM-DD Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.texinfo (Define): Indicate that user-defined prefix can
be used in 'define' command. Document 'define-prefix' command.
---
gdb/NEWS | 9 +++++++++
gdb/doc/gdb.texinfo | 45 +++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/gdb/NEWS b/gdb/NEWS
index d9014075b4..e477986d5f 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -33,6 +33,12 @@
provide the exitcode or exit status of the shell commands launched by
GDB commands such as "shell", "pipe" and "make".
+* The command define-prefix can now define user defined prefix commands.
+ User defined commands can now be defined using these user defined prefix
+ commands.
+
+* Command names can now use the . character.
+
* The RX port now supports XML target descriptions.
* GDB now shows the Ada task names at more places, e.g. in task switching
@@ -100,6 +106,9 @@ pipe -d DELIM COMMAND DELIM SHELL_COMMAND
With no COMMAND, repeat the last executed command
and send its output to SHELL_COMMAND.
+define-prefix COMMAND
+ Define or mark a command as a user-defined prefix command.
+
with SETTING [VALUE] [-- COMMAND]
w SETTING [VALUE] [-- COMMAND]
Temporarily set SETTING, run COMMAND, and restore SETTING.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 478c95b643..2c30ea657e 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -26525,8 +26525,9 @@ end
Define a command named @var{commandname}. If there is already a command
by that name, you are asked to confirm that you want to redefine it.
The argument @var{commandname} may be a bare command name consisting of letters,
-numbers, dashes, and underscores. It may also start with any predefined
-prefix command. For example, @samp{define target my-target} creates
+numbers, dashes, dots, and underscores. It may also start with any
+predefined or user-defined prefix command.
+For example, @samp{define target my-target} creates
a user-defined @samp{target my-target} command.
The definition of the command is made up of other @value{GDBN} command lines,
@@ -26547,6 +26548,46 @@ You may use the @code{document} command again to change the
documentation of a command. Redefining the command with @code{define}
does not change the documentation.
+@kindex define-prefix
+@item define-prefix @var{commandname}
+Define or mark the command @var{commandname} as a user-defined prefix
+command. Once marked, @var{commandname} can be used as prefix command
+by the @code{define} command.
+Note that @code{define-prefix} can be used with a not yet defined
+@var{commandname}. In such a case, @var{commandname} is defined as
+an empty user-defined command.
+In case you redefine a command that was marked as a user-defined
+prefix command, the subcommands of the redefined command are kept
+(and @value{GDBN} indicates so to the user).
+
+Example:
+@example
+(gdb) define-prefix abc
+(gdb) define-prefix abc def
+(gdb) define abc def
+Type commands for definition of "abc def".
+End with a line saying just "end".
+>echo command initial def\n
+>end
+(gdb) define abc def ghi
+Type commands for definition of "abc def ghi".
+End with a line saying just "end".
+>echo command ghi\n
+>end
+(gdb) define abc def
+Keeping subcommands of prefix command "def".
+Redefine command "def"? (y or n) y
+Type commands for definition of "abc def".
+End with a line saying just "end".
+>echo command def\n
+>end
+(gdb) abc def ghi
+command ghi
+(gdb) abc def
+command def
+(gdb)
+@end example
+
@kindex dont-repeat
@cindex don't repeat command
@item dont-repeat
--
2.20.1
next prev parent reply other threads:[~2019-11-28 20:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-28 20:09 [RFAv3 0/4] More flexible user-defined commands prefixing and naming Philippe Waroquiers
2019-11-28 20:09 ` [RFAv3 3/4] Allow . character as part of command names Philippe Waroquiers
2019-11-28 20:09 ` [RFAv3 1/4] Implement user defined prefix Philippe Waroquiers
2019-11-30 4:09 ` Simon Marchi
2019-11-28 20:09 ` [RFAv3 2/4] Test define-prefix Philippe Waroquiers
2019-11-28 20:09 ` Philippe Waroquiers [this message]
2019-11-30 3:36 ` [RFAv3 0/4] More flexible user-defined commands prefixing and naming Simon Marchi
2019-11-30 8:55 ` Philippe Waroquiers
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=20191128200901.27511-5-philippe.waroquiers@skynet.be \
--to=philippe.waroquiers@skynet.be \
--cc=gdb-patches@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).