This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 6/8] Replace hardwired error handler in go32_create_inferior
- From: Gary Benson <gbenson at redhat dot com>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 8 Aug 2014 12:38:42 +0100
- Subject: Re: [PATCH 6/8] Replace hardwired error handler in go32_create_inferior
- Authentication-results: sourceware.org; auth=none
- References: <1407319948-2264-1-git-send-email-gbenson at redhat dot com> <1407319948-2264-7-git-send-email-gbenson at redhat dot com> <838un1pn8s dot fsf at gnu dot org>
Eli Zaretskii wrote:
> > From: Gary Benson <gbenson@redhat.com>
> > Date: Wed, 6 Aug 2014 11:12:26 +0100
> >
> > 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.
>
> AFAIR, it's actually the other way around: the example in the
> documentation was copy-pasted from GDB, bit never mind.
>
> > This commit replaces the hardwired handler with a call to error.
>
> Thanks, but...
>
> > - 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);
>
> ...the last test is inverted: v2loadimage returns zero if it
> succeeds, not if it fails (see also the old code).
>
> OK with that change.
Thanks Eli. I've updated my tree to "if (result != 0) error".
I won't mail an updated patch unless anyone wants one.
Cheers,
Gary
--
http://gbenson.net/