From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11148 invoked by alias); 8 Nov 2011 09:38:19 -0000 Received: (qmail 11139 invoked by uid 22791); 8 Nov 2011 09:38:17 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_XD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Nov 2011 09:38:02 +0000 Received: from wpaz13.hot.corp.google.com (wpaz13.hot.corp.google.com [172.24.198.77]) by smtp-out.google.com with ESMTP id pA89c0oK002941 for ; Tue, 8 Nov 2011 01:38:00 -0800 Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.18.110.50]) by wpaz13.hot.corp.google.com with ESMTP id pA89bxBr024793 for ; Tue, 8 Nov 2011 01:37:59 -0800 Received: by ruffy.mtv.corp.google.com (Postfix, from userid 67641) id 279E3246194; Tue, 8 Nov 2011 01:37:58 -0800 (PST) To: gdb-patches@sourceware.org Subject: [RFC] "New" command "!" Message-Id: <20111108093759.279E3246194@ruffy.mtv.corp.google.com> Date: Tue, 08 Nov 2011 09:38:00 -0000 From: dje@google.com (Doug Evans) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-11/txt/msg00185.txt.bz2 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 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;