diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2019-06-21 14:10:57 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2019-06-21 14:11:13 -0400 |
commit | fb1eb2f94a62813ab3daa34da59c035717ffb9da (patch) | |
tree | 56fad8e196e3e57f5f773d5a6e035676806f748c | |
parent | 51ac9db596ea9f0affa9f7db25bb179cf70beac4 (diff) | |
download | fsf-binutils-gdb-fb1eb2f94a62813ab3daa34da59c035717ffb9da.zip fsf-binutils-gdb-fb1eb2f94a62813ab3daa34da59c035717ffb9da.tar.gz fsf-binutils-gdb-fb1eb2f94a62813ab3daa34da59c035717ffb9da.tar.bz2 |
dwarf2read: Make dwo_file::dbfd a gdb_bfd_ref_ptr
This removes the manual call to gdb_bfd_ref in favor of gdb_bfd_ref_ptr.
gdb/ChangeLog:
* dwarf2read.c (struct dwo_file) <dbfd>: Change type to
gdb_bfd_ref_ptr.
<~dwo_file>: Remove call to gdb_bfd_unref.
(open_and_init_dwo_file): Move gdb_bfd_ref_ptr into dbfd field. Call
gdb_bfd_ref_ptr::get.
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 10 |
2 files changed, 12 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ef3ddbc..c17ca42 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2019-06-21 Simon Marchi <simon.marchi@polymtl.ca> + * dwarf2read.c (struct dwo_file) <dbfd>: Change type to + gdb_bfd_ref_ptr. + <~dwo_file>: Remove call to gdb_bfd_unref. + (open_and_init_dwo_file): Move gdb_bfd_ref_ptr into dbfd field. Call + gdb_bfd_ref_ptr::get. + +2019-06-21 Simon Marchi <simon.marchi@polymtl.ca> + * dwarf2read.h (struct dwarf2_per_objfile) <dwo_files>: Change type to htab_up. * dwarf2read.c (struct dwo_file): Initialize fields. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index c73ab63..05c8720 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -708,8 +708,6 @@ struct dwo_file ~dwo_file () { - gdb_bfd_unref (dbfd); - VEC_free (dwarf2_section_info_def, sections.types); } @@ -724,7 +722,7 @@ struct dwo_file /* The bfd, when the file is open. Otherwise this is NULL. This is unused(NULL) for virtual DWO files where we use dwp_file.dbfd. */ - bfd *dbfd = nullptr; + gdb_bfd_ref_ptr dbfd; /* The sections that make up this DWO file. Remember that for virtual DWO files in DWP V2, these are virtual @@ -12960,7 +12958,7 @@ open_and_init_dwo_file (struct dwarf2_per_cu_data *per_cu, { struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile; - gdb_bfd_ref_ptr dbfd (open_dwo_file (dwarf2_per_objfile, dwo_name, comp_dir)); + gdb_bfd_ref_ptr dbfd = open_dwo_file (dwarf2_per_objfile, dwo_name, comp_dir); if (dbfd == NULL) { if (dwarf_read_debug) @@ -12971,9 +12969,9 @@ open_and_init_dwo_file (struct dwarf2_per_cu_data *per_cu, dwo_file_up dwo_file (new struct dwo_file); dwo_file->dwo_name = dwo_name; dwo_file->comp_dir = comp_dir; - dwo_file->dbfd = dbfd.release (); + dwo_file->dbfd = std::move (dbfd); - bfd_map_over_sections (dwo_file->dbfd, dwarf2_locate_dwo_sections, + bfd_map_over_sections (dwo_file->dbfd.get (), dwarf2_locate_dwo_sections, &dwo_file->sections); create_cus_hash_table (dwarf2_per_objfile, *dwo_file, dwo_file->sections.info, |