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: RFC: remove partial_symtab::objfile


>>>>> "Yao" == Tom Tromey <tromey@redhat.com> writes:

Yao> Why write in this way? to reduce the length of patch? or some other reason?

Tom> Yeah, just to avoid reformatting.
Tom> I will rearrange it.

Here is what I am checking in.

Tom

2012-11-28  Tom Tromey  <tromey@redhat.com>

	* dbxread.c (read_dbx_symtab): Update.
	(end_psymtab, dbx_psymtab_to_symtab_1, dbx_psymtab_to_symtab)
	(read_ofile_symtab): Add 'objfile' argument.
	* dwarf2read.c (process_psymtab_comp_unit_reader)
	(build_type_psymtabs_reader): Update.
	(dwarf2_psymtab_to_symtab): Add 'objfile' argument.
	* mdebugread.c (mdebug_psymtab_to_symtab): Add 'objfile'
	argument.
	(parse_procedure, parse_partial_symbols): Update.
	(psymtab_to_symtab_1): Add 'objfile' argument.
	* psympriv.h (struct partial_symtab) <objfile>: Remove.
	<read_symtab>: Add 'objfile' argument.
	(sort_pst_symbols, discard_psymtab): Update.
	* psymtab.c (partial_map_expand_apply): Update.
	(find_pc_sect_psymtab_closer): Add 'objfile' argument.
	(find_pc_sect_psymtab, find_pc_sect_symtab_from_partial): Update.
	(find_pc_sect_psymbol): Add 'objfile' argument.
	(lookup_symbol_aux_psymtabs): Update.
	(match_partial_symbol, lookup_partial_symbol, psymtab_to_symtab):
	Add 'objfile' argument.
	(find_last_source_symtab_from_partial, dump_psymtab)
	(dump_psymtabs_for_objfile, read_symtabs_for_function)
	(expand_partial_symbol_tables, read_psymtabs_with_filename)
	(find_symbol_file_from_partial, map_matching_symbols_psymtab)
	(expand_symtabs_matching_via_partial): Update.
	(sort_pst_symbols): Add 'objfile' argument.
	(allocate_psymtab): Update.
	(discard_psymtab): Add 'objfile' argument.
	(maintenance_info_psymtabs, maintenance_check_symtabs): Update.
	* stabsread.h (end_psymtab): Update.
	* xcoffread.c (this_symtab_objfile): New global.
	(process_linenos, enter_line_range, xcoff_next_symbol_text):
	Update.
	(read_xcoff_symtab): Add 'objfile' argument.
	(read_symbol, read_symbol_lineno): Update.
	(xcoff_psymtab_to_symtab_1, xcoff_psymtab_to_symtab)
	(xcoff_end_psymtab): Add 'objfile' argument.
	(scan_xcoff_symtab): Update.

diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 9d0e624..f35d00c 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -255,11 +255,11 @@ static int bincls_allocated;
 
 extern void _initialize_dbxread (void);
 
-static void read_ofile_symtab (struct partial_symtab *);
+static void read_ofile_symtab (struct objfile *, struct partial_symtab *);
 
-static void dbx_psymtab_to_symtab (struct partial_symtab *);
+static void dbx_psymtab_to_symtab (struct objfile *, struct partial_symtab *);
 
-static void dbx_psymtab_to_symtab_1 (struct partial_symtab *);
+static void dbx_psymtab_to_symtab_1 (struct objfile *, struct partial_symtab *);
 
 static void read_dbx_dynamic_symtab (struct objfile *objfile);
 
@@ -1379,8 +1379,8 @@ read_dbx_symtab (struct objfile *objfile)
 		     which are not the address.  */
 		  && nlist.n_value >= pst->textlow)
 		{
-		  end_psymtab (pst, psymtab_include_list, includes_used,
-			       symnum * symbol_size,
+		  end_psymtab (objfile, pst, psymtab_include_list,
+			       includes_used, symnum * symbol_size,
 			       nlist.n_value > pst->texthigh
 			       ? nlist.n_value : pst->texthigh,
 			       dependency_list, dependencies_used,
@@ -1498,8 +1498,8 @@ read_dbx_symtab (struct objfile *objfile)
 
 		if (pst)
 		  {
-		    end_psymtab (pst, psymtab_include_list, includes_used,
-				 symnum * symbol_size,
+		    end_psymtab (objfile, pst, psymtab_include_list,
+				 includes_used, symnum * symbol_size,
 				 valu > pst->texthigh ? valu : pst->texthigh,
 				 dependency_list, dependencies_used,
 				 prev_textlow_not_set);
@@ -2109,7 +2109,7 @@ read_dbx_symtab (struct objfile *objfile)
 	     follows this module.  */
 	  if (pst && gdbarch_sofun_address_maybe_missing (gdbarch))
 	    {
-	      end_psymtab (pst, psymtab_include_list, includes_used,
+	      end_psymtab (objfile, pst, psymtab_include_list, includes_used,
 			   symnum * symbol_size,
 			   (CORE_ADDR) 0, dependency_list,
 			   dependencies_used, textlow_not_set);
@@ -2172,7 +2172,7 @@ read_dbx_symtab (struct objfile *objfile)
 	 : lowest_text_address)
 	+ text_size;
 
-      end_psymtab (pst, psymtab_include_list, includes_used,
+      end_psymtab (objfile, pst, psymtab_include_list, includes_used,
 		   symnum * symbol_size,
 		   text_end > pst->texthigh ? text_end : pst->texthigh,
 		   dependency_list, dependencies_used, textlow_not_set);
@@ -2226,14 +2226,13 @@ start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow,
    FIXME:  List variables and peculiarities of same.  */
 
 struct partial_symtab *
-end_psymtab (struct partial_symtab *pst,
+end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
 	     const char **include_list, int num_includes,
 	     int capping_symbol_offset, CORE_ADDR capping_text,
 	     struct partial_symtab **dependency_list, int number_dependencies,
 	     int textlow_not_set)
 {
   int i;
-  struct objfile *objfile = pst->objfile;
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
 
   if (capping_symbol_offset != -1)
@@ -2368,7 +2367,7 @@ end_psymtab (struct partial_symtab *pst,
       subpst->read_symtab = pst->read_symtab;
     }
 
-  sort_pst_symbols (pst);
+  sort_pst_symbols (objfile, pst);
 
   if (num_includes == 0
       && number_dependencies == 0
@@ -2384,7 +2383,7 @@ end_psymtab (struct partial_symtab *pst,
          is not empty, but we don't realize that.  Fixing that without slowing
          things down might be tricky.  */
 
-      discard_psymtab (pst);
+      discard_psymtab (objfile, pst);
 
       /* Indicate that psymtab was thrown away.  */
       pst = (struct partial_symtab *) NULL;
@@ -2393,7 +2392,7 @@ end_psymtab (struct partial_symtab *pst,
 }
 
 static void
-dbx_psymtab_to_symtab_1 (struct partial_symtab *pst)
+dbx_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst)
 {
   struct cleanup *old_chain;
   int i;
@@ -2424,7 +2423,7 @@ dbx_psymtab_to_symtab_1 (struct partial_symtab *pst)
 	    wrap_here ("");	/* Flush output.  */
 	    gdb_flush (gdb_stdout);
 	  }
-	dbx_psymtab_to_symtab_1 (pst->dependencies[i]);
+	dbx_psymtab_to_symtab_1 (objfile, pst->dependencies[i]);
       }
 
   if (LDSYMLEN (pst))		/* Otherwise it's a dummy.  */
@@ -2437,8 +2436,8 @@ dbx_psymtab_to_symtab_1 (struct partial_symtab *pst)
       symbol_size = SYMBOL_SIZE (pst);
 
       /* Read in this file's symbols.  */
-      bfd_seek (pst->objfile->obfd, SYMBOL_OFFSET (pst), SEEK_SET);
-      read_ofile_symtab (pst);
+      bfd_seek (objfile->obfd, SYMBOL_OFFSET (pst), SEEK_SET);
+      read_ofile_symtab (objfile, pst);
 
       do_cleanups (old_chain);
     }
@@ -2450,7 +2449,7 @@ dbx_psymtab_to_symtab_1 (struct partial_symtab *pst)
    Be verbose about it if the user wants that.  */
 
 static void
-dbx_psymtab_to_symtab (struct partial_symtab *pst)
+dbx_psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
 {
   bfd *sym_bfd;
   struct cleanup *back_to = NULL;
@@ -2476,15 +2475,15 @@ dbx_psymtab_to_symtab (struct partial_symtab *pst)
 	  gdb_flush (gdb_stdout);
 	}
 
-      sym_bfd = pst->objfile->obfd;
+      sym_bfd = objfile->obfd;
 
       next_symbol_text_func = dbx_next_symbol_text;
 
-      if (DBX_STAB_SECTION (pst->objfile))
+      if (DBX_STAB_SECTION (objfile))
 	{
 	  stabs_data
-	    = symfile_relocate_debug_section (pst->objfile,
-					      DBX_STAB_SECTION (pst->objfile),
+	    = symfile_relocate_debug_section (objfile,
+					      DBX_STAB_SECTION (objfile),
 					      NULL);
 
 	  if (stabs_data)
@@ -2492,14 +2491,14 @@ dbx_psymtab_to_symtab (struct partial_symtab *pst)
 				    (void *) &stabs_data);
 	}
 
-      dbx_psymtab_to_symtab_1 (pst);
+      dbx_psymtab_to_symtab_1 (objfile, pst);
 
       if (back_to)
 	do_cleanups (back_to);
 
       /* Match with global symbols.  This only needs to be done once,
          after all of the symtabs and dependencies have been read in.   */
-      scan_file_globals (pst->objfile);
+      scan_file_globals (objfile);
 
       /* Finish up the debug error message.  */
       if (info_verbose)
@@ -2510,7 +2509,7 @@ dbx_psymtab_to_symtab (struct partial_symtab *pst)
 /* Read in a defined section of a specific object file's symbols.  */
 
 static void
-read_ofile_symtab (struct partial_symtab *pst)
+read_ofile_symtab (struct objfile *objfile, struct partial_symtab *pst)
 {
   char *namestring;
   struct external_nlist *bufp;
@@ -2518,14 +2517,12 @@ read_ofile_symtab (struct partial_symtab *pst)
   unsigned char type;
   unsigned max_symnum;
   bfd *abfd;
-  struct objfile *objfile;
   int sym_offset;		/* Offset to start of symbols to read */
   int sym_size;			/* Size of symbols to read */
   CORE_ADDR text_offset;	/* Start of text segment for symbols */
   int text_size;		/* Size of text segment for symbols */
   struct section_offsets *section_offsets;
 
-  objfile = pst->objfile;
   sym_offset = LDSYMOFF (pst);
   sym_size = LDSYMLEN (pst);
   text_offset = pst->textlow;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index f4bd7a9..05165fc 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1275,7 +1275,8 @@ static void add_partial_subprogram (struct partial_die_info *pdi,
 				    CORE_ADDR *lowpc, CORE_ADDR *highpc,
 				    int need_pc, struct dwarf2_cu *cu);
 
-static void dwarf2_psymtab_to_symtab (struct partial_symtab *);
+static void dwarf2_psymtab_to_symtab (struct objfile *,
+				      struct partial_symtab *);
 
 static void psymtab_to_symtab_1 (struct partial_symtab *);
 
@@ -4916,7 +4917,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
     (objfile->global_psymbols.list + pst->globals_offset);
   pst->n_static_syms = objfile->static_psymbols.next -
     (objfile->static_psymbols.list + pst->statics_offset);
-  sort_pst_symbols (pst);
+  sort_pst_symbols (objfile, pst);
 
   if (!VEC_empty (dwarf2_per_cu_ptr, cu->per_cu->s.imported_symtabs))
     {
@@ -5344,7 +5345,7 @@ build_type_psymtabs_reader (const struct die_reader_specs *reader,
     (objfile->global_psymbols.list + pst->globals_offset);
   pst->n_static_syms = objfile->static_psymbols.next -
     (objfile->static_psymbols.list + pst->statics_offset);
-  sort_pst_symbols (pst);
+  sort_pst_symbols (objfile, pst);
 }
 
 /* Traversal function for build_type_psymtabs.  */
@@ -6345,7 +6346,7 @@ locate_pdi_sibling (const struct die_reader_specs *reader,
 /* Expand this partial symbol table into a full symbol table.  */
 
 static void
-dwarf2_psymtab_to_symtab (struct partial_symtab *pst)
+dwarf2_psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
 {
   if (pst != NULL)
     {
@@ -6364,17 +6365,16 @@ dwarf2_psymtab_to_symtab (struct partial_symtab *pst)
 	    }
 
 	  /* Restore our global data.  */
-	  dwarf2_per_objfile = objfile_data (pst->objfile,
-					     dwarf2_objfile_data_key);
+	  dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key);
 
 	  /* If this psymtab is constructed from a debug-only objfile, the
 	     has_section_at_zero flag will not necessarily be correct.  We
 	     can get the correct value for this flag by looking at the data
 	     associated with the (presumably stripped) associated objfile.  */
-	  if (pst->objfile->separate_debug_objfile_backlink)
+	  if (objfile->separate_debug_objfile_backlink)
 	    {
 	      struct dwarf2_per_objfile *dpo_backlink
-	        = objfile_data (pst->objfile->separate_debug_objfile_backlink,
+	        = objfile_data (objfile->separate_debug_objfile_backlink,
 		                dwarf2_objfile_data_key);
 
 	      dwarf2_per_objfile->has_section_at_zero
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index d1b9177..0dc267e 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -255,7 +255,8 @@ static void sort_blocks (struct symtab *);
 
 static struct partial_symtab *new_psymtab (char *, struct objfile *);
 
-static void psymtab_to_symtab_1 (struct partial_symtab *, const char *);
+static void psymtab_to_symtab_1 (struct objfile *objfile,
+				 struct partial_symtab *, const char *);
 
 static void add_block (struct block *, struct symtab *);
 
@@ -276,7 +277,7 @@ static char *mdebug_next_symbol_text (struct objfile *);
    and reorders the symtab list at the end.  */
 
 static void
-mdebug_psymtab_to_symtab (struct partial_symtab *pst)
+mdebug_psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
 {
   if (!pst)
     return;
@@ -289,11 +290,11 @@ mdebug_psymtab_to_symtab (struct partial_symtab *pst)
 
   next_symbol_text_func = mdebug_next_symbol_text;
 
-  psymtab_to_symtab_1 (pst, pst->filename);
+  psymtab_to_symtab_1 (objfile, pst, pst->filename);
 
   /* Match with global symbols.  This only needs to be done once,
      after all of the symtabs and dependencies have been read in.  */
-  scan_file_globals (pst->objfile);
+  scan_file_globals (objfile);
 
   if (info_verbose)
     printf_filtered (_("done.\n"));
@@ -2071,7 +2072,7 @@ parse_procedure (PDR *pr, struct symtab *search_symtab,
   if (processing_gcc_compilation == 0
       && found_ecoff_debugging_info == 0
       && TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (s))) == TYPE_CODE_VOID)
-    SYMBOL_TYPE (s) = objfile_type (pst->objfile)->nodebug_text_symbol;
+    SYMBOL_TYPE (s) = objfile_type (mdebugread_objfile)->nodebug_text_symbol;
 }
 
 /* Parse the external symbol ES.  Just call parse_symbol() after
@@ -3770,7 +3771,7 @@ parse_partial_symbols (struct objfile *objfile)
 
       /* Link pst to FDR.  end_psymtab returns NULL if the psymtab was
          empty and put on the free list.  */
-      fdr_to_pst[f_idx].pst = end_psymtab (save_pst,
+      fdr_to_pst[f_idx].pst = end_psymtab (objfile, save_pst,
 					psymtab_include_list, includes_used,
 					   -1, save_pst->texthigh,
 		       dependency_list, dependencies_used, textlow_not_set);
@@ -3959,7 +3960,8 @@ mdebug_next_symbol_text (struct objfile *objfile)
    The flow of control and even the memory allocation differs.  FIXME.  */
 
 static void
-psymtab_to_symtab_1 (struct partial_symtab *pst, const char *filename)
+psymtab_to_symtab_1 (struct objfile *objfile,
+		     struct partial_symtab *pst, const char *filename)
 {
   bfd_size_type external_sym_size;
   bfd_size_type external_pdr_size;
@@ -3996,7 +3998,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, const char *filename)
 	    gdb_flush (gdb_stdout);
 	  }
 	/* We only pass the filename for debug purposes.  */
-	psymtab_to_symtab_1 (pst->dependencies[i],
+	psymtab_to_symtab_1 (objfile, pst->dependencies[i],
 			     pst->dependencies[i]->filename);
       }
 
@@ -4016,7 +4018,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, const char *filename)
   external_pdr_size = debug_swap->external_pdr_size;
   swap_sym_in = debug_swap->swap_sym_in;
   swap_pdr_in = debug_swap->swap_pdr_in;
-  mdebugread_objfile = pst->objfile;
+  mdebugread_objfile = objfile;
   cur_fd = FDR_IDX (pst);
   fh = ((cur_fd == -1)
 	? (FDR *) NULL
@@ -4044,7 +4046,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, const char *filename)
 
   if (processing_gcc_compilation != 0)
     {
-      struct gdbarch *gdbarch = get_objfile_arch (pst->objfile);
+      struct gdbarch *gdbarch = get_objfile_arch (objfile);
 
       /* This symbol table contains stabs-in-ecoff entries.  */
 
@@ -4088,10 +4090,10 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, const char *filename)
 		      && *name == '\000')
 		    {
 		      valu += ANOFFSET (pst->section_offsets,
-					SECT_OFF_TEXT (pst->objfile));
+					SECT_OFF_TEXT (objfile));
 		      previous_stab_code = N_SO;
-		      st = end_symtab (valu, pst->objfile,
-				       SECT_OFF_TEXT (pst->objfile));
+		      st = end_symtab (valu, objfile,
+				       SECT_OFF_TEXT (objfile));
 		      end_stabs ();
 		      last_symtab_ended = 1;
 		    }
@@ -4099,14 +4101,14 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, const char *filename)
 		    {
 		      last_symtab_ended = 0;
 		      process_one_symbol (type_code, 0, valu, name,
-					  pst->section_offsets, pst->objfile);
+					  pst->section_offsets, objfile);
 		    }
 		}
 	      /* Similarly a hack.  */
 	      else if (name[0] == '#')
 		{
 		  process_one_symbol (N_SLINE, 0, valu, name,
-				      pst->section_offsets, pst->objfile);
+				      pst->section_offsets, objfile);
 		}
 	      if (type_code == N_FUN)
 		{
@@ -4121,7 +4123,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, const char *filename)
 		  memset (e, 0, sizeof (struct mdebug_extra_func_info));
 		  SYMBOL_DOMAIN (s) = LABEL_DOMAIN;
 		  SYMBOL_CLASS (s) = LOC_CONST;
-		  SYMBOL_TYPE (s) = objfile_type (pst->objfile)->builtin_void;
+		  SYMBOL_TYPE (s) = objfile_type (objfile)->builtin_void;
 		  SYMBOL_VALUE_BYTES (s) = (gdb_byte *) e;
 		  e->pdr.framereg = -1;
 		  add_symbol_to_list (s, &local_symbols);
@@ -4139,7 +4141,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, const char *filename)
 		{
 		  /* Handle encoded stab line number.  */
 		  valu += ANOFFSET (pst->section_offsets,
-				    SECT_OFF_TEXT (pst->objfile));
+				    SECT_OFF_TEXT (objfile));
 		  record_line (current_subfile, sh.index,
 			       gdbarch_addr_bits_remove (gdbarch, valu));
 		}
@@ -4155,8 +4157,8 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, const char *filename)
 
       if (! last_symtab_ended)
 	{
-	  st = end_symtab (pst->texthigh, pst->objfile,
-			   SECT_OFF_TEXT (pst->objfile));
+	  st = end_symtab (pst->texthigh, objfile,
+			   SECT_OFF_TEXT (objfile));
 	  end_stabs ();
 	}
 
@@ -4215,12 +4217,12 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, const char *filename)
       if (fh == 0)
 	{
 	  maxlines = 0;
-	  st = new_symtab ("unknown", 0, pst->objfile);
+	  st = new_symtab ("unknown", 0, objfile);
 	}
       else
 	{
 	  maxlines = 2 * fh->cline;
-	  st = new_symtab (pst->filename, maxlines, pst->objfile);
+	  st = new_symtab (pst->filename, maxlines, objfile);
 
 	  /* The proper language was already determined when building
 	     the psymtab, use it.  */
@@ -4263,7 +4265,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, const char *filename)
 	      c = parse_symbol (&sh,
 				debug_info->external_aux + fh->iauxBase,
 				sym_ptr, fh->fBigendian,
-				pst->section_offsets, pst->objfile);
+				pst->section_offsets, objfile);
 	      sym_ptr += c * external_sym_size;
 	    }
 
@@ -4337,7 +4339,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, const char *filename)
       ext_ptr = PST_PRIVATE (pst)->extern_tab;
       for (i = PST_PRIVATE (pst)->extern_count; --i >= 0; ext_ptr++)
 	parse_external (ext_ptr, fh->fBigendian,
-			pst->section_offsets, pst->objfile);
+			pst->section_offsets, objfile);
 
       /* If there are undefined symbols, tell the user.
          The alpha has an undefined symbol for every symbol that is
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index 16b9b83..ec9aa4a 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -96,10 +96,6 @@ struct partial_symtab
 
   const char *dirname;
 
-  /* Information about the object file from which symbols should be read.  */
-
-  struct objfile *objfile;
-
   /* Set of relocation offsets to apply to each section.  */
 
   struct section_offsets *section_offsets;
@@ -200,7 +196,7 @@ struct partial_symtab
   /* Pointer to function which will read in the symtab corresponding to
      this psymtab.  */
 
-  void (*read_symtab) (struct partial_symtab *);
+  void (*read_symtab) (struct objfile *, struct partial_symtab *);
 
   /* Information that lets read_symtab() locate the part of the symbol table
      that this psymtab corresponds to.  This information is private to the
@@ -210,7 +206,7 @@ struct partial_symtab
   void *read_symtab_private;
 };
 
-extern void sort_pst_symbols (struct partial_symtab *);
+extern void sort_pst_symbols (struct objfile *, struct partial_symtab *);
 
 /* Add any kind of symbol to a psymbol_allocation_list.  */
 
@@ -232,7 +228,7 @@ extern struct partial_symtab *start_psymtab_common (struct objfile *,
 extern struct partial_symtab *allocate_psymtab (const char *,
 						struct objfile *);
 
-extern void discard_psymtab (struct partial_symtab *);
+extern void discard_psymtab (struct objfile *, struct partial_symtab *);
 
 /* Traverse all psymtabs in one objfile.  */
 
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 93be085..d6dba3e 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -45,19 +45,22 @@ struct psymbol_bcache
   struct bcache *bcache;
 };
 
-static struct partial_symbol *match_partial_symbol (struct partial_symtab *,
+static struct partial_symbol *match_partial_symbol (struct objfile *,
+						    struct partial_symtab *,
 						    int,
 						    const char *, domain_enum,
 						    symbol_compare_ftype *,
 						    symbol_compare_ftype *);
 
-static struct partial_symbol *lookup_partial_symbol (struct partial_symtab *,
+static struct partial_symbol *lookup_partial_symbol (struct objfile *,
+						     struct partial_symtab *,
 						     const char *, int,
 						     domain_enum);
 
 static char *psymtab_to_fullname (struct partial_symtab *ps);
 
-static struct partial_symbol *find_pc_sect_psymbol (struct partial_symtab *,
+static struct partial_symbol *find_pc_sect_psymbol (struct objfile *,
+						    struct partial_symtab *,
 						    CORE_ADDR,
 						    struct obj_section *);
 
@@ -65,7 +68,8 @@ static struct partial_symbol *fixup_psymbol_section (struct partial_symbol
 						     *psym,
 						     struct objfile *objfile);
 
-static struct symtab *psymtab_to_symtab (struct partial_symtab *pst);
+static struct symtab *psymtab_to_symtab (struct objfile *objfile,
+					 struct partial_symtab *pst);
 
 /* Ensure that the partial symbols for OBJFILE have been loaded.  This
    function always returns its argument, as a convenience.  */
@@ -145,7 +149,7 @@ partial_map_expand_apply (struct objfile *objfile,
 
   /* This may expand more than one symtab, and we want to iterate over
      all of them.  */
-  psymtab_to_symtab (pst);
+  psymtab_to_symtab (objfile, pst);
 
   return iterate_over_some_symtabs (name, full_path, real_path, callback, data,
 				    objfile->symtabs, last_made);
@@ -237,11 +241,11 @@ partial_map_symtabs_matching_filename (struct objfile *objfile,
    We may find a different psymtab than PST.  See FIND_PC_SECT_PSYMTAB.  */
 
 static struct partial_symtab *
-find_pc_sect_psymtab_closer (CORE_ADDR pc, struct obj_section *section,
+find_pc_sect_psymtab_closer (struct objfile *objfile,
+			     CORE_ADDR pc, struct obj_section *section,
 			     struct partial_symtab *pst,
 			     struct minimal_symbol *msymbol)
 {
-  struct objfile *objfile = pst->objfile;
   struct partial_symtab *tpst;
   struct partial_symtab *best_pst = pst;
   CORE_ADDR best_addr = pst->textlow;
@@ -277,7 +281,7 @@ find_pc_sect_psymtab_closer (CORE_ADDR pc, struct obj_section *section,
 	     corresponding msymbol, which is not necessarily
 	     true; the debug info might be much richer than the
 	     object's symbol table.  */
-	  p = find_pc_sect_psymbol (tpst, pc, section);
+	  p = find_pc_sect_psymbol (objfile, tpst, pc, section);
 	  if (p != NULL
 	      && SYMBOL_VALUE_ADDRESS (p)
 	      == SYMBOL_VALUE_ADDRESS (msymbol))
@@ -342,7 +346,7 @@ find_pc_sect_psymtab (struct objfile *objfile, CORE_ADDR pc,
 		 corresponding msymbol, which is not necessarily
 		 true; the debug info might be much richer than the
 		 object's symbol table.  */
-	      p = find_pc_sect_psymbol (pst, pc, section);
+	      p = find_pc_sect_psymbol (objfile, pst, pc, section);
 	      if (!p
 		  || SYMBOL_VALUE_ADDRESS (p)
 		  != SYMBOL_VALUE_ADDRESS (msymbol))
@@ -376,7 +380,8 @@ find_pc_sect_psymtab (struct objfile *objfile, CORE_ADDR pc,
       {
 	struct partial_symtab *best_pst;
 
-	best_pst = find_pc_sect_psymtab_closer (pc, section, pst, msymbol);
+	best_pst = find_pc_sect_psymtab_closer (objfile, pc, section, pst,
+						msymbol);
 	if (best_pst != NULL)
 	  return best_pst;
       }
@@ -400,8 +405,8 @@ find_pc_sect_symtab_from_partial (struct objfile *objfile,
 	   continue, so let's not.  */
 	warning (_("\
 (Internal error: pc %s in read in psymtab, but not in symtab.)\n"),
-		 paddress (get_objfile_arch (ps->objfile), pc));
-      psymtab_to_symtab (ps);
+		 paddress (get_objfile_arch (objfile), pc));
+      psymtab_to_symtab (objfile, ps);
       return ps->symtab;
     }
   return NULL;
@@ -411,7 +416,8 @@ find_pc_sect_symtab_from_partial (struct objfile *objfile,
    Return 0 if none.  */
 
 static struct partial_symbol *
-find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
+find_pc_sect_psymbol (struct objfile *objfile,
+		      struct partial_symtab *psymtab, CORE_ADDR pc,
 		      struct obj_section *section)
 {
   struct partial_symbol *best = NULL, *p, **pp;
@@ -425,8 +431,8 @@ find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
   /* Search the global symbols as well as the static symbols, so that
      find_pc_partial_function doesn't use a minimal symbol and thus
      cache a bad endaddr.  */
-  for (pp = psymtab->objfile->global_psymbols.list + psymtab->globals_offset;
-    (pp - (psymtab->objfile->global_psymbols.list + psymtab->globals_offset)
+  for (pp = objfile->global_psymbols.list + psymtab->globals_offset;
+    (pp - (objfile->global_psymbols.list + psymtab->globals_offset)
      < psymtab->n_global_syms);
        pp++)
     {
@@ -440,7 +446,7 @@ find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
 	{
 	  if (section)		/* Match on a specific section.  */
 	    {
-	      fixup_psymbol_section (p, psymtab->objfile);
+	      fixup_psymbol_section (p, objfile);
 	      if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section))
 		continue;
 	    }
@@ -449,8 +455,8 @@ find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
 	}
     }
 
-  for (pp = psymtab->objfile->static_psymbols.list + psymtab->statics_offset;
-    (pp - (psymtab->objfile->static_psymbols.list + psymtab->statics_offset)
+  for (pp = objfile->static_psymbols.list + psymtab->statics_offset;
+    (pp - (objfile->static_psymbols.list + psymtab->statics_offset)
      < psymtab->n_static_syms);
        pp++)
     {
@@ -464,7 +470,7 @@ find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
 	{
 	  if (section)		/* Match on a specific section.  */
 	    {
-	      fixup_psymbol_section (p, psymtab->objfile);
+	      fixup_psymbol_section (p, objfile);
 	      if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section))
 		continue;
 	    }
@@ -518,10 +524,11 @@ lookup_symbol_aux_psymtabs (struct objfile *objfile,
 
   ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, ps)
   {
-    if (!ps->readin && lookup_partial_symbol (ps, name, psymtab_index, domain))
+    if (!ps->readin && lookup_partial_symbol (objfile, ps, name,
+					      psymtab_index, domain))
       {
 	struct symbol *sym = NULL;
-	struct symtab *stab = psymtab_to_symtab (ps);
+	struct symtab *stab = psymtab_to_symtab (objfile, ps);
 
 	/* Some caution must be observed with overloaded functions
 	   and methods, since the psymtab will not contain any overload
@@ -558,7 +565,8 @@ lookup_symbol_aux_psymtabs (struct objfile *objfile,
    with MATCH.  Returns the symbol, if found, and otherwise NULL.  */
 
 static struct partial_symbol *
-match_partial_symbol (struct partial_symtab *pst, int global,
+match_partial_symbol (struct objfile *objfile,
+		      struct partial_symtab *pst, int global,
 		      const char *name, domain_enum domain,
 		      symbol_compare_ftype *match,
 		      symbol_compare_ftype *ordered_compare)
@@ -571,8 +579,8 @@ match_partial_symbol (struct partial_symtab *pst, int global,
   if (length == 0)
       return NULL;
   start = (global ?
-	   pst->objfile->global_psymbols.list + pst->globals_offset :
-	   pst->objfile->static_psymbols.list + pst->statics_offset);
+	   objfile->global_psymbols.list + pst->globals_offset :
+	   objfile->static_psymbols.list + pst->statics_offset);
 
   if (global && ordered_compare)  /* Can use a binary search.  */
     {
@@ -674,7 +682,8 @@ psymtab_search_name (const char *name)
    Check the global symbols if GLOBAL, the static symbols if not.  */
 
 static struct partial_symbol *
-lookup_partial_symbol (struct partial_symtab *pst, const char *name,
+lookup_partial_symbol (struct objfile *objfile,
+		       struct partial_symtab *pst, const char *name,
 		       int global, domain_enum domain)
 {
   struct partial_symbol **start, **psym;
@@ -692,8 +701,8 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name,
   search_name = psymtab_search_name (name);
   cleanup = make_cleanup (xfree, search_name);
   start = (global ?
-	   pst->objfile->global_psymbols.list + pst->globals_offset :
-	   pst->objfile->static_psymbols.list + pst->statics_offset);
+	   objfile->global_psymbols.list + pst->globals_offset :
+	   objfile->static_psymbols.list + pst->statics_offset);
 
   if (global)			/* This means we can use a binary search.  */
     {
@@ -778,7 +787,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name,
    This is fast after the first time you do it.  */
 
 static struct symtab *
-psymtab_to_symtab (struct partial_symtab *pst)
+psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
 {
   /* If it is a shared psymtab, find an unshared psymtab that includes
      it.  Any such psymtab will do.  */
@@ -794,7 +803,7 @@ psymtab_to_symtab (struct partial_symtab *pst)
     {
       struct cleanup *back_to = increment_reading_symtab ();
 
-      (*pst->read_symtab) (pst);
+      (*pst->read_symtab) (objfile, pst);
       do_cleanups (back_to);
     }
 
@@ -860,7 +869,7 @@ find_last_source_symtab_from_partial (struct objfile *ofp)
 			  "readin pst found and no symtabs."));
 	}
       else
-	return psymtab_to_symtab (cs_pst);
+	return psymtab_to_symtab (ofp, cs_pst);
     }
   return NULL;
 }
@@ -1007,7 +1016,7 @@ dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab,
     }
 
   fprintf_filtered (outfile, "  Relocate symbols by ");
-  for (i = 0; i < psymtab->objfile->num_sections; ++i)
+  for (i = 0; i < objfile->num_sections; ++i)
     {
       if (i != 0)
 	fprintf_filtered (outfile, ", ");
@@ -1088,10 +1097,6 @@ dump_psymtabs_for_objfile (struct objfile *objfile)
 			   psymtab->filename);
 	  gdb_print_host_address (psymtab, gdb_stdout);
 	  printf_filtered (", ");
-	  if (psymtab->objfile != objfile)
-	    {
-	      printf_filtered ("NOT ON CHAIN!  ");
-	    }
 	  wrap_here ("  ");
 	}
       printf_filtered ("\n\n");
@@ -1111,11 +1116,11 @@ read_symtabs_for_function (struct objfile *objfile, const char *func_name)
     if (ps->readin)
       continue;
 
-    if ((lookup_partial_symbol (ps, func_name, 1, VAR_DOMAIN)
+    if ((lookup_partial_symbol (objfile, ps, func_name, 1, VAR_DOMAIN)
 	 != NULL)
-	|| (lookup_partial_symbol (ps, func_name, 0, VAR_DOMAIN)
+	|| (lookup_partial_symbol (objfile, ps, func_name, 0, VAR_DOMAIN)
 	    != NULL))
-      psymtab_to_symtab (ps);
+      psymtab_to_symtab (objfile, ps);
   }
 }
 
@@ -1126,7 +1131,7 @@ expand_partial_symbol_tables (struct objfile *objfile)
 
   ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, psymtab)
     {
-      psymtab_to_symtab (psymtab);
+      psymtab_to_symtab (objfile, psymtab);
     }
 }
 
@@ -1142,7 +1147,7 @@ read_psymtabs_with_filename (struct objfile *objfile, const char *filename)
 	continue;
 
       if (filename_cmp (filename, p->filename) == 0)
-	psymtab_to_symtab (p);
+	psymtab_to_symtab (objfile, p);
     }
 }
 
@@ -1220,7 +1225,7 @@ find_symbol_file_from_partial (struct objfile *objfile, const char *name)
 
   ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst)
     {
-      if (lookup_partial_symbol (pst, name, 1, VAR_DOMAIN))
+      if (lookup_partial_symbol (objfile, pst, name, 1, VAR_DOMAIN))
 	return pst->filename;
     }
   return NULL;
@@ -1273,10 +1278,10 @@ map_matching_symbols_psymtab (const char *name, domain_enum namespace,
     {
       QUIT;
       if (ps->readin
-	  || match_partial_symbol (ps, global, name, namespace, match,
+	  || match_partial_symbol (objfile, ps, global, name, namespace, match,
 				   ordered_compare))
 	{
-	  struct symtab *s = psymtab_to_symtab (ps);
+	  struct symtab *s = psymtab_to_symtab (objfile, ps);
 	  struct block *block;
 
 	  if (s == NULL || !s->primary)
@@ -1414,7 +1419,7 @@ expand_symtabs_matching_via_partial
 	}
 
       if (recursively_search_psymtabs (ps, objfile, kind, name_matcher, data))
-	psymtab_to_symtab (ps);
+	psymtab_to_symtab (objfile, ps);
     }
 }
 
@@ -1461,11 +1466,11 @@ compare_psymbols (const void *s1p, const void *s2p)
 }
 
 void
-sort_pst_symbols (struct partial_symtab *pst)
+sort_pst_symbols (struct objfile *objfile, struct partial_symtab *pst)
 {
   /* Sort the global list; don't sort the static list.  */
 
-  qsort (pst->objfile->global_psymbols.list + pst->globals_offset,
+  qsort (objfile->global_psymbols.list + pst->globals_offset,
 	 pst->n_global_syms, sizeof (struct partial_symbol *),
 	 compare_psymbols);
 }
@@ -1760,7 +1765,6 @@ allocate_psymtab (const char *filename, struct objfile *objfile)
      Psymtabs are searched in most recent inserted -> least recent
      inserted order.  */
 
-  psymtab->objfile = objfile;
   psymtab->next = objfile->psymtabs;
   objfile->psymtabs = psymtab;
 
@@ -1788,7 +1792,7 @@ allocate_psymtab (const char *filename, struct objfile *objfile)
 }
 
 void
-discard_psymtab (struct partial_symtab *pst)
+discard_psymtab (struct objfile *objfile, struct partial_symtab *pst)
 {
   struct partial_symtab **prev_pst;
 
@@ -1801,15 +1805,15 @@ discard_psymtab (struct partial_symtab *pst)
 
   /* First, snip it out of the psymtab chain.  */
 
-  prev_pst = &(pst->objfile->psymtabs);
+  prev_pst = &(objfile->psymtabs);
   while ((*prev_pst) != pst)
     prev_pst = &((*prev_pst)->next);
   (*prev_pst) = pst->next;
 
   /* Next, put it on a free list for recycling.  */
 
-  pst->next = pst->objfile->free_psymtabs;
-  pst->objfile->free_psymtabs = pst;
+  pst->next = objfile->free_psymtabs;
+  objfile->free_psymtabs = pst;
 }
 
 
@@ -1922,7 +1926,7 @@ maintenance_info_psymtabs (char *regexp, int from_tty)
 	      if (psymtab->n_global_syms)
 		{
 		  printf_filtered ("(* (struct partial_symbol **) %s @ %d)\n",
-				   host_address_to_string (psymtab->objfile->global_psymbols.list
+				   host_address_to_string (objfile->global_psymbols.list
 				    + psymtab->globals_offset),
 				   psymtab->n_global_syms);
 		}
@@ -1932,7 +1936,7 @@ maintenance_info_psymtabs (char *regexp, int from_tty)
 	      if (psymtab->n_static_syms)
 		{
 		  printf_filtered ("(* (struct partial_symbol **) %s @ %d)\n",
-				   host_address_to_string (psymtab->objfile->static_psymbols.list
+				   host_address_to_string (objfile->static_psymbols.list
 				    + psymtab->statics_offset),
 				   psymtab->n_static_syms);
 		}
@@ -1985,12 +1989,12 @@ maintenance_check_symtabs (char *ignore, int from_tty)
   {
     struct gdbarch *gdbarch = get_objfile_arch (objfile);
 
-    s = psymtab_to_symtab (ps);
+    s = psymtab_to_symtab (objfile, ps);
     if (s == NULL)
       continue;
     bv = BLOCKVECTOR (s);
     b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-    psym = ps->objfile->static_psymbols.list + ps->statics_offset;
+    psym = objfile->static_psymbols.list + ps->statics_offset;
     length = ps->n_static_syms;
     while (length--)
       {
@@ -2007,7 +2011,7 @@ maintenance_check_symtabs (char *ignore, int from_tty)
 	psym++;
       }
     b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-    psym = ps->objfile->global_psymbols.list + ps->globals_offset;
+    psym = objfile->global_psymbols.list + ps->globals_offset;
     length = ps->n_global_syms;
     while (length--)
       {
diff --git a/gdb/stabsread.h b/gdb/stabsread.h
index e4332bc..2bf3c46 100644
--- a/gdb/stabsread.h
+++ b/gdb/stabsread.h
@@ -161,7 +161,8 @@ struct stab_section_list
 /* Functions exported by dbxread.c.  These are not in stabsread.c because
    they are only used by some stabs readers.  */
 
-extern struct partial_symtab *end_psymtab (struct partial_symtab *pst,
+extern struct partial_symtab *end_psymtab (struct objfile *objfile,
+					   struct partial_symtab *pst,
 					   const char **include_list,
 					   int num_includes,
 					   int capping_symbol_offset,
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index e4d0861..7207504 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -224,7 +224,7 @@ static CORE_ADDR read_symbol_nvalue (int);
 static struct symbol *process_xcoff_symbol (struct coff_symbol *,
 					    struct objfile *);
 
-static void read_xcoff_symtab (struct partial_symtab *);
+static void read_xcoff_symtab (struct objfile *, struct partial_symtab *);
 
 #if 0
 static void add_stab_to_list (char *, struct pending_stabs **);
@@ -586,6 +586,9 @@ allocate_include_entry (void)
    in psymtab to symtab processing.  */
 static struct partial_symtab *this_symtab_psymtab;
 
+/* Objfile related to this_symtab_psymtab; set at the same time.  */
+static struct objfile *this_symtab_objfile;
+
 /* given the start and end addresses of a compilation unit (or a csect,
    at times) process its lines and create appropriate line vectors.  */
 
@@ -594,7 +597,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
 {
   int offset, ii;
   file_ptr max_offset =
-    ((struct coff_symfile_info *) this_symtab_psymtab->objfile
+    ((struct coff_symfile_info *) this_symtab_objfile
      ->deprecated_sym_private)->max_lineno_offset;
 
   /* subfile structure for the main compilation unit.  */
@@ -628,7 +631,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
       /* There was source with line numbers in include files.  */
 
       int linesz =
-	coff_data (this_symtab_psymtab->objfile->obfd)->local_linesz;
+	coff_data (this_symtab_objfile->obfd)->local_linesz;
       main_source_baseline = 0;
 
       for (ii = 0; ii < inclIndx; ++ii)
@@ -816,7 +819,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
 		  CORE_ADDR startaddr,	/* offsets to line table */
 		  CORE_ADDR endaddr, unsigned *firstLine)
 {
-  struct objfile *objfile = this_symtab_psymtab->objfile;
+  struct objfile *objfile = this_symtab_objfile;
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
   unsigned int curoffset;
   CORE_ADDR addr;
@@ -951,8 +954,8 @@ xcoff_next_symbol_text (struct objfile *objfile)
   char *retval;
 
   /* FIXME: is this the same as the passed arg?  */
-  if (this_symtab_psymtab)
-    objfile = this_symtab_psymtab->objfile;
+  if (this_symtab_objfile)
+    objfile = this_symtab_objfile;
 
   bfd_coff_swap_sym_in (objfile->obfd, raw_symbol, &symbol);
   if (symbol.n_zeroes)
@@ -985,9 +988,8 @@ xcoff_next_symbol_text (struct objfile *objfile)
 /* Read symbols for a given partial symbol table.  */
 
 static void
-read_xcoff_symtab (struct partial_symtab *pst)
+read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 {
-  struct objfile *objfile = pst->objfile;
   bfd *abfd = objfile->obfd;
   char *raw_auxptr;		/* Pointer to first raw aux entry for sym.  */
   char *strtbl = 
@@ -1019,6 +1021,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
   const char *last_csect_name;	/* Last seen csect's name.  */
 
   this_symtab_psymtab = pst;
+  this_symtab_objfile = objfile;
 
   /* Get the appropriate COFF "constants" related to the file we're
      handling.  */
@@ -1678,9 +1681,9 @@ read_symbol (struct internal_syment *symbol, int symno)
 {
   int nsyms
     = ((struct coff_symfile_info *)
-       this_symtab_psymtab->objfile->deprecated_sym_private)->symtbl_num_syms;
+       this_symtab_objfile->deprecated_sym_private)->symtbl_num_syms;
   char *stbl = ((struct coff_symfile_info *)
-		this_symtab_psymtab->objfile->deprecated_sym_private)->symtbl;
+		this_symtab_objfile->deprecated_sym_private)->symtbl;
 
   if (symno < 0 || symno >= nsyms)
     {
@@ -1689,7 +1692,7 @@ read_symbol (struct internal_syment *symbol, int symno)
       symbol->n_scnum = -1;
       return;
     }
-  bfd_coff_swap_sym_in (this_symtab_psymtab->objfile->obfd,
+  bfd_coff_swap_sym_in (this_symtab_objfile->obfd,
 			stbl + (symno * local_symesz),
 			symbol);
 }
@@ -1712,7 +1715,7 @@ read_symbol_nvalue (int symno)
 static int
 read_symbol_lineno (int symno)
 {
-  struct objfile *objfile = this_symtab_psymtab->objfile;
+  struct objfile *objfile = this_symtab_objfile;
   int xcoff64 = bfd_xcoff_is_xcoff64 (objfile->obfd);
 
   struct coff_symfile_info *info =
@@ -1803,10 +1806,8 @@ find_linenos (struct bfd *abfd, struct bfd_section *asect, void *vpinfo)
     info->max_lineno_offset = maxoff;
 }
 
-static void xcoff_psymtab_to_symtab_1 (struct partial_symtab *);
-
 static void
-xcoff_psymtab_to_symtab_1 (struct partial_symtab *pst)
+xcoff_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst)
 {
   struct cleanup *old_chain;
   int i;
@@ -1837,7 +1838,7 @@ xcoff_psymtab_to_symtab_1 (struct partial_symtab *pst)
 	    wrap_here ("");	/* Flush output */
 	    gdb_flush (gdb_stdout);
 	  }
-	xcoff_psymtab_to_symtab_1 (pst->dependencies[i]);
+	xcoff_psymtab_to_symtab_1 (objfile, pst->dependencies[i]);
       }
 
   if (((struct symloc *) pst->read_symtab_private)->numsyms != 0)
@@ -1847,7 +1848,7 @@ xcoff_psymtab_to_symtab_1 (struct partial_symtab *pst)
       buildsym_init ();
       old_chain = make_cleanup (really_free_pendings, 0);
 
-      read_xcoff_symtab (pst);
+      read_xcoff_symtab (objfile, pst);
 
       do_cleanups (old_chain);
     }
@@ -1855,16 +1856,12 @@ xcoff_psymtab_to_symtab_1 (struct partial_symtab *pst)
   pst->readin = 1;
 }
 
-static void xcoff_psymtab_to_symtab (struct partial_symtab *);
-
 /* Read in all of the symbols for a given psymtab for real.
    Be verbose about it if the user wants that.  */
 
 static void
-xcoff_psymtab_to_symtab (struct partial_symtab *pst)
+xcoff_psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
 {
-  bfd *sym_bfd;
-
   if (!pst)
     return;
 
@@ -1887,15 +1884,13 @@ xcoff_psymtab_to_symtab (struct partial_symtab *pst)
 	  gdb_flush (gdb_stdout);
 	}
 
-      sym_bfd = pst->objfile->obfd;
-
       next_symbol_text_func = xcoff_next_symbol_text;
 
-      xcoff_psymtab_to_symtab_1 (pst);
+      xcoff_psymtab_to_symtab_1 (objfile, pst);
 
       /* Match with global symbols.  This only needs to be done once,
          after all of the symtabs and dependencies have been read in.   */
-      scan_file_globals (pst->objfile);
+      scan_file_globals (objfile);
 
       /* Finish up the debug error message.  */
       if (info_verbose)
@@ -2050,13 +2045,13 @@ xcoff_start_psymtab (struct objfile *objfile,
    are the information for includes and dependencies.  */
 
 static struct partial_symtab *
-xcoff_end_psymtab (struct partial_symtab *pst, const char **include_list,
-		   int num_includes, int capping_symbol_number,
+xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
+		   const char **include_list, int num_includes,
+		   int capping_symbol_number,
 		   struct partial_symtab **dependency_list,
 		   int number_dependencies, int textlow_not_set)
 {
   int i;
-  struct objfile *objfile = pst->objfile;
 
   if (capping_symbol_number != -1)
     ((struct symloc *) pst->read_symtab_private)->numsyms =
@@ -2113,7 +2108,7 @@ xcoff_end_psymtab (struct partial_symtab *pst, const char **include_list,
       subpst->read_symtab = pst->read_symtab;
     }
 
-  sort_pst_symbols (pst);
+  sort_pst_symbols (objfile, pst);
 
   if (num_includes == 0
       && number_dependencies == 0
@@ -2125,7 +2120,7 @@ xcoff_end_psymtab (struct partial_symtab *pst, const char **include_list,
       /* Empty psymtabs happen as a result of header files which don't have
          any symbols in them.  There can be a lot of them.  */
 
-      discard_psymtab (pst);
+      discard_psymtab (objfile, pst);
 
       /* Indicate that psymtab was thrown away.  */
       pst = (struct partial_symtab *) NULL;
@@ -2319,8 +2314,8 @@ scan_xcoff_symtab (struct objfile *objfile)
 			       each program csect, because their text
 			       sections need not be adjacent.  */
 			    xcoff_end_psymtab
-			      (pst, psymtab_include_list, includes_used,
-			       symnum_before, dependency_list,
+			      (objfile, pst, psymtab_include_list,
+			       includes_used, symnum_before, dependency_list,
 			       dependencies_used, textlow_not_set);
 			    includes_used = 0;
 			    dependencies_used = 0;
@@ -2496,9 +2491,10 @@ scan_xcoff_symtab (struct objfile *objfile)
 
 	    if (pst)
 	      {
-		xcoff_end_psymtab (pst, psymtab_include_list, includes_used,
-				   symnum_before, dependency_list,
-				   dependencies_used, textlow_not_set);
+		xcoff_end_psymtab (objfile, pst, psymtab_include_list,
+				   includes_used, symnum_before,
+				   dependency_list, dependencies_used,
+				   textlow_not_set);
 		includes_used = 0;
 		dependencies_used = 0;
 	      }
@@ -2920,7 +2916,7 @@ scan_xcoff_symtab (struct objfile *objfile)
 
   if (pst)
     {
-      xcoff_end_psymtab (pst, psymtab_include_list, includes_used,
+      xcoff_end_psymtab (objfile, pst, psymtab_include_list, includes_used,
 			 ssymnum, dependency_list,
 			 dependencies_used, textlow_not_set);
     }


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