From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org
Subject: [RFC] "New" command "!"
Date: Tue, 08 Nov 2011 09:38:00 -0000 [thread overview]
Message-ID: <20111108093759.279E3246194@ruffy.mtv.corp.google.com> (raw)
Hi.
I mentioned this before in an offhand comment,
but now I'm submitting this RFC.
I'll add tests,docs,NEWS if the code part is ok.
Am I missing something?
Is there a reason not to add this?
2011-11-08 Doug Evans <dje@google.com>
New command "!", not just for xdb.
* cli/cli-cmds.c (init_cli_cmds): Remove xdb_commands condition on
adding "!" command, always add it.
* cli/cli-decode.c (find_command_name_length): Recognize "!" as a
command of length one.
Index: cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.118
diff -u -p -r1.118 cli-cmds.c
--- cli/cli-cmds.c 1 Nov 2011 14:51:22 -0000 1.118
+++ cli/cli-cmds.c 8 Nov 2011 09:21:42 -0000
@@ -1825,14 +1825,7 @@ Two arguments (separated by a comma) are
if (xdb_commands)
add_com_alias ("va", "disassemble", class_xdb, 0);
- /* NOTE: cagney/2000-03-20: Being able to enter ``(gdb) !ls'' would
- be a really useful feature. Unfortunately, the below wont do
- this. Instead it adds support for the form ``(gdb) ! ls''
- (i.e. the space is required). If the ``!'' command below is
- added the complains about no ``!'' command would be replaced by
- complains about how the ``!'' command is broken :-) */
- if (xdb_commands)
- add_com_alias ("!", "shell", class_support, 0);
+ add_com_alias ("!", "shell", class_support, 0);
c = add_com ("make", class_support, make_command, _("\
Run the ``make'' program using the rest of the line as arguments."));
Index: cli/cli-decode.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
retrieving revision 1.98
diff -u -p -r1.98 cli-decode.c
--- cli/cli-decode.c 9 Oct 2011 22:21:42 -0000 1.98
+++ cli/cli-decode.c 8 Nov 2011 09:30:22 -0000
@@ -1127,11 +1127,16 @@ find_command_name_length (const char *te
Note that this is larger than the character set allowed when
creating user-defined commands. */
+ /* Recognize '!' as a single character command so that, e.g., "!ls"
+ works as expected. */
+ if (*p == '!')
+ return 1;
+
while (isalnum (*p) || *p == '-' || *p == '_'
/* Characters used by TUI specific commands. */
|| *p == '+' || *p == '<' || *p == '>' || *p == '$'
/* Characters used for XDB compatibility. */
- || (xdb_commands && (*p == '!' || *p == '/' || *p == '?')))
+ || (xdb_commands && (*p == '/' || *p == '?')))
p++;
return p - text;
next reply other threads:[~2011-11-08 9:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-08 9:38 Doug Evans [this message]
2011-11-08 14:56 ` Tom Tromey
2011-11-08 15:36 ` Hui Zhu
2011-11-08 15:44 ` Tom Tromey
2011-11-08 15:51 ` Pedro Alves
2011-11-08 17:26 ` Doug Evans
2011-11-11 17:19 ` [doc RFA] " Doug Evans
2011-11-11 19:31 ` Eli Zaretskii
2011-11-15 17:00 ` Doug Evans
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=20111108093759.279E3246194@ruffy.mtv.corp.google.com \
--to=dje@google.com \
--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