From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38455 invoked by alias); 14 Dec 2017 15:09:23 -0000 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 Received: (qmail 38439 invoked by uid 89); 14 Dec 2017 15:09:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Dec 2017 15:09:18 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 755736565E; Thu, 14 Dec 2017 15:09:17 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8ECD75C543; Thu, 14 Dec 2017 15:09:12 +0000 (UTC) Subject: Re: [RFA] (Ada) New command to stop at start of exception handler. To: Joel Brobecker , Xavier Roirand , Eli Zaretskii References: <1513094242-2313-1-git-send-email-roirand@adacore.com> <20171214142957.ntnoteiheetx4qb2@adacore.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <1247dee1-2dd6-5cc6-576c-d555557644c8@redhat.com> Date: Thu, 14 Dec 2017 15:09:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20171214142957.ntnoteiheetx4qb2@adacore.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-12/txt/msg00347.txt.bz2 On 12/14/2017 02:29 PM, Joel Brobecker wrote: >> > + char *info = xstrprintf (_("`%s' Ada exception hanlder"), c->excep_string); > This line is too long. > >> > + struct cleanup *old_chain = make_cleanup (xfree, info); > Let's be consistent with the above, and just do an xfree directly > right after the call to uiout->field_string. > You can do: std::string info = string_printf (_("`%s' Ada exception hanlder"), c->excep_string); .... uiout->text (info.c_str ()); and then you no longer have to worry about explicitly calling xfree, or, leaking if uiout->text() throws (which it can, if it paginates and the user aborts, for example). But there's also uiout->field_fmt(), which may be better here if the field is supposed to be an MI attribute: uiout->field_fmt ("somename", _("`%s' Ada exception hanlder"), c->excep_string); Also, typo "hanlder" in format string. :-) I haven't really read the description of the command / use case, but this sounds very much like the existing "catch catch"? Thanks, Pedro Alves