This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] bfd-target.c, target_bfd_reopen, check for error
- From: Michael Snyder <msnyder at vmware dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Cc: Pedro Alves <pedro at codesourcery dot com>
- Date: Tue, 01 Mar 2011 17:03:04 -0800
- Subject: [RFA] bfd-target.c, target_bfd_reopen, check for error
This is the only instance in which build_section_table is called
without being checked for error return.
OK?
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";