diff options
author | Tom Tromey <tromey@redhat.com> | 2012-07-23 14:57:58 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-07-23 14:57:58 +0000 |
commit | 64c311498e46cef6b70aa88577e7d7c382e0f7cc (patch) | |
tree | fabf22b710c731e652b80893b1b133a3b1247e40 /gdb/gdb_bfd.c | |
parent | 520b0001c16bc59223bec1369d056787c1883f10 (diff) | |
download | gdb-64c311498e46cef6b70aa88577e7d7c382e0f7cc.zip gdb-64c311498e46cef6b70aa88577e7d7c382e0f7cc.tar.gz gdb-64c311498e46cef6b70aa88577e7d7c382e0f7cc.tar.bz2 |
* cli/cli-dump.c (bfd_openr_with_cleanup): Use gdb_bfd_openr.
(bfd_openw_with_cleanup): Use gdb_bfd_openw.
* corelow.c (core_open): Use gdb_bfd_fopen.
* dsrec.c (load_srec): Use gdb_bfd_openr.
* exec.c (exec_file_attach): Use gdb_bfd_fopen.
* gcore.c (gcore_memory_sections): Use gdb_bfd_openw.
* gdb_bfd.c (gdb_bfd_fopen, gdb_bfd_openr, gdb_bfd_openw)
(gdb_bfd_openr_iovec, gdb_bfd_openr_next_archived_file)
(gdb_bfd_fdopenr): New functions.
* gdb_bfd.h (gdb_bfd_fopen, gdb_bfd_openr, gdb_bfd_openw)
(gdb_bfd_openr_iovec, gdb_bfd_openr_next_archived_file)
(gdb_bfd_fdopenr): Declare.
* jit.c (bfd_open_from_target_memory): Use gdb_bfd_openr_iovec.
* m32-rom.c (m32r_load, m32r_upload_command): Use gdb_bfd_openr.
* machoread.c (macho_symfile_read_all_oso): Use gdb_bfd_openr,
gdb_bfd_openr_next_archived_file.
(macho_check_dsym): Use gdb_bfd_openr.
(macho_add_oso_symfile): Don't call gdb_bfd_stash_filename.
* procfs.c (insert_dbx_link_bpt_in_file): Use gdb_bfd_fdopenr.
* remote-m32r-sdi.c (m32r_load): Use gdb_bfd_openr.
* remote-mips.c (mips_load_srec, pmon_load_fast): Use
gdb_bfd_openr.
* remote.c (remote_bfd_open): Use gdb_bfd_openr_iovec.
* rs6000-nat.c (add_vmap): Use gdb_bfd_openr, gdb_bfd_fdopenr,
gdb_bfd_openr_next_archived_file.
* solib-darwin.c (darwin_solib_get_all_image_info_addr_at_init):
Use gdb_bfd_openr.
* solib-pa64.c (pa64_solib_create_inferior_hook): Use
gdb_bfd_openr.
* solib-spu.c (spu_bfd_fopen): Use gdb_bfd_openr_iovec.
* solib.c (solib_bfd_fopen): Use gdb_bfd_fopen.
* spu-linux-nat.c (spu_bfd_open): Use gdb_bfd_openr_iovec.
* symfile.c (bfd_open_maybe_remote): Use gdb_bfd_openr.
(symfile_bfd_open): Use gdb_bfd_fopen.
(generic_load): Use gdb_bfd_openr.
* windows-nat.c (windows_make_so): Use gdb_bfd_openr.
Diffstat (limited to 'gdb/gdb_bfd.c')
-rw-r--r-- | gdb/gdb_bfd.c | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c index dd6eac3..095d0f3 100644 --- a/gdb/gdb_bfd.c +++ b/gdb/gdb_bfd.c @@ -481,3 +481,117 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size) *size = descriptor->size; return descriptor->data; } + + + +/* See gdb_bfd.h. */ + +bfd * +gdb_bfd_fopen (const char *filename, const char *target, const char *mode, + int fd) +{ + bfd *result = bfd_fopen (filename, target, mode, fd); + + if (result) + { + gdb_bfd_stash_filename (result); + gdb_bfd_ref (result); + } + + return result; +} + +/* See gdb_bfd.h. */ + +bfd * +gdb_bfd_openr (const char *filename, const char *target) +{ + bfd *result = bfd_openr (filename, target); + + if (result) + { + gdb_bfd_stash_filename (result); + gdb_bfd_ref (result); + } + + return result; +} + +/* See gdb_bfd.h. */ + +bfd * +gdb_bfd_openw (const char *filename, const char *target) +{ + bfd *result = bfd_openw (filename, target); + + if (result) + { + gdb_bfd_stash_filename (result); + gdb_bfd_ref (result); + } + + return result; +} + +/* See gdb_bfd.h. */ + +bfd * +gdb_bfd_openr_iovec (const char *filename, const char *target, + void *(*open_func) (struct bfd *nbfd, + void *open_closure), + void *open_closure, + file_ptr (*pread_func) (struct bfd *nbfd, + void *stream, + void *buf, + file_ptr nbytes, + file_ptr offset), + int (*close_func) (struct bfd *nbfd, + void *stream), + int (*stat_func) (struct bfd *abfd, + void *stream, + struct stat *sb)) +{ + bfd *result = bfd_openr_iovec (filename, target, + open_func, open_closure, + pread_func, close_func, stat_func); + + if (result) + { + gdb_bfd_ref (result); + gdb_bfd_stash_filename (result); + } + + return result; +} + +/* See gdb_bfd.h. */ + +bfd * +gdb_bfd_openr_next_archived_file (bfd *archive, bfd *previous) +{ + bfd *result = bfd_openr_next_archived_file (archive, previous); + + if (result) + { + gdb_bfd_ref (result); + /* No need to stash the filename here. */ + } + + return result; +} + +/* See gdb_bfd.h. */ + +bfd * +gdb_bfd_fdopenr (const char *filename, const char *target, int fd) +{ + bfd *result = bfd_fdopenr (filename, target, fd); + + if (result) + { + gdb_bfd_ref (result); + gdb_bfd_stash_filename (result); + } + + return result; +} |