diff options
author | Tom Tromey <tom@tromey.com> | 2022-08-02 09:55:32 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-08-03 13:26:58 -0600 |
commit | 98badbfdc222d1d7f346046f23a64522b88d22a0 (patch) | |
tree | a57a95b75f64a0e318e0b1bd31dd6b246e4797d8 /gdb/stap-probe.c | |
parent | 4d44946794e68cf79cfba467fa414a958dba2185 (diff) | |
download | binutils-98badbfdc222d1d7f346046f23a64522b88d22a0.zip binutils-98badbfdc222d1d7f346046f23a64522b88d22a0.tar.gz binutils-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/stap-probe.c')
-rw-r--r-- | gdb/stap-probe.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c index 8488ddb..2b3eb37 100644 --- a/gdb/stap-probe.c +++ b/gdb/stap-probe.c @@ -1566,7 +1566,7 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el, std::vector<std::unique_ptr<probe>> *probesp, CORE_ADDR base) { - bfd *abfd = objfile->obfd; + bfd *abfd = objfile->obfd.get (); int size = bfd_get_arch_size (abfd) / 8; struct gdbarch *gdbarch = objfile->arch (); struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr; @@ -1678,7 +1678,7 @@ stap_static_probe_ops::get_probes SystemTap probe's information. We basically have to count how many probes the objfile has, and then fill in the necessary information for each one. */ - bfd *obfd = objfile->obfd; + bfd *obfd = objfile->obfd.get (); bfd_vma base; struct sdt_note *iter; unsigned save_probesp_len = probesp->size (); |