From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19359 invoked by alias); 13 Sep 2011 19:15:27 -0000 Received: (qmail 19344 invoked by uid 22791); 13 Sep 2011 19:15:23 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Sep 2011 19:15:09 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1R3YRo-0004Ai-AD from pedro_alves@mentor.com ; Tue, 13 Sep 2011 12:15:08 -0700 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 13 Sep 2011 20:15:06 +0100 From: Pedro Alves To: Doug Evans Subject: Re: [RFA, doc RFA] Add gdb.add_command_alias Date: Tue, 13 Sep 2011 19:32:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-11-generic; KDE/4.7.0; x86_64; ; ) Cc: gdb-patches@sourceware.org, Eli Zaretskii References: <20110909183636.444932461B1@ruffy.mtv.corp.google.com> <201109131839.49816.pedro@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201109132015.04463.pedro@codesourcery.com> 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-09/txt/msg00221.txt.bz2 On Tuesday 13 September 2011 19:48:45, Doug Evans wrote: > On Tue, Sep 13, 2011 at 10:39 AM, Pedro Alves wrote: > > IMO, since this is really about aliasing new CLI spellings for > > existing CLI commands, it'd make sense to have a way to alias commands > > in the CLI, without python. E.g., > > > > (gdb) alias isl info shared library > > (gdb) isl > > > > > > Python could then of course just do gdb.execute("alias ..."). > > [s/shared library/sharedlibrary/ > It's not clear how general you intended this to be. I was just throwing out the idea. Hadn't though much on such details. :-) > > E.g., handle an arbitrary number of prefixes?] > > If the intent is to handle an arbitrary number of prefixes > then that's a different kind of > alias than how gdb uses the word today. Hmm, you mean prefixes on the alias name? Cause we have aliases that expand to prefixed commands: infcmd.c:2797: add_com_alias ("tty", "set inferior-tty", class_alias, 0); > E.g. > (gdb) alias spe set print elements > (gdb) spe 20 # set print elements = 20 Right. > That's fine, just checking ... > > IWBN to add aliases from the CLI for anything, > (e.g., grep for add_alias_cmd in mips-tdep.c, sheesh!) Hmm, what's the advantage of add_alias_cmd over add_com_alias (or vice versa)? Are these really two use cases from the user's perpective, or just two ways to end up with the same thing? > but that will require a bit more syntax. > One would need to distinguish aliasing > "spe" --> "set print elements" > from > "set print foobars" --> "set print elements". Ah, right, yes, of course. That sounds useful. Irrespective of what we do know, do you think it _shouldn't_ work? Maybe it's useful. E.g., `alias -f FROM -t TO' would work for me. E.g., (gdb) alias -f "set print foobars" -t "set print elements" The command would fail if "set" or "set print" in FROM don't exist, or TO doesn't exist. But if that's hard, we can just not support it (yet at least), as long as we leave the door open in terms of syntax. -- Pedro Alves