From patchwork Wed Aug 6 10:12:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Benson X-Patchwork-Id: 2322 Received: (qmail 11655 invoked by alias); 6 Aug 2014 10:52:05 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 11639 invoked by uid 89); 6 Aug 2014 10:52:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 06 Aug 2014 10:52:03 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s76ACbtm006675 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 6 Aug 2014 06:12:37 -0400 Received: from blade.nx (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s76ACas1003148 for ; Wed, 6 Aug 2014 06:12:37 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id 4A0012640E3 for ; Wed, 6 Aug 2014 11:12:35 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Subject: [PATCH 6/8] Replace hardwired error handler in go32_create_inferior Date: Wed, 6 Aug 2014 11:12:26 +0100 Message-Id: <1407319948-2264-7-git-send-email-gbenson@redhat.com> In-Reply-To: <1407319948-2264-1-git-send-email-gbenson@redhat.com> References: <1407319948-2264-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes go32_create_inferior invokes a hardwired fprintf/exit error handler if v2loadimage fails. I could find no reason for this other than that the block seems to have been copy-and-pasted from v2loadimage's manpage. This commit replaces the hardwired handler with a call to error. gdb/ 2014-08-05 Gary Benson * go32-nat.c (go32_create_inferior): Replace a fprintf/ exit pair with a call to error. Wrap the message with _(). --- gdb/ChangeLog | 5 +++++ gdb/go32-nat.c | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index b2570e8..eb3cde9 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -642,6 +642,7 @@ go32_create_inferior (struct target_ops *ops, char *exec_file, char **env_save = environ; size_t cmdlen; struct inferior *inf; + int result; /* If no exec file handed to us, get it from the exec-file command -- with a good, common error message if none is specified. */ @@ -693,15 +694,14 @@ go32_create_inferior (struct target_ops *ops, char *exec_file, environ = env; - if (v2loadimage (exec_file, cmdline, start_state)) - { - environ = env_save; - printf_unfiltered ("Load failed for image %s\n", exec_file); - exit (1); - } + result = v2loadimage (exec_file, cmdline, start_state); + environ = env_save; xfree (cmdline); + if (!result) + error (_("Load failed for image %s", exec_file); + edi_init (start_state); #if __DJGPP_MINOR__ < 3 save_npx ();