Use a distinguishing name for minidebug objfile
authorTom Tromey <tom@tromey.com>
Tue, 14 Jun 2016 11:46:56 +0000 (12:46 +0100)
committerTom Tromey <tom@tromey.com>
Wed, 16 May 2018 17:15:25 +0000 (11:15 -0600)
One part of PR cli/19551 is that the mini debug info objfile reuses the
name of the main objfile from which it comes.  This can be seen because
gdb claims to be reading symbols from the same file two times, like:

Reading symbols from /bin/gdb...Reading symbols from /bin/gdb...(no debugging symbols found)...done.

I think this would be less confusing if the minidebug objfile were given
a different name.  That is what this patch implements.  It also arranges
for the minidebug objfile to be marked OBJF_NOT_FILENAME.

After this patch the output looks like:

Reading symbols from /bin/gdb...Reading symbols from .gnu_debugdata for /usr/libexec/gdb...(no debugging symbols found)...done.

Tested by the buildbot.

gdb/ChangeLog
2018-05-16  Tom Tromey  <tom@tromey.com>

PR cli/19551:
* symfile-add-flags.h (enum symfile_add_flags)
<SYMFILE_NOT_FILENAME>: New constant.
* symfile.c (read_symbols): Use SYMFILE_NOT_FILENAME.  Get
objfile name from BFD.
(symbol_file_add_with_addrs): Check SYMFILE_NOT_FILENAME.
* minidebug.c (find_separate_debug_file_in_section): Put
".gnu_debugdata" into BFD's file name.

gdb/ChangeLog
gdb/minidebug.c
gdb/symfile-add-flags.h
gdb/symfile.c

index 3e0c53daa236105b4b013d2a5be0668c6a96e809..65b9098bd303fbf80ed1d9fc3d002c04b3b511c1 100644 (file)
@@ -1,3 +1,14 @@
+2018-05-16  Tom Tromey  <tom@tromey.com>
+
+       PR cli/19551:
+       * symfile-add-flags.h (enum symfile_add_flags)
+       <SYMFILE_NOT_FILENAME>: New constant.
+       * symfile.c (read_symbols): Use SYMFILE_NOT_FILENAME.  Get
+       objfile name from BFD.
+       (symbol_file_add_with_addrs): Check SYMFILE_NOT_FILENAME.
+       * minidebug.c (find_separate_debug_file_in_section): Put
+       ".gnu_debugdata" into BFD's file name.
+
 2018-05-16  Simon Marchi  <simon.marchi@ericsson.com>
 
        * regcache.c (regcache_read_ftype, regcache_write_ftype):
index 693c715d25e8123a1d50d32e54ba47da7e549d75..e21353df3e1ba7f3e5080ab8544c56802fd613d3 100644 (file)
@@ -269,7 +269,10 @@ find_separate_debug_file_in_section (struct objfile *objfile)
     return NULL;
 
 #ifdef HAVE_LIBLZMA
-  abfd = gdb_bfd_openr_iovec (objfile_name (objfile), gnutarget, lzma_open,
+  std::string filename = string_printf (_(".gnu_debugdata for %s"),
+                                       objfile_name (objfile));
+
+  abfd = gdb_bfd_openr_iovec (filename.c_str (), gnutarget, lzma_open,
                              section, lzma_pread, lzma_close, lzma_stat);
   if (abfd == NULL)
     return NULL;
index f07ba7924b45de9886fe196df4b1f2f7cf9bc7bd..3c07513e395e0e8795a25c40d7b408b477e382bf 100644 (file)
@@ -40,8 +40,11 @@ enum symfile_add_flag
 
     /* Do not immediately read symbols for this file.  By default,
        symbols are read when the objfile is created.  */
-    SYMFILE_NO_READ = 1 << 4
-  };
+    SYMFILE_NO_READ = 1 << 4,
+
+    /* The new objfile should be marked OBJF_NOT_FILENAME.  */
+    SYMFILE_NOT_FILENAME = 1 << 5,
+ };
 
 DEF_ENUM_FLAGS_TYPE (enum symfile_add_flag, symfile_add_flags);
 
index b0a5f118346673fdec0108446725d544232460c6..1f5d761877558f3d590888ce3a518612ce054e5b 100644 (file)
@@ -808,8 +808,9 @@ read_symbols (struct objfile *objfile, symfile_add_flags add_flags)
             virtual section-as-bfd like the bfd filename containing the
             section.  Therefore use also non-canonical name form for the same
             file containing the section.  */
-         symbol_file_add_separate (abfd.get (), objfile->original_name,
-                                   add_flags, objfile);
+         symbol_file_add_separate (abfd.get (),
+                                   bfd_get_filename (abfd.get ()),
+                                   add_flags | SYMFILE_NOT_FILENAME, objfile);
        }
     }
   if ((add_flags & SYMFILE_NO_READ) == 0)
@@ -1079,6 +1080,8 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name,
       flags |= OBJF_READNEVER;
       add_flags |= SYMFILE_NO_READ;
     }
+  if ((add_flags & SYMFILE_NOT_FILENAME) != 0)
+    flags |= OBJF_NOT_FILENAME;
 
   /* Give user a chance to burp if we'd be
      interactively wiping out any existing symbols.  */
This page took 0.029745 seconds and 4 git commands to generate.