aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-08-02 09:55:32 -0600
committerTom Tromey <tom@tromey.com>2022-08-03 13:26:58 -0600
commit98badbfdc222d1d7f346046f23a64522b88d22a0 (patch)
treea57a95b75f64a0e318e0b1bd31dd6b246e4797d8 /gdb/symfile.h
parent4d44946794e68cf79cfba467fa414a958dba2185 (diff)
downloadfsf-binutils-gdb-98badbfdc222d1d7f346046f23a64522b88d22a0.zip
fsf-binutils-gdb-98badbfdc222d1d7f346046f23a64522b88d22a0.tar.gz
fsf-binutils-gdb-98badbfdc222d1d7f346046f23a64522b88d22a0.tar.bz2
Use gdb_bfd_ref_ptr in objfile
This changes struct objfile to use a gdb_bfd_ref_ptr. In addition to removing some manual memory management, this fixes a use-after-free that was introduced by the registry rewrite series. The issue there was that, in some cases, registry shutdown could refer to memory that had already been freed. This help fix the bug by delaying the destruction of the BFD reference (and thus the per-bfd object) until after the registry has been shut down.
Diffstat (limited to 'gdb/symfile.h')
-rw-r--r--gdb/symfile.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 5216e85..1d13e82 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -233,12 +233,13 @@ extern void add_filename_language (const char *ext, enum language lang);
extern struct objfile *symbol_file_add (const char *, symfile_add_flags,
section_addr_info *, objfile_flags);
-extern struct objfile *symbol_file_add_from_bfd (bfd *, const char *, symfile_add_flags,
+extern struct objfile *symbol_file_add_from_bfd (const gdb_bfd_ref_ptr &,
+ const char *, symfile_add_flags,
section_addr_info *,
objfile_flags, struct objfile *parent);
-extern void symbol_file_add_separate (bfd *, const char *, symfile_add_flags,
- struct objfile *);
+extern void symbol_file_add_separate (const gdb_bfd_ref_ptr &, const char *,
+ symfile_add_flags, struct objfile *);
extern std::string find_separate_debug_file_by_debuglink (struct objfile *);