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]

[RFA 4/6] Introduce accessors for psymtab high and low fields


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.

ChangeLog
2018-05-03  Tom Tromey  <tom@tromey.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, dwarf2_build_include_psymtabs):
	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    | 22 ++++++++++++++++++++++
 gdb/dbxread.c    | 52 ++++++++++++++++++++++++++--------------------------
 gdb/dwarf2read.c | 18 ++++++++++--------
 gdb/mdebugread.c | 42 ++++++++++++++++++++++--------------------
 gdb/psympriv.h   | 20 +++++++++++++++++---
 gdb/psymtab.c    | 48 ++++++++++++++++++++++++++----------------------
 gdb/xcoffread.c  | 11 +++++------
 7 files changed, 128 insertions(+), 85 deletions(-)

diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 7acbb0ec8b..810bdcf57b 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -1193,12 +1193,12 @@ read_dbx_symtab (minimal_symbol_reader &reader, 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))
 		{
 		  dbx_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;
@@ -1313,8 +1313,8 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
 		  {
 		    dbx_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;
@@ -1489,8 +1489,8 @@ read_dbx_symtab (minimal_symbol_reader &reader, 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;
 	    }
 
@@ -1704,7 +1704,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, 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.  */
@@ -1719,12 +1719,12 @@ read_dbx_symtab (minimal_symbol_reader &reader, 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,
@@ -1773,7 +1773,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, 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.  */
@@ -1788,12 +1788,12 @@ read_dbx_symtab (minimal_symbol_reader &reader, 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,
@@ -1980,7 +1980,8 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
 
       dbx_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);
     }
 
@@ -2037,7 +2038,7 @@ dbx_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,
@@ -2054,7 +2055,7 @@ dbx_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))
     {
       int n;
@@ -2081,8 +2082,8 @@ dbx_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;
     }
@@ -2091,7 +2092,7 @@ dbx_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;
@@ -2104,8 +2105,9 @@ dbx_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));
       }
     }
 
@@ -2133,9 +2135,7 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
       subpst->read_symtab_private =
 	XOBNEW (&objfile->objfile_obstack, 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.  */
@@ -2298,8 +2298,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 = objfile->section_offsets;
 
   dbxread_objfile = objfile;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 380ff365bb..3cb0475b3b 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -6518,9 +6518,6 @@ dwarf2_create_include_psymtab (const char *name, struct partial_symtab *pst,
       subpst->dirname = pst->dirname;
     }
 
-  subpst->textlow = 0;
-  subpst->texthigh = 0;
-
   subpst->dependencies
     = XOBNEW (&objfile->objfile_obstack, struct partial_symtab *);
   subpst->dependencies[0] = pst;
@@ -6559,7 +6556,8 @@ dwarf2_build_include_psymtabs (struct dwarf2_cu *cu,
     return;  /* No linetable, so no includes.  */
 
   /* NOTE: pst->dirname is DW_AT_comp_dir (if present).  */
-  dwarf_decode_lines (lh.get (), pst->dirname, cu, pst, pst->textlow, 1);
+  dwarf_decode_lines (lh.get (), pst->dirname, cu, pst,
+		      PSYMTAB_TEXTLOW (pst), 1);
 }
 
 static hashval_t
@@ -7981,8 +7979,12 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
 	  best_highpc = highpc;
 	}
     }
-  pst->textlow = gdbarch_adjust_dwarf2_addr (gdbarch, best_lowpc + baseaddr);
-  pst->texthigh = gdbarch_adjust_dwarf2_addr (gdbarch, best_highpc + baseaddr);
+  SET_PSYMTAB_TEXTLOW (pst,
+		       gdbarch_adjust_dwarf2_addr (gdbarch,
+						   best_lowpc + baseaddr));
+  SET_PSYMTAB_TEXTHIGH (pst,
+			gdbarch_adjust_dwarf2_addr (gdbarch,
+						    best_highpc + baseaddr));
 
   end_psymtab_common (objfile, pst);
 
@@ -8019,8 +8021,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",
 			  sect_offset_str (per_cu->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 c0bce55148..09bdb28088 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -2213,7 +2213,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;)
@@ -2699,7 +2699,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 	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
@@ -2764,10 +2764,11 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 
 			  /* 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)
@@ -3351,8 +3352,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 		    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:
@@ -3542,12 +3543,13 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 
 		  /* 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 */
@@ -3721,7 +3723,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
       fdr_to_pst[f_idx].pst
 	= dbx_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;
@@ -3740,15 +3742,15 @@ parse_partial_symbols (minimal_symbol_reader &reader,
          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;
@@ -3955,7 +3957,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.  */
@@ -4107,7 +4109,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
 
       if (! last_symtab_ended)
 	{
-	  cust = end_symtab (pst->texthigh, SECT_OFF_TEXT (objfile));
+	  cust = end_symtab (PSYMTAB_TEXTHIGH (pst), SECT_OFF_TEXT (objfile));
 	  end_stabs ();
 	}
 
@@ -4188,7 +4190,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
       top_stack->cur_st = COMPUNIT_FILETABS (cust);
       top_stack->cur_block
 	= BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), 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 8daaa377b7..fa175736ce 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -124,10 +124,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.
 
@@ -228,6 +229,19 @@ struct partial_symtab
   void *read_symtab_private;
 };
 
+/* Compute a section offset given an objfile, a section_offsets field
+   from a partial symtab, and an index.  */
+
+#define PST_OFFSET(OBJF, OFFS, INDEX)				\
+  (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))
+
 /* Add any kind of symbol to a partial_symbol vector.  */
 
 extern void add_psymbol_to_list (const char *, int,
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 3b6f0d53b5..30c9a43e2c 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -232,7 +232,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);
 
@@ -256,7 +256,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;
@@ -278,7 +278,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
@@ -362,7 +362,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;
 
@@ -416,7 +416,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
@@ -429,7 +430,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)))
 	{
@@ -453,7 +454,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)))
 	{
@@ -809,8 +810,10 @@ psym_relocate (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 (partial_symbol *psym : objfile->global_psymbols)
@@ -1019,9 +1022,9 @@ dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab,
     }
 
   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");
@@ -1601,8 +1604,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, PSYMTAB_TEXTLOW (psymtab)); /* default */
   psymtab->globals_offset = global_psymbols.size ();
   psymtab->statics_offset = static_psymbols.size ();
   return psymtab;
@@ -2158,10 +2161,10 @@ maintenance_info_psymtabs (const 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",
@@ -2241,14 +2244,14 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
     cust = ps->compunit_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;
       }
@@ -2293,15 +2296,16 @@ maintenance_check_psymtabs (const 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 8c707aa8fe..49716a56e5 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -2101,8 +2101,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.  */
@@ -2353,10 +2351,11 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
 			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;
-- 
2.13.6


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