[RFC 5/7] introduce accessors for psymtab high and low fields

Tom Tromey tromey@redhat.com
Thu Feb 20 21:32:00 GMT 2014


This introduces accessors for the partial symbol table textlow and
texthigh fields.  This lets us later arrange to relocate these values
at their point of use.

I did this conversion by renaming the fields.  I didn't rename the
fields back afterward, thinking that on the off chance that someone
has a patch touching this area, then a merge would helpfully break
their compile.  However, I can rename back if anybody cares.

2014-02-20  Tom Tromey  <tromey@redhat.com>

	* dbxread.c (read_dbx_symtab, end_psymtab, read_ofile_symtab):
	Update.
	* dwarf2read.c (dwarf2_create_include_psymtab): Don't initialize
	textlow and texthigh fields.
	(process_psymtab_comp_unit_reader): Update.
	* mdebugread.c (parse_lines, parse_partial_symbols)
	(psymtab_to_symtab_1): Update.
	* psympriv.h (struct partial_symtab) <textlow_, texthigh_>: Rename
	fields.  Update comment.
	(PSYMTAB_TEXTLOW, PSYMTAB_TEXTHIGH, SET_PSYMTAB_TEXTLOW)
	(SET_PSYMTAB_TEXTHIGH): New macros.
	* psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymtab)
	(find_pc_sect_psymbol, relocate_psymtabs, dump_psymtab)
	(start_psymtab_common, maintenance_info_psymtabs)
	(maintenance_check_psymtabs): Update.
	* xcoffread.c (xcoff_end_psymtab): Don't initialize textlow and
	texthigh fields.
	(scan_xcoff_symtab): Update.
---
 gdb/ChangeLog    | 21 +++++++++++++++++++++
 gdb/dbxread.c    | 51 ++++++++++++++++++++++++++-------------------------
 gdb/dwarf2read.c | 10 ++++------
 gdb/mdebugread.c | 42 ++++++++++++++++++++++--------------------
 gdb/psympriv.h   | 13 ++++++++++---
 gdb/psymtab.c    | 48 ++++++++++++++++++++++++++----------------------
 gdb/xcoffread.c  | 11 +++++------
 7 files changed, 114 insertions(+), 82 deletions(-)

diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 216c86c..66c4071 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -1363,12 +1363,12 @@ read_dbx_symtab (struct objfile *objfile)
 	      if (past_first_source_file && pst
 		  /* The gould NP1 uses low values for .o and -l symbols
 		     which are not the address.  */
-		  && nlist.n_value >= pst->textlow)
+		  && nlist.n_value >= PSYMTAB_TEXTLOW (pst))
 		{
 		  end_psymtab (objfile, pst, psymtab_include_list,
 			       includes_used, symnum * symbol_size,
-			       nlist.n_value > pst->texthigh
-			       ? nlist.n_value : pst->texthigh,
+			       nlist.n_value > PSYMTAB_TEXTHIGH (pst)
+			       ? nlist.n_value : PSYMTAB_TEXTHIGH (pst),
 			       dependency_list, dependencies_used,
 			       textlow_not_set);
 		  pst = (struct partial_symtab *) 0;
@@ -1484,7 +1484,8 @@ read_dbx_symtab (struct objfile *objfile)
 		  {
 		    end_psymtab (objfile, pst, psymtab_include_list,
 				 includes_used, symnum * symbol_size,
-				 valu > pst->texthigh ? valu : pst->texthigh,
+				 (valu > PSYMTAB_TEXTHIGH (pst)
+				  ? valu : PSYMTAB_TEXTHIGH (pst)),
 				 dependency_list, dependencies_used,
 				 prev_textlow_not_set);
 		    pst = (struct partial_symtab *) 0;
@@ -1659,8 +1660,8 @@ read_dbx_symtab (struct objfile *objfile)
 		 function relative stabs, or the address of the function's
 		 end for old style stabs.  */
 	      valu = nlist.n_value + last_function_start;
-	      if (pst->texthigh == 0 || valu > pst->texthigh)
-		pst->texthigh = valu;
+	      if (PSYMTAB_TEXTHIGH (pst) == 0 || valu > PSYMTAB_TEXTHIGH (pst))
+		SET_PSYMTAB_TEXTHIGH (pst, valu);
 	      break;
 	    }
 
@@ -1883,7 +1884,7 @@ read_dbx_symtab (struct objfile *objfile)
 	      if (pst && textlow_not_set
 		  && gdbarch_sofun_address_maybe_missing (gdbarch))
 		{
-		  pst->textlow = nlist.n_value;
+		  SET_PSYMTAB_TEXTLOW (pst, nlist.n_value);
 		  textlow_not_set = 0;
 		}
 	      /* End kludge.  */
@@ -1898,12 +1899,12 @@ read_dbx_symtab (struct objfile *objfile)
 		 the partial symbol table.  */
 	      if (pst
 		  && (textlow_not_set
-		      || (nlist.n_value < pst->textlow
+		      || (nlist.n_value < PSYMTAB_TEXTLOW (pst)
 			  && (nlist.n_value
 			      != ANOFFSET (objfile->section_offsets,
 					   SECT_OFF_TEXT (objfile))))))
 		{
-		  pst->textlow = nlist.n_value;
+		  SET_PSYMTAB_TEXTLOW (pst, nlist.n_value);
 		  textlow_not_set = 0;
 		}
 	      add_psymbol_to_list (sym_name, sym_len, 1,
@@ -1953,7 +1954,7 @@ read_dbx_symtab (struct objfile *objfile)
 	      if (pst && textlow_not_set
 		  && gdbarch_sofun_address_maybe_missing (gdbarch))
 		{
-		  pst->textlow = nlist.n_value;
+		  SET_PSYMTAB_TEXTLOW (pst, nlist.n_value);
 		  textlow_not_set = 0;
 		}
 	      /* End kludge.  */
@@ -1968,12 +1969,12 @@ read_dbx_symtab (struct objfile *objfile)
 		 the partial symbol table.  */
 	      if (pst
 		  && (textlow_not_set
-		      || (nlist.n_value < pst->textlow
+		      || (nlist.n_value < PSYMTAB_TEXTLOW (pst)
 			  && (nlist.n_value
 			      != ANOFFSET (objfile->section_offsets,
 					   SECT_OFF_TEXT (objfile))))))
 		{
-		  pst->textlow = nlist.n_value;
+		  SET_PSYMTAB_TEXTLOW (pst, nlist.n_value);
 		  textlow_not_set = 0;
 		}
 	      add_psymbol_to_list (sym_name, sym_len, 1,
@@ -2158,7 +2159,8 @@ read_dbx_symtab (struct objfile *objfile)
 
       end_psymtab (objfile, pst, psymtab_include_list, includes_used,
 		   symnum * symbol_size,
-		   text_end > pst->texthigh ? text_end : pst->texthigh,
+		   (text_end > PSYMTAB_TEXTHIGH (pst)
+		    ? text_end : PSYMTAB_TEXTHIGH (pst)),
 		   dependency_list, dependencies_used, textlow_not_set);
     }
 
@@ -2220,7 +2222,7 @@ end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
 
   if (capping_symbol_offset != -1)
     LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst);
-  pst->texthigh = capping_text;
+  SET_PSYMTAB_TEXTHIGH (pst, capping_text);
 
   /* Under Solaris, the N_SO symbols always have a value of 0,
      instead of the usual address of the .o file.  Therefore,
@@ -2237,7 +2239,7 @@ end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
      a reliable texthigh by taking the address plus size of the
      last function in the file.  */
 
-  if (pst->texthigh == 0 && last_function_name
+  if (PSYMTAB_TEXTHIGH (pst) == 0 && last_function_name
       && gdbarch_sofun_address_maybe_missing (gdbarch))
     {
       char *p;
@@ -2264,8 +2266,8 @@ end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
 	}
 
       if (minsym.minsym)
-	pst->texthigh = (BMSYMBOL_VALUE_ADDRESS (minsym)
-			 + MSYMBOL_SIZE (minsym.minsym));
+	SET_PSYMTAB_TEXTHIGH (pst, (BMSYMBOL_VALUE_ADDRESS (minsym)
+				    + MSYMBOL_SIZE (minsym.minsym)));
 
       last_function_name = NULL;
     }
@@ -2274,7 +2276,7 @@ end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
     ;
   /* This test will be true if the last .o file is only data.  */
   else if (textlow_not_set)
-    pst->textlow = pst->texthigh;
+    SET_PSYMTAB_TEXTLOW (pst, PSYMTAB_TEXTHIGH (pst));
   else
     {
       struct partial_symtab *p1;
@@ -2287,8 +2289,9 @@ end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
 
       ALL_OBJFILE_PSYMTABS (objfile, p1)
       {
-	if (p1->texthigh == 0 && p1->textlow != 0 && p1 != pst)
-	  p1->texthigh = pst->textlow;
+	if (PSYMTAB_TEXTHIGH (p1) == 0 && PSYMTAB_TEXTLOW (p1) != 0
+	    && p1 != pst)
+	  SET_PSYMTAB_TEXTHIGH (p1, PSYMTAB_TEXTLOW (pst));
       }
     }
 
@@ -2323,9 +2326,7 @@ end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
       subpst->read_symtab_private =
 	obstack_alloc (&objfile->objfile_obstack, sizeof (struct symloc));
       LDSYMOFF (subpst) =
-	LDSYMLEN (subpst) =
-	subpst->textlow =
-	subpst->texthigh = 0;
+	LDSYMLEN (subpst) = 0;
 
       /* We could save slight bits of space by only making one of these,
          shared by the entire set of include files.  FIXME-someday.  */
@@ -2498,8 +2499,8 @@ read_ofile_symtab (struct objfile *objfile, struct partial_symtab *pst)
 
   sym_offset = LDSYMOFF (pst);
   sym_size = LDSYMLEN (pst);
-  text_offset = pst->textlow;
-  text_size = pst->texthigh - pst->textlow;
+  text_offset = PSYMTAB_TEXTLOW (pst);
+  text_size = PSYMTAB_TEXTHIGH (pst) - PSYMTAB_TEXTLOW (pst);
   section_offsets = pst->section_offsets;
 
   dbxread_objfile = objfile;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 019f17b..df95d04 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -4397,8 +4397,6 @@ dwarf2_create_include_psymtab (const char *name, struct partial_symtab *pst,
     }
 
   subpst->section_offsets = pst->section_offsets;
-  subpst->textlow = 0;
-  subpst->texthigh = 0;
 
   subpst->dependencies = (struct partial_symtab **)
     obstack_alloc (&objfile->objfile_obstack,
@@ -6041,8 +6039,8 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
 	  best_highpc = highpc;
 	}
     }
-  pst->textlow = best_lowpc + baseaddr;
-  pst->texthigh = best_highpc + baseaddr;
+  SET_PSYMTAB_TEXTLOW (pst, best_lowpc + baseaddr);
+  SET_PSYMTAB_TEXTHIGH (pst, best_highpc + baseaddr);
 
   pst->n_global_syms = objfile->global_psymbols.next -
     (objfile->global_psymbols.list + pst->globals_offset);
@@ -6083,8 +6081,8 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
 			  ", %d global, %d static syms\n",
 			  per_cu->is_debug_types ? "type" : "comp",
 			  per_cu->offset.sect_off,
-			  paddress (gdbarch, pst->textlow),
-			  paddress (gdbarch, pst->texthigh),
+			  paddress (gdbarch, PSYMTAB_TEXTLOW (pst)),
+			  paddress (gdbarch, PSYMTAB_TEXTHIGH (pst)),
 			  pst->n_global_syms, pst->n_static_syms);
     }
 }
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index ce180c4..b9a68c0 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -2208,7 +2208,7 @@ parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines,
 	halt = base + fh->cbLine;
       base += pr->cbLineOffset;
 
-      adr = pst->textlow + pr->adr - lowest_pdr_addr;
+      adr = PSYMTAB_TEXTLOW (pst) + pr->adr - lowest_pdr_addr;
 
       l = adr >> 2;		/* in words */
       for (lineno = pr->lnLow; base < halt;)
@@ -2695,7 +2695,7 @@ parse_partial_symbols (struct objfile *objfile)
 	psymtab_language = prev_language;
       PST_PRIVATE (pst)->pst_language = psymtab_language;
 
-      pst->texthigh = pst->textlow;
+      SET_PSYMTAB_TEXTHIGH (pst, PSYMTAB_TEXTLOW (pst));
 
       /* For stabs-in-ecoff files, the second symbol must be @stab.
          This symbol is emitted by mips-tfile to signal that the
@@ -2760,10 +2760,11 @@ parse_partial_symbols (struct objfile *objfile)
 
 			  /* Kludge for Irix 5.2 zero fh->adr.  */
 			  if (!relocatable
-			  && (pst->textlow == 0 || procaddr < pst->textlow))
-			    pst->textlow = procaddr;
-			  if (high > pst->texthigh)
-			    pst->texthigh = high;
+			      && (PSYMTAB_TEXTLOW (pst) == 0
+				  || procaddr < PSYMTAB_TEXTLOW (pst)))
+			    SET_PSYMTAB_TEXTLOW (pst, procaddr);
+			  if (high > PSYMTAB_TEXTHIGH (pst))
+			    SET_PSYMTAB_TEXTHIGH (pst, high);
 			}
 		    }
 		  else if (sh.st == stStatic)
@@ -3365,8 +3366,8 @@ parse_partial_symbols (struct objfile *objfile)
 		    continue;
 
 		  case N_RBRAC:
-		    if (sh.value > save_pst->texthigh)
-		      save_pst->texthigh = sh.value;
+		    if (sh.value > PSYMTAB_TEXTHIGH (save_pst))
+		      SET_PSYMTAB_TEXTHIGH (save_pst, sh.value);
 		    continue;
 		  case N_EINCL:
 		  case N_DSLINE:
@@ -3557,12 +3558,13 @@ parse_partial_symbols (struct objfile *objfile)
 
 		  /* Kludge for Irix 5.2 zero fh->adr.  */
 		  if (!relocatable
-		      && (pst->textlow == 0 || procaddr < pst->textlow))
-		    pst->textlow = procaddr;
+		      && (PSYMTAB_TEXTLOW (pst) == 0
+			  || procaddr < PSYMTAB_TEXTLOW (pst)))
+		    SET_PSYMTAB_TEXTLOW (pst, procaddr);
 
 		  high = procaddr + sh.value;
-		  if (high > pst->texthigh)
-		    pst->texthigh = high;
+		  if (high > PSYMTAB_TEXTHIGH (pst))
+		    SET_PSYMTAB_TEXTHIGH (pst, high);
 		  continue;
 
 		case stStatic:	/* Variable */
@@ -3739,7 +3741,7 @@ parse_partial_symbols (struct objfile *objfile)
          empty and put on the free list.  */
       fdr_to_pst[f_idx].pst = end_psymtab (objfile, save_pst,
 					psymtab_include_list, includes_used,
-					   -1, save_pst->texthigh,
+					   -1, PSYMTAB_TEXTHIGH (save_pst),
 		       dependency_list, dependencies_used, textlow_not_set);
       includes_used = 0;
       dependencies_used = 0;
@@ -3757,15 +3759,15 @@ parse_partial_symbols (struct objfile *objfile)
          other cases.  */
       save_pst = fdr_to_pst[f_idx].pst;
       if (save_pst != NULL
-	  && save_pst->textlow != 0
+	  && PSYMTAB_TEXTLOW (save_pst) != 0
 	  && !(objfile->flags & OBJF_REORDERED))
 	{
 	  ALL_OBJFILE_PSYMTABS (objfile, pst)
 	  {
 	    if (save_pst != pst
-		&& save_pst->textlow >= pst->textlow
-		&& save_pst->textlow < pst->texthigh
-		&& save_pst->texthigh > pst->texthigh)
+		&& PSYMTAB_TEXTLOW (save_pst) >= PSYMTAB_TEXTLOW (pst)
+		&& PSYMTAB_TEXTLOW (save_pst) < PSYMTAB_TEXTHIGH (pst)
+		&& PSYMTAB_TEXTHIGH (save_pst) > PSYMTAB_TEXTHIGH (pst))
 	      {
 		objfile->flags |= OBJF_REORDERED;
 		break;
@@ -3971,7 +3973,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
   /* Do nothing if this is a dummy psymtab.  */
 
   if (pst->n_global_syms == 0 && pst->n_static_syms == 0
-      && pst->textlow == 0 && pst->texthigh == 0)
+      && PSYMTAB_TEXTLOW (pst) == 0 && PSYMTAB_TEXTHIGH (pst) == 0)
     return;
 
   /* Now read the symbols for this symtab.  */
@@ -4123,7 +4125,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
 
       if (! last_symtab_ended)
 	{
-	  st = end_symtab (pst->texthigh, objfile,
+	  st = end_symtab (PSYMTAB_TEXTHIGH (pst), objfile,
 			   SECT_OFF_TEXT (objfile));
 	  end_stabs ();
 	}
@@ -4205,7 +4207,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
       top_stack->cur_st = st;
       top_stack->cur_block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (st),
 						STATIC_BLOCK);
-      BLOCK_START (top_stack->cur_block) = pst->textlow;
+      BLOCK_START (top_stack->cur_block) = PSYMTAB_TEXTLOW (pst);
       BLOCK_END (top_stack->cur_block) = 0;
       top_stack->blocktype = stFile;
       top_stack->cur_type = 0;
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index 9648ded..1824bdd 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -136,10 +136,11 @@ struct partial_symtab
 
   /* Range of text addresses covered by this file; texthigh is the
      beginning of the next section.  Do not use if PSYMTABS_ADDRMAP_SUPPORTED
-     is set.  */
+     is set.  Do not refer directly to these fields.  Instead, use the
+     accessor macros.  */
 
-  CORE_ADDR textlow;
-  CORE_ADDR texthigh;
+  CORE_ADDR textlow_;
+  CORE_ADDR texthigh_;
 
   /* If NULL, this is an ordinary partial symbol table.
 
@@ -247,6 +248,12 @@ struct partial_symtab
   (ANOFFSET ((OBJF)->section_offsets, (INDEX))			\
    + ((((OFFS) == NULL)) ? 0 : ANOFFSET ((OFFS), (INDEX))))
 
+#define PSYMTAB_TEXTLOW(PST) ((PST)->textlow_ + 0)
+#define PSYMTAB_TEXTHIGH(PST) ((PST)->texthigh_ + 0)
+
+#define SET_PSYMTAB_TEXTLOW(PST, V) (((PST)->textlow_) = (V))
+#define SET_PSYMTAB_TEXTHIGH(PST, V) (((PST)->texthigh_) = (V))
+
 extern void sort_pst_symbols (struct objfile *, struct partial_symtab *);
 
 /* Add any kind of symbol to a psymbol_allocation_list.  */
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 35f376e..4eaf05f 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -230,7 +230,7 @@ find_pc_sect_psymtab_closer (struct objfile *objfile,
 {
   struct partial_symtab *tpst;
   struct partial_symtab *best_pst = pst;
-  CORE_ADDR best_addr = pst->textlow;
+  CORE_ADDR best_addr = PSYMTAB_TEXTLOW (pst);
 
   gdb_assert (!pst->psymtabs_addrmap_supported);
 
@@ -254,7 +254,7 @@ find_pc_sect_psymtab_closer (struct objfile *objfile,
      that is closest and still less than the given PC.  */
   for (tpst = pst; tpst != NULL; tpst = tpst->next)
     {
-      if (pc >= tpst->textlow && pc < tpst->texthigh)
+      if (pc >= PSYMTAB_TEXTLOW (tpst) && pc < PSYMTAB_TEXTHIGH (tpst))
 	{
 	  struct partial_symbol *p;
 	  CORE_ADDR this_addr;
@@ -276,7 +276,7 @@ find_pc_sect_psymtab_closer (struct objfile *objfile,
 	  if (p != NULL)
 	    this_addr = PSYMBOL_VALUE_ADDRESS (objfile, p);
 	  else
-	    this_addr = tpst->textlow;
+	    this_addr = PSYMTAB_TEXTLOW (tpst);
 
 	  /* Check whether it is closer than our current
 	     BEST_ADDR.  Since this symbol address is
@@ -358,7 +358,7 @@ find_pc_sect_psymtab (struct objfile *objfile, CORE_ADDR pc,
 
   ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst)
     if (!pst->psymtabs_addrmap_supported
-	&& pc >= pst->textlow && pc < pst->texthigh)
+	&& pc >= PSYMTAB_TEXTLOW (pst) && pc < PSYMTAB_TEXTHIGH (pst))
       {
 	struct partial_symtab *best_pst;
 
@@ -408,7 +408,8 @@ find_pc_sect_psymbol (struct objfile *objfile,
   gdb_assert (psymtab != NULL);
 
   /* Cope with programs that start at address 0.  */
-  best_pc = (psymtab->textlow != 0) ? psymtab->textlow - 1 : 0;
+  best_pc = ((PSYMTAB_TEXTLOW (psymtab) != 0)
+	     ? PSYMTAB_TEXTLOW (psymtab) - 1 : 0);
 
   /* Search the global symbols as well as the static symbols, so that
      find_pc_partial_function doesn't use a minimal symbol and thus
@@ -423,7 +424,7 @@ find_pc_sect_psymbol (struct objfile *objfile,
 	  && PSYMBOL_CLASS (p) == LOC_BLOCK
 	  && pc >= PSYMBOL_VALUE_ADDRESS (objfile, p)
 	  && (PSYMBOL_VALUE_ADDRESS (objfile, p) > best_pc
-	      || (psymtab->textlow == 0
+	      || (PSYMTAB_TEXTLOW (psymtab) == 0
 		  && best_pc == 0
 		  && PSYMBOL_VALUE_ADDRESS (objfile, p) == 0)))
 	{
@@ -449,7 +450,7 @@ find_pc_sect_psymbol (struct objfile *objfile,
 	  && PSYMBOL_CLASS (p) == LOC_BLOCK
 	  && pc >= PSYMBOL_VALUE_ADDRESS (objfile, p)
 	  && (PSYMBOL_VALUE_ADDRESS (objfile, p) > best_pc
-	      || (psymtab->textlow == 0
+	      || (PSYMTAB_TEXTLOW (psymtab) == 0
 		  && best_pc == 0
 		  && PSYMBOL_VALUE_ADDRESS (objfile, p) == 0)))
 	{
@@ -795,8 +796,10 @@ relocate_psymtabs (struct objfile *objfile,
 
   ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, p)
     {
-      p->textlow += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
-      p->texthigh += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
+      SET_PSYMTAB_TEXTLOW (p, (PSYMTAB_TEXTLOW (p)
+			       + ANOFFSET (delta, SECT_OFF_TEXT (objfile))));
+      SET_PSYMTAB_TEXTHIGH (p, (PSYMTAB_TEXTHIGH (p)
+				+ ANOFFSET (delta, SECT_OFF_TEXT (objfile))));
     }
 
   for (psym = objfile->global_psymbols.list;
@@ -1010,9 +1013,9 @@ dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab,
   fprintf_filtered (outfile, "\n");
 
   fprintf_filtered (outfile, "  Symbols cover text addresses ");
-  fputs_filtered (paddress (gdbarch, psymtab->textlow), outfile);
+  fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTLOW (psymtab)), outfile);
   fprintf_filtered (outfile, "-");
-  fputs_filtered (paddress (gdbarch, psymtab->texthigh), outfile);
+  fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTHIGH (psymtab)), outfile);
   fprintf_filtered (outfile, "\n");
   fprintf_filtered (outfile, "  Address map supported - %s.\n",
 		    psymtab->psymtabs_addrmap_supported ? "yes" : "no");
@@ -1484,8 +1487,8 @@ start_psymtab_common (struct objfile *objfile,
   struct partial_symtab *psymtab;
 
   psymtab = allocate_psymtab (filename, objfile);
-  psymtab->textlow = textlow;
-  psymtab->texthigh = psymtab->textlow;		/* default */
+  SET_PSYMTAB_TEXTLOW (psymtab, textlow);
+  SET_PSYMTAB_TEXTHIGH (psymtab, textlow);		/* default */
   psymtab->globals_offset = global_syms - objfile->global_psymbols.list;
   psymtab->statics_offset = static_syms - objfile->static_psymbols.list;
   return (psymtab);
@@ -1943,10 +1946,10 @@ maintenance_info_psymtabs (char *regexp, int from_tty)
 			       psymtab->fullname
 			       ? psymtab->fullname : "(null)");
 	      printf_filtered ("    text addresses ");
-	      fputs_filtered (paddress (gdbarch, psymtab->textlow),
+	      fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTLOW (psymtab)),
 			      gdb_stdout);
 	      printf_filtered (" -- ");
-	      fputs_filtered (paddress (gdbarch, psymtab->texthigh),
+	      fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTHIGH (psymtab)),
 			      gdb_stdout);
 	      printf_filtered ("\n");
 	      printf_filtered ("    psymtabs_addrmap_supported %s\n",
@@ -2025,14 +2028,14 @@ maintenance_check_psymtabs (char *ignore, int from_tty)
     s = ps->symtab;
 
     /* First do some checks that don't require the associated symtab.  */
-    if (ps->texthigh < ps->textlow)
+    if (PSYMTAB_TEXTHIGH (ps) < PSYMTAB_TEXTLOW (ps))
       {
 	printf_filtered ("Psymtab ");
 	puts_filtered (ps->filename);
 	printf_filtered (" covers bad range ");
-	fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout);
+	fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTLOW (ps)), gdb_stdout);
 	printf_filtered (" - ");
-	fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout);
+	fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTHIGH (ps)), gdb_stdout);
 	printf_filtered ("\n");
 	continue;
       }
@@ -2075,15 +2078,16 @@ maintenance_check_psymtabs (char *ignore, int from_tty)
 	  }
 	psym++;
       }
-    if (ps->texthigh != 0
-	&& (ps->textlow < BLOCK_START (b) || ps->texthigh > BLOCK_END (b)))
+    if (PSYMTAB_TEXTHIGH (ps) != 0
+	&& (PSYMTAB_TEXTLOW (ps) < BLOCK_START (b)
+	    || PSYMTAB_TEXTHIGH (ps) > BLOCK_END (b)))
       {
 	printf_filtered ("Psymtab ");
 	puts_filtered (ps->filename);
 	printf_filtered (" covers ");
-	fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout);
+	fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTLOW (ps)), gdb_stdout);
 	printf_filtered (" - ");
-	fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout);
+	fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTHIGH (ps)), gdb_stdout);
 	printf_filtered (" but symtab covers only ");
 	fputs_filtered (paddress (gdbarch, BLOCK_START (b)), gdb_stdout);
 	printf_filtered (" - ");
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 261fc7b..13b4284 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -2096,8 +2096,6 @@ xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
 						   sizeof (struct symloc));
       ((struct symloc *) subpst->read_symtab_private)->first_symnum = 0;
       ((struct symloc *) subpst->read_symtab_private)->numsyms = 0;
-      subpst->textlow = 0;
-      subpst->texthigh = 0;
 
       /* We could save slight bits of space by only making one of these,
          shared by the entire set of include files.  FIXME-someday.  */
@@ -2349,10 +2347,11 @@ scan_xcoff_symtab (struct objfile *objfile)
 			CORE_ADDR highval =
 			  symbol.n_value + csect_aux.x_csect.x_scnlen.l;
 
-			if (highval > pst->texthigh)
-			  pst->texthigh = highval;
-			if (pst->textlow == 0 || symbol.n_value < pst->textlow)
-			  pst->textlow = symbol.n_value;
+			if (highval > PSYMTAB_TEXTHIGH (pst))
+			  SET_PSYMTAB_TEXTHIGH (pst, highval);
+			if (PSYMTAB_TEXTLOW (pst) == 0
+			    || symbol.n_value < PSYMTAB_TEXTLOW (pst))
+			  SET_PSYMTAB_TEXTLOW (pst, symbol.n_value);
 		      }
 		    misc_func_recorded = 0;
 		    break;
-- 
1.8.1.4



More information about the Gdb-patches mailing list