From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12985 invoked by alias); 31 Jul 2013 12:37:40 -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 12975 invoked by uid 89); 31 Jul 2013 12:37:39 -0000 X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_MED,RCVD_IN_HOSTKARMA_W,RDNS_NONE autolearn=ham version=3.3.1 Received: from Unknown (HELO mms3.broadcom.com) (216.31.210.19) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 31 Jul 2013 12:37:39 +0000 Received: from [10.9.208.53] by mms3.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Wed, 31 Jul 2013 05:27:33 -0700 X-Server-Uuid: B86B6450-0931-4310-942E-F00ED04CA7AF Received: from IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) by IRVEXCHCAS06.corp.ad.broadcom.com (10.9.208.53) with Microsoft SMTP Server (TLS) id 14.1.438.0; Wed, 31 Jul 2013 05:35:57 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) with Microsoft SMTP Server id 14.1.438.0; Wed, 31 Jul 2013 05:35:57 -0700 Received: from [10.177.72.91] (unknown [10.177.72.91]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id D1BF6F2D72; Wed, 31 Jul 2013 05:35:56 -0700 (PDT) Message-ID: <51F904AB.3070007@broadcom.com> Date: Wed, 31 Jul 2013 12:37:00 -0000 From: "Andrew Burgess" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: gdb-patches@sourceware.org cc: "Pedro Alves" Subject: Re: [PATCH 2/4] Remove deprecated_throw_reason from mips_error. References: <51F7E51E.3070807@broadcom.com> <51F7E5A4.5090106@broadcom.com> <51F81092.4050003@redhat.com> In-Reply-To: <51F81092.4050003@redhat.com> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-07/txt/msg00819.txt.bz2 On 30/07/2013 8:14 PM, Pedro Alves wrote: > On 07/30/2013 05:11 PM, Andrew Burgess wrote: >> >> diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c >> index 1619622..791aa8a 100644 >> --- a/gdb/remote-mips.c >> +++ b/gdb/remote-mips.c >> @@ -510,7 +510,7 @@ mips_error (char *string,...) >> if (!ptid_equal (inferior_ptid, null_ptid)) >> target_mourn_inferior (); >> >> - deprecated_throw_reason (RETURN_ERROR); >> + throw_error (GENERIC_ERROR, "Remote debugging terminated"); > > Throw TARGET_CLOSE_ERROR instead. Add i18n, and period at end > of sentence. Okay with that change. > > I'd suggest removing or merging the earlier printf_unfiltered with > the error message, they're a bit redundant, and having the text > in the error is better in that a frontend usually displays errors > in a special way (a messagebox or some such), while console prints > end up hidden in the console... So, following the advice in your second paragraph I've got a new patch below, given that it's totally different to the first I'm reposting for a review before committing. The only testing I've done of this code is to compile it (--enable-targets=all), then add in a fake call to mips_error and check that the output looks reasonable. I've removed the use of error_pre_print given that all the output is now passing through throw_verror, I assume that does the "correct" thing, though interestingly I notice that error_pre_print, and quit_pre_print are no longer used anywhere after this patch.... If this change seems too disruptive then I can always go back to the original patch and just change the error code to TARGET_CLOSE_ERROR. What do you think? OK to apply? Thanks, Andrew gdb/ChangeLog 2013-07-31 Andrew Burgess * remote-mips.c (mips_error): Replace use of deprecated_throw_reason with throw_verror. Use the error message passed to mips_error as the error message for throw_verror. diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 1619622..df96997 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -488,17 +488,12 @@ static void ATTRIBUTE_NORETURN mips_error (char *string,...) { va_list args; - - va_start (args, string); + char *fmt; + int status; target_terminal_ours (); wrap_here (""); /* Force out any buffered output. */ gdb_flush (gdb_stdout); - if (error_pre_print) - fputs_filtered (error_pre_print, gdb_stderr); - vfprintf_filtered (gdb_stderr, string, args); - fprintf_filtered (gdb_stderr, "\n"); - va_end (args); gdb_flush (gdb_stderr); /* Clean up in such a way that mips_close won't try to talk to the @@ -506,11 +501,18 @@ mips_error (char *string,...) it). */ close_ports (); - printf_unfiltered ("Ending remote MIPS debugging.\n"); if (!ptid_equal (inferior_ptid, null_ptid)) target_mourn_inferior (); - deprecated_throw_reason (RETURN_ERROR); + status = asprintf (&fmt, "Ending remote MIPS debugging: %s", string); + if (fmt == NULL || status < 0) + fmt = string; + else + make_cleanup (xfree, fmt); + + va_start (args, string); + throw_verror (TARGET_CLOSE_ERROR, fmt, args); + va_end (args); } /* putc_readable - print a character, displaying non-printable chars in