aboutsummaryrefslogtreecommitdiff
path: root/gdb/minidebug.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/minidebug.c')
-rw-r--r--gdb/minidebug.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/minidebug.c b/gdb/minidebug.c
index a56a822..dbf14c7 100644
--- a/gdb/minidebug.c
+++ b/gdb/minidebug.c
@@ -26,6 +26,10 @@
#ifdef HAVE_LIBLZMA
+/* We stash a reference to the .gnu_debugdata BFD on the enclosing
+ BFD. */
+static const bfd_key<gdb_bfd_ref_ptr> gnu_debug_key;
+
#include <lzma.h>
/* Allocator function for LZMA. */
@@ -269,6 +273,10 @@ find_separate_debug_file_in_section (struct objfile *objfile)
return NULL;
#ifdef HAVE_LIBLZMA
+ gdb_bfd_ref_ptr *shared = gnu_debug_key.get (objfile->obfd);
+ if (shared != nullptr)
+ return *shared;
+
std::string filename = string_printf (_(".gnu_debugdata for %s"),
objfile_name (objfile));
@@ -282,6 +290,9 @@ find_separate_debug_file_in_section (struct objfile *objfile)
warning (_("Cannot parse .gnu_debugdata section; not a BFD object"));
return NULL;
}
+
+ gnu_debug_key.emplace (objfile->obfd, abfd);
+
#else
warning (_("Cannot parse .gnu_debugdata section; LZMA support was "
"disabled at compile time"));