diff options
author | Tom Tromey <tom@tromey.com> | 2017-10-15 11:13:29 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-10-20 09:01:03 -0600 |
commit | 2712ce2e659f82168154d4533f53d2963ae82571 (patch) | |
tree | 99edd1b85f5c282622f27a25a5411abeb657c7ef /gdb/gdb_bfd.h | |
parent | 15763a09d4aea85fc3153d6746c040dd48565637 (diff) | |
download | binutils-2712ce2e659f82168154d4533f53d2963ae82571.zip binutils-2712ce2e659f82168154d4533f53d2963ae82571.tar.gz binutils-2712ce2e659f82168154d4533f53d2963ae82571.tar.bz2 |
Introduce new_bfd_ref
This introduces a helper function, new_bfd_ref, that calls gdb_bfd_ref
and returns a gdb_bfd_ref_ptr. Then it updates several places to use
this.
ChangeLog
2017-10-20 Tom Tromey <tom@tromey.com>
* exec.c (exec_file_attach): Use new_bfd_ref.
* symfile-mem.c (symbol_file_add_from_memory): Use new_bfd_ref.
* gdb_bfd.c (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr)
(gdb_bfd_openw, gdb_bfd_openr_iovec, gdb_bfd_fdopenr): Use
new_bfd_ref.
* gdb_bfd.h (new_bfd_ref): New function.
Diffstat (limited to 'gdb/gdb_bfd.h')
-rw-r--r-- | gdb/gdb_bfd.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/gdb_bfd.h b/gdb/gdb_bfd.h index a36d782..b1ff857 100644 --- a/gdb/gdb_bfd.h +++ b/gdb/gdb_bfd.h @@ -68,6 +68,16 @@ struct gdb_bfd_ref_policy /* A gdb::ref_ptr that has been specialized for BFD objects. */ typedef gdb::ref_ptr<struct bfd, gdb_bfd_ref_policy> gdb_bfd_ref_ptr; +/* A helper function that calls gdb_bfd_ref and returns a + gdb_bfd_ref_ptr. */ + +static inline gdb_bfd_ref_ptr +new_bfd_ref (struct bfd *abfd) +{ + gdb_bfd_ref (abfd); + return gdb_bfd_ref_ptr (abfd); +} + /* Open a read-only (FOPEN_RB) BFD given arguments like bfd_fopen. If NAME starts with TARGET_SYSROOT_PREFIX then the BFD will be opened using target fileio operations if necessary. Returns NULL |