This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: handle "MiniDebuginfo" section


>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> I disagree with artificially making this ELF only.  What you find
Pedro> stuffed in a .gnu_debugdata section is just another file that
Pedro> would otherwise be loadable by gdb if it was separate on the
Pedro> filesystem.  IOW, stuffing the file as compressed binary blob
Pedro> into .gnu_debugdata is just a replacement for making the file
Pedro> really separate on the file system.  There's really nothing
Pedro> container-specific (coff/elf,whatnot) in this.

What if we require the contents to have the same BFD flavour as the
container?  Like the appended.  I think this might address Doug's
critique -- not sure -- while retaining both some flexibility and some
sanity.

Really, though, nobody is going to use this outside of ELF.
I think it mildly unlikely, though not impossible, that any distros
outside the Fedora universe will even pick it up.

Tom

diff --git a/gdb/minidebug.c b/gdb/minidebug.c
index 8e1362f..1b75ead 100644
--- a/gdb/minidebug.c
+++ b/gdb/minidebug.c
@@ -259,6 +259,9 @@ find_separate_debug_file_in_section (struct objfile *objfile)
   asection *section;
   bfd *abfd;
 
+  if (objfile->obfd == NULL)
+    return NULL;
+
   section = bfd_get_section_by_name (objfile->obfd, ".gnu_debugdata");
   if (section == NULL)
     return NULL;
@@ -271,6 +274,14 @@ find_separate_debug_file_in_section (struct objfile *objfile)
 
   if (!bfd_check_format (abfd, bfd_object))
     {
+      warning (_("Cannot parse .gnu_debugdata section; not a BFD object"));
+      gdb_bfd_unref (abfd);
+      return NULL;
+    }
+
+  if (bfd_get_flavour (objfile->obfd) != bfd_get_flavour (abfd))
+    {
+      warning (_("Cannot parse .gnu_debugdata section; wrong file format"));
       gdb_bfd_unref (abfd);
       return NULL;
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]