* [RFA] bfd-target.c, target_bfd_reopen, check for error
@ 2011-03-02 1:03 Michael Snyder
2011-03-02 1:26 ` Pedro Alves
0 siblings, 1 reply; 2+ messages in thread
From: Michael Snyder @ 2011-03-02 1:03 UTC (permalink / raw)
To: gdb-patches; +Cc: Pedro Alves
[-- Attachment #1: Type: text/plain, Size: 111 bytes --]
This is the only instance in which build_section_table is called
without being checked for error return.
OK?
[-- Attachment #2: reopen.txt --]
[-- Type: text/plain, Size: 893 bytes --]
2011-03-01 Michael Snyder <msnyder@vmware.com>
* bfd-target.c (target_bfd_reopen): Check for failure.
Index: bfd-target.c
===================================================================
RCS file: /cvs/src/src/gdb/bfd-target.c,v
retrieving revision 1.17
diff -u -p -u -p -r1.17 bfd-target.c
--- bfd-target.c 1 Jan 2011 15:32:57 -0000 1.17
+++ bfd-target.c 2 Mar 2011 01:00:25 -0000
@@ -85,7 +85,13 @@ target_bfd_reopen (struct bfd *bfd)
data = XZALLOC (struct target_bfd_data);
data->bfd = bfd;
- build_section_table (bfd, &data->table.sections, &data->table.sections_end);
+ if (build_section_table (bfd, &data->table.sections,
+ &data->table.sections_end))
+ {
+ xfree (data);
+ error (_("Failed to re-open '%s': %s"),
+ bfd_get_filename (bfd), bfd_errmsg (bfd_get_error ()));
+ }
t = XZALLOC (struct target_ops);
t->to_shortname = "bfd";
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFA] bfd-target.c, target_bfd_reopen, check for error
2011-03-02 1:03 [RFA] bfd-target.c, target_bfd_reopen, check for error Michael Snyder
@ 2011-03-02 1:26 ` Pedro Alves
0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2011-03-02 1:26 UTC (permalink / raw)
To: gdb-patches; +Cc: Michael Snyder
On Wednesday 02 March 2011 01:03:04, Michael Snyder wrote:
> This is the only instance in which build_section_table is called
> without being checked for error return.
>
> OK?
build_section_table actually always returns '0' (==success)...
It can throw, though currently only through an internal_error.
The correct thing to do would be to make it return void,
and change all the dead error handling to do cleanups instead
of checking build_section_table's return.
--
Pedro Alves
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-02 1:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-02 1:03 [RFA] bfd-target.c, target_bfd_reopen, check for error Michael Snyder
2011-03-02 1:26 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox