From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20330 invoked by alias); 22 Sep 2011 17:35:12 -0000 Received: (qmail 20227 invoked by uid 22791); 22 Sep 2011 17:35:11 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Sep 2011 17:34:57 +0000 Received: from wpaz21.hot.corp.google.com (wpaz21.hot.corp.google.com [172.24.198.85]) by smtp-out.google.com with ESMTP id p8MHYuv9025834 for ; Thu, 22 Sep 2011 10:34:56 -0700 Received: from qwm42 (qwm42.prod.google.com [10.241.196.42]) by wpaz21.hot.corp.google.com with ESMTP id p8MHUk3I003898 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 22 Sep 2011 10:34:55 -0700 Received: by qwm42 with SMTP id 42so5133240qwm.1 for ; Thu, 22 Sep 2011 10:34:55 -0700 (PDT) Received: by 10.224.218.194 with SMTP id hr2mr1831997qab.61.1316712895623; Thu, 22 Sep 2011 10:34:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.218.194 with SMTP id hr2mr1831989qab.61.1316712895457; Thu, 22 Sep 2011 10:34:55 -0700 (PDT) Received: by 10.224.80.149 with HTTP; Thu, 22 Sep 2011 10:34:55 -0700 (PDT) In-Reply-To: <201109221454.41805.pedro@codesourcery.com> References: <20110909183636.444932461B1@ruffy.mtv.corp.google.com> <201109221454.41805.pedro@codesourcery.com> Date: Thu, 22 Sep 2011 17:45:00 -0000 Message-ID: Subject: Re: [RFA, doc RFA] Add gdb.add_command_alias From: Doug Evans To: Pedro Alves Cc: Eli Zaretskii , gdb-patches Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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-09/txt/msg00412.txt.bz2 On Thu, Sep 22, 2011 at 6:54 AM, Pedro Alves wrote: > On Wednesday 21 September 2011 22:12:11, Doug Evans wrote: >> + =A0 =A0 =A0make_cleanup ((make_cleanup_ftype *) dyn_string_delete, fro= m_prefix); >> + =A0 =A0 =A0to_prefix =3D dyn_string_new (10); >> + =A0 =A0 =A0make_cleanup ((make_cleanup_ftype *) dyn_string_delete, to_= prefix); > > Please don't add more casts to make_cleanup_ftype. /me wishes all existing uses got cleaned up - monkey see monkey do ... > Any special reason `-f "maint bah foo" -t "info bar"' is forbidden? Couldn't think of a use for it. Support can be added later if/when warranted. > I was thinking that we'd only verify whether "info" exists. =A0But maybe > that shouldn't either be verified. =A0Having aliases not erroring out if = the > destination doesn't exist allows one putting aliases in .gdbinit > without worrying if the gdb that'll load has FROM already (it may be > too old, but not old enough to not support "alias"). I like being restrictive in error catching, at least in the early stages. btw, if the gdb has python one could wrap it and catch alias failure. Not that this helps people with older gdb's, but maybe cli should have its own "try" command (or we could just require python for such things). > So this branch ... > >> + =A0if (to_argv[1] =3D=3D NULL) >> + =A0 =A0{ >> + =A0 =A0 =A0/* add_cmd requires we allocate space for name, hence the x= strdup. =A0*/ >> + =A0 =A0 =A0add_com_alias (xstrdup (to_argv[0]), from, class_alias, abb= rev_flag); >> + =A0 =A0} > > is silent if FROM does not exist, though the other branch errors out. > Just pointing it out -- not sure it was on purpose. Oversight, thanks. Now I just need a doc RFA.