diff options
author | Pedro Alves <palves@redhat.com> | 2010-04-14 17:26:11 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2010-04-14 17:26:11 +0000 |
commit | 516ba659387ce98c4ff28b88a7f00f5003cac9eb (patch) | |
tree | c896f42701f1bd92109ca4e91a8ad59c2077374d /gdb/objfiles.c | |
parent | 048d532d6e774418e2e7b40b645b4c249f636aa4 (diff) | |
download | gdb-516ba659387ce98c4ff28b88a7f00f5003cac9eb.zip gdb-516ba659387ce98c4ff28b88a7f00f5003cac9eb.tar.gz gdb-516ba659387ce98c4ff28b88a7f00f5003cac9eb.tar.bz2 |
* objfiles.h (gdb_bfd_close_or_warn): Declare.
* objfiles.c (gdb_bfd_close_or_warn): New.
* corelow.c: Include objfiles.h
(core_close): Use gdb_bfd_close_or_warn.
* elfread.c (build_id_verify): Ditto.
* exec.c (exec_close, exec_close_1): Ditto.
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r-- | gdb/objfiles.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 82ef45c..5be5c6a 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -1471,6 +1471,23 @@ objfiles_changed (void) get_objfile_pspace_data (current_program_space)->objfiles_changed_p = 1; } +/* Close ABFD, and warn if that fails. */ + +int +gdb_bfd_close_or_warn (struct bfd *abfd) +{ + int ret; + char *name = bfd_get_filename (abfd); + + ret = bfd_close (abfd); + + if (!ret) + warning (_("cannot close \"%s\": %s"), + name, bfd_errmsg (bfd_get_error ())); + + return ret; +} + /* Add reference to ABFD. Returns ABFD. */ struct bfd * gdb_bfd_ref (struct bfd *abfd) @@ -1519,9 +1536,7 @@ gdb_bfd_unref (struct bfd *abfd) bfd_usrdata (abfd) = NULL; /* Paranoia. */ name = bfd_get_filename (abfd); - if (!bfd_close (abfd)) - warning (_("cannot close \"%s\": %s"), - name, bfd_errmsg (bfd_get_error ())); + gdb_bfd_close_or_warn (abfd); xfree (name); } |