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]

[patch 2/3 ppc64] Provide new sym_read parameter ADDRS


Hi,

elf_symfile_read needs in [patch 3/3] to access the original (backlink)
objfile for a new separate debug info file and best even the already prepared
section_addr_info from the caller symbol_file_add_separate which already holds
it.  There currently was no way as OBJFILE will get its
SEPARATE_DEBUG_OBJFILE_BACKLINK assigned only after elf_symfile_read has
already finished (and read in the ELF symbols already the wrong way).

This means after reread_symbols this fix will not work.  But reread_symbols is
IMO already broken, I had a patch for it:
	[patch] Replace reread_symbols by load+free calls
	http://sourceware.org/ml/gdb-patches/2009-06/msg00679.html

but that one is not checked in.  Still this pathset does not bring any
regression, it is just incomplete wrt reread_symbols.  I would rather push the
patch above (in fact removing reread_symbols at all) first if it is a concern.


Thanks,
Jan


gdb/
2011-04-04  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Provide new sym_read parameter ADDRS.
	* coffread.c (coff_symfile_read): New parameter addrs_unused.
	* dbxread.c (dbx_symfile_read): Likewise.
	(coffstab_build_psymtabs, elfstab_build_psymtabs)
	(stabsect_build_psymtabs): Update its callers.
	* elfread.c (elf_symfile_read): New parameter addrs.
	* mipsread.c (mipscoff_symfile_read): New parameter addrs_unused.
	* symfile.c (syms_from_objfile): Pass ADDRS to sym_read.
	(reread_symbols): Pass NULL as ADDRS to sym_read.
	* symfile.h (struct sym_fns) <sym_read>: New parameter addrs, extend
	the comment for it.
	* xcoffread.c (xcoff_initial_scan): New parameter addrs_unused.

--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -511,7 +511,8 @@ static bfd *symfile_bfd;
 /* Read a symbol file, after initialization by coff_symfile_init.  */
 
 static void
-coff_symfile_read (struct objfile *objfile, int symfile_flags)
+coff_symfile_read (struct objfile *objfile, int symfile_flags,
+		   struct section_addr_info *addrs_unused)
 {
   struct coff_symfile_info *info;
   struct dbx_symfile_info *dbxinfo;
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -279,7 +279,8 @@ static void dbx_symfile_init (struct objfile *);
 
 static void dbx_new_init (struct objfile *);
 
-static void dbx_symfile_read (struct objfile *, int);
+static void dbx_symfile_read (struct objfile *, int,
+			      struct section_addr_info *addrs_unused);
 
 static void dbx_symfile_finish (struct objfile *);
 
@@ -527,7 +528,8 @@ record_minimal_symbol (char *name, CORE_ADDR address, int type,
    hung off the objfile structure.  */
 
 static void
-dbx_symfile_read (struct objfile *objfile, int symfile_flags)
+dbx_symfile_read (struct objfile *objfile, int symfile_flags,
+		  struct section_addr_info *addrs_unused)
 {
   bfd *sym_bfd;
   int val;
@@ -3402,7 +3404,7 @@ coffstab_build_psymtabs (struct objfile *objfile,
       symbuf_read = 0;
     }
 
-  dbx_symfile_read (objfile, 0);
+  dbx_symfile_read (objfile, 0, NULL);
 }
 
 /* Scan and build partial symbols for an ELF symbol file.
@@ -3481,7 +3483,7 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect,
      minimal symbols, since we will have already read the ELF dynamic symbol
      table and normal symbol entries won't be in the ".stab" section; but in
      case it does, it will install them itself.  */
-  dbx_symfile_read (objfile, 0);
+  dbx_symfile_read (objfile, 0, NULL);
 
   if (back_to)
     do_cleanups (back_to);
@@ -3572,7 +3574,7 @@ stabsect_build_psymtabs (struct objfile *objfile, char *stab_name,
   /* Now, do an incremental load.  */
 
   processing_acc_compilation = 1;
-  dbx_symfile_read (objfile, 0);
+  dbx_symfile_read (objfile, 0, NULL);
 }
 
 static const struct sym_fns aout_sym_fns =
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1228,7 +1228,8 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
    capability even for files compiled without -g.  */
 
 static void
-elf_symfile_read (struct objfile *objfile, int symfile_flags)
+elf_symfile_read (struct objfile *objfile, int symfile_flags,
+		  struct section_addr_info *addrs)
 {
   bfd *abfd = objfile->obfd;
   struct elfinfo ei;
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -69,7 +69,8 @@ mipscoff_symfile_init (struct objfile *objfile)
 /* Read a symbol file from a file.  */
 
 static void
-mipscoff_symfile_read (struct objfile *objfile, int symfile_flags)
+mipscoff_symfile_read (struct objfile *objfile, int symfile_flags,
+		       struct section_addr_info *addrs_unused)
 {
   bfd *abfd = objfile->obfd;
   struct cleanup *back_to;
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1013,7 +1013,7 @@ syms_from_objfile (struct objfile *objfile,
       init_objfile_sect_indices (objfile);
     }
 
-  (*objfile->sf->sym_read) (objfile, add_flags);
+  (*objfile->sf->sym_read) (objfile, add_flags, addrs);
 
   if ((add_flags & SYMFILE_NO_READ) == 0)
     require_partial_symbols (objfile, 0);
@@ -2502,7 +2502,7 @@ reread_symbols (void)
 	  clear_complaints (&symfile_complaints, 1, 1);
 	  /* Do not set flags as this is safe and we don't want to be
              verbose.  */
-	  (*objfile->sf->sym_read) (objfile, 0);
+	  (*objfile->sf->sym_read) (objfile, 0, NULL);
 	  if ((objfile->flags & OBJF_PSYMTABS_READ) != 0)
 	    {
 	      objfile->flags &= ~OBJF_PSYMTABS_READ;
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -322,9 +322,11 @@ struct sym_fns
   /* sym_read (objfile, symfile_flags) Reads a symbol file into a psymtab
      (or possibly a symtab).  OBJFILE is the objfile struct for the
      file we are reading.  SYMFILE_FLAGS are the flags passed to
-     symbol_file_add & co.  */
+     symbol_file_add & co.  ADDRS has info about sections from the original
+     objfile if OBJFILE is a separate debug info file.  ADDRS is already
+     rebased to this OBJFILE->obfd.  In other cases ADDRS is NULL.  */
 
-  void (*sym_read) (struct objfile *, int);
+  void (*sym_read) (struct objfile *, int, struct section_addr_info *addrs);
 
   /* Read the partial symbols for an objfile.  This may be NULL, in
      which case gdb assumes that sym_read already read the partial
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -173,7 +173,8 @@ eb_complaint (int arg1)
 	     _("Mismatched .eb symbol ignored starting at symnum %d"), arg1);
 }
 
-static void xcoff_initial_scan (struct objfile *, int);
+static void xcoff_initial_scan (struct objfile *, int,
+				struct section_addr_info *addrs_unused);
 
 static void scan_xcoff_symtab (struct objfile *);
 
@@ -2916,7 +2917,8 @@ xcoff_get_toc_offset (struct objfile *objfile)
    loaded).  */
 
 static void
-xcoff_initial_scan (struct objfile *objfile, int symfile_flags)
+xcoff_initial_scan (struct objfile *objfile, int symfile_flags,
+                    struct section_addr_info *addrs_unused)
 {
   bfd *abfd;
   int val;


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