From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11354 invoked by alias); 22 Sep 2011 13:55:03 -0000 Received: (qmail 11301 invoked by uid 22791); 22 Sep 2011 13:55:02 -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; Thu, 22 Sep 2011 13:54:47 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1R6jjh-0007dn-VW from pedro_alves@mentor.com ; Thu, 22 Sep 2011 06:54:46 -0700 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 22 Sep 2011 14:55:09 +0100 From: Pedro Alves To: Doug Evans Subject: Re: [RFA, doc RFA] Add gdb.add_command_alias Date: Thu, 22 Sep 2011 14:08:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-11-generic; KDE/4.7.0; x86_64; ; ) Cc: Eli Zaretskii , "gdb-patches" References: <20110909183636.444932461B1@ruffy.mtv.corp.google.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201109221454.41805.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/msg00409.txt.bz2 Thanks! On Wednesday 21 September 2011 22:12:11, Doug Evans wrote: > + make_cleanup ((make_cleanup_ftype *) dyn_string_delete, from_prefix); > + to_prefix = dyn_string_new (10); > + make_cleanup ((make_cleanup_ftype *) dyn_string_delete, to_prefix); Please don't add more casts to make_cleanup_ftype. /* NOTE: cagney/2000-03-04: This typedef is strictly for the make_cleanup function declarations below. Do not use this typedef as a cast when passing functions into the make_cleanup() code. Instead either use a bounce function or add a wrapper function. Calling a f(char*) function with f(void*) is non-portable. */ typedef void (make_cleanup_ftype) (void *); Any special reason `-f "maint bah foo" -t "info bar"' is forbidden? I was thinking that we'd only verify whether "info" exists. But maybe that shouldn't either be verified. Having 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"). It's fine with me to put this in as in. I'll try to change this at some point if I feel so inclined. I realize the alias mechanism as is today does not even create the alias if the FROM does not exist. So this branch ... > + if (to_argv[1] == NULL) > + { > + /* add_cmd requires we allocate space for name, hence the xstrdup. */ > + add_com_alias (xstrdup (to_argv[0]), from, class_alias, abbrev_flag); > + } is silent if FROM does not exist, though the other branch errors out. Just pointing it out -- not sure it was on purpose. With the make_cleahup_ftype thing fixed, this is fine with me. Thanks again! -- Pedro Alves