Introduce accessors for psymtab high and low fields
authorTom Tromey <tom@tromey.com>
Thu, 3 May 2018 22:36:19 +0000 (16:36 -0600)
committerTom Tromey <tom@tromey.com>
Thu, 26 Jul 2018 15:18:30 +0000 (09:18 -0600)
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.

I looked at making the fields private, but this interferes with the
memset in allocate_psymtab, and I didn't want to chase this down.
This conversion can be done later if need be.

gdb/ChangeLog
2018-07-26  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) <m_text_low, m_text_high>:
Rename fields.  Update comment.  Now private.
<text_low, text_high, set_text_low, set_text_high>: New methods.
* 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
gdb/dbxread.c
gdb/dwarf2read.c
gdb/mdebugread.c
gdb/psympriv.h
gdb/psymtab.c
gdb/xcoffread.c

index 8c6471b9a9e39e040634f5be3132e127b04e973f..e6972c29505ab845dc192e80d854f83dd40b8db0 100644 (file)
@@ -1,3 +1,24 @@
+2018-07-26  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) <m_text_low, m_text_high>:
+       Rename fields.  Update comment.  Now private.
+       <text_low, text_high, set_text_low, set_text_high>: New methods.
+       * 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.
+
 2018-07-26  Tom Tromey  <tromey@redhat.com>
 
        * psympriv.h (struct partial_symbol) <unrelocated_address,
index fe9e842ba1a49a7bf38463e6f33e960abba926da..d5d4e083c5a6383c82361bfabbb9eca422da3ada 100644 (file)
@@ -1143,12 +1143,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 >= pst->text_low ())
                {
                  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 > pst->text_high ()
+                                  ? nlist.n_value : pst->text_high (),
                                   dependency_list, dependencies_used,
                                   textlow_not_set);
                  pst = (struct partial_symtab *) 0;
@@ -1263,8 +1263,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 > pst->text_high ()
+                                     ? valu : pst->text_high ()),
                                     dependency_list, dependencies_used,
                                     prev_textlow_not_set);
                    pst = (struct partial_symtab *) 0;
@@ -1438,8 +1438,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 (pst->text_high () == 0 || valu > pst->text_high ())
+               pst->set_text_high (valu);
              break;
            }
 
@@ -1653,7 +1653,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;
+                 pst->set_text_low (nlist.n_value);
                  textlow_not_set = 0;
                }
              /* End kludge.  */
@@ -1668,12 +1668,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 < pst->text_low ()
                          && (nlist.n_value
                              != ANOFFSET (objfile->section_offsets,
                                           SECT_OFF_TEXT (objfile))))))
                {
-                 pst->textlow = nlist.n_value;
+                 pst->set_text_low (nlist.n_value);
                  textlow_not_set = 0;
                }
              add_psymbol_to_list (sym_name, sym_len, 1,
@@ -1722,7 +1722,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;
+                 pst->set_text_low (nlist.n_value);
                  textlow_not_set = 0;
                }
              /* End kludge.  */
@@ -1737,12 +1737,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 < pst->text_low ()
                          && (nlist.n_value
                              != ANOFFSET (objfile->section_offsets,
                                           SECT_OFF_TEXT (objfile))))))
                {
-                 pst->textlow = nlist.n_value;
+                 pst->set_text_low (nlist.n_value);
                  textlow_not_set = 0;
                }
              add_psymbol_to_list (sym_name, sym_len, 1,
@@ -1854,10 +1854,10 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
          continue;
 
        case N_ENDM:
-         /* Solaris 2 end of module, finish current partial symbol table.
-            dbx_end_psymtab will set pst->texthigh to the proper value, which
-            is necessary if a module compiled without debugging info
-            follows this module.  */
+         /* Solaris 2 end of module, finish current partial symbol
+            table.  dbx_end_psymtab will set the high text address of
+            PST to the proper value, which is necessary if a module
+            compiled without debugging info follows this module.  */
          if (pst && gdbarch_sofun_address_maybe_missing (gdbarch))
            {
              dbx_end_psymtab (objfile, pst,
@@ -1918,7 +1918,8 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
   /* If there's stuff to be cleaned up, clean it up.  */
   if (pst)
     {
-      /* Don't set pst->texthigh lower than it already is.  */
+      /* Don't set high text address of PST lower than it already
+        is.  */
       CORE_ADDR text_end =
        (lowest_text_address == (CORE_ADDR) -1
         ? (text_addr + ANOFFSET (objfile->section_offsets,
@@ -1928,7 +1929,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 > pst->text_high ()
+                       ? text_end : pst->text_high ()),
                       dependency_list, dependencies_used, textlow_not_set);
     }
 }
@@ -1983,7 +1985,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;
+  pst->set_text_high (capping_text);
 
   /* Under Solaris, the N_SO symbols always have a value of 0,
      instead of the usual address of the .o file.  Therefore,
@@ -2000,7 +2002,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 (pst->text_high () == 0 && last_function_name
       && gdbarch_sofun_address_maybe_missing (gdbarch))
     {
       int n;
@@ -2027,8 +2029,8 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
        }
 
       if (minsym.minsym)
-       pst->texthigh = (BMSYMBOL_VALUE_ADDRESS (minsym)
-                        + MSYMBOL_SIZE (minsym.minsym));
+       pst->set_text_high (BMSYMBOL_VALUE_ADDRESS (minsym)
+                           + MSYMBOL_SIZE (minsym.minsym));
 
       last_function_name = NULL;
     }
@@ -2037,7 +2039,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;
+    pst->set_text_low (pst->text_high ());
   else
     {
       struct partial_symtab *p1;
@@ -2050,8 +2052,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 (p1->text_high () == 0 && p1->text_low () != 0
+           && p1 != pst)
+         p1->set_text_high (pst->text_low ());
       }
     }
 
@@ -2079,9 +2082,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.  */
@@ -2239,8 +2240,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 = pst->text_low ();
+  text_size = pst->text_high () - pst->text_low ();
   section_offsets = objfile->section_offsets;
 
   dbxread_objfile = objfile;
@@ -2367,15 +2368,15 @@ read_ofile_symtab (struct objfile *objfile, struct partial_symtab *pst)
        }
     }
 
-  /* In a Solaris elf file, this variable, which comes from the
-     value of the N_SO symbol, will still be 0.  Luckily, text_offset,
-     which comes from pst->textlow is correct.  */
+  /* In a Solaris elf file, this variable, which comes from the value
+     of the N_SO symbol, will still be 0.  Luckily, text_offset, which
+     comes from low text address of PST, is correct.  */
   if (get_last_source_start_addr () == 0)
     set_last_source_start_addr (text_offset);
 
   /* In reordered executables last_source_start_addr may not be the
      lower bound for this symtab, instead use text_offset which comes
-     from pst->textlow which is correct.  */
+     from the low text address of PST, which is correct.  */
   if (get_last_source_start_addr () > text_offset)
     set_last_source_start_addr (text_offset);
 
index d16700fb9241ce0e083e01206658314b30361193..3b0cbd950923a354621f364e74758da12501e2ab 100644 (file)
@@ -6507,9 +6507,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;
@@ -6548,7 +6545,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,
+                     pst->text_low (), 1);
 }
 
 static hashval_t
@@ -7970,8 +7968,10 @@ 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);
+  pst->set_text_low (gdbarch_adjust_dwarf2_addr (gdbarch,
+                                                best_lowpc + baseaddr));
+  pst->set_text_high (gdbarch_adjust_dwarf2_addr (gdbarch,
+                                                 best_highpc + baseaddr));
 
   end_psymtab_common (objfile, pst);
 
@@ -8008,8 +8008,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, pst->text_low ()),
+                         paddress (gdbarch, pst->text_high ()),
                          pst->n_global_syms, pst->n_static_syms);
     }
 }
index ed87c94f7a2b46e866d68e9b7a1b52f22b45a7ca..262c619d4019b535f16ea81fddb34f3c09e417e7 100644 (file)
@@ -2196,7 +2196,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 = pst->text_low () + pr->adr - lowest_pdr_addr;
 
       l = adr >> 2;            /* in words */
       for (lineno = pr->lnLow; base < halt;)
@@ -2671,7 +2671,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
        psymtab_language = prev_language;
       PST_PRIVATE (pst)->pst_language = psymtab_language;
 
-      pst->texthigh = pst->textlow;
+      pst->set_text_high (pst->text_low ());
 
       /* For stabs-in-ecoff files, the second symbol must be @stab.
          This symbol is emitted by mips-tfile to signal that the
@@ -2736,10 +2736,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;
+                             && (pst->text_low () == 0
+                                 || procaddr < pst->text_low ()))
+                           pst->set_text_low (procaddr);
+                         if (high > pst->text_high ())
+                           pst->set_text_high (high);
                        }
                    }
                  else if (sh.st == stStatic)
@@ -3308,9 +3309,9 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 
                  case N_ENDM:
                    /* Solaris 2 end of module, finish current partial
-                      symbol table.  dbx_end_psymtab will set
-                      pst->texthigh to the proper value, which is
-                      necessary if a module compiled without
+                      symbol table.  dbx_end_psymtab will set the
+                      high text address of PST to the proper value,
+                      which is necessary if a module compiled without
                       debugging info follows this module.  */
                    if (pst
                        && gdbarch_sofun_address_maybe_missing (gdbarch))
@@ -3322,8 +3323,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 > save_pst->text_high ())
+                     save_pst->set_text_high (sh.value);
                    continue;
                  case N_EINCL:
                  case N_DSLINE:
@@ -3511,12 +3512,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;
+                     && (pst->text_low () == 0
+                         || procaddr < pst->text_low ()))
+                   pst->set_text_low (procaddr);
 
                  high = procaddr + sh.value;
-                 if (high > pst->texthigh)
-                   pst->texthigh = high;
+                 if (high > pst->text_high ())
+                   pst->set_text_high (high);
                  continue;
 
                case stStatic:  /* Variable */
@@ -3690,7 +3692,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, save_pst->text_high (),
                           dependency_list, dependencies_used,
                           textlow_not_set);
       includes_used = 0;
@@ -3709,15 +3711,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
+         && save_pst->text_low () != 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)
+               && save_pst->text_low () >= pst->text_low ()
+               && save_pst->text_low () < pst->text_high ()
+               && save_pst->text_high () > pst->text_high ())
              {
                objfile->flags |= OBJF_REORDERED;
                break;
@@ -3920,7 +3922,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)
+      && pst->text_low () == 0 && pst->text_high () == 0)
     return;
 
   /* Now read the symbols for this symtab.  */
@@ -4069,7 +4071,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
 
       if (! last_symtab_ended)
        {
-         cust = end_symtab (pst->texthigh, SECT_OFF_TEXT (objfile));
+         cust = end_symtab (pst->text_high (), SECT_OFF_TEXT (objfile));
          end_stabs ();
        }
 
@@ -4145,7 +4147,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) = pst->text_low ();
       BLOCK_END (top_stack->cur_block) = 0;
       top_stack->blocktype = stFile;
       top_stack->cur_type = 0;
index be574bf8b7442331c79235b68789450c2cf9dbc1..7116a1a59579f21730a0138dff303a2acaf545a7 100644 (file)
@@ -98,6 +98,31 @@ enum psymtab_search_status
 
 struct partial_symtab
 {
+  /* Return the low text address of this partial_symtab.  */
+  CORE_ADDR text_low () const
+  {
+    return m_text_low;
+  }
+
+  /* Return the high text address of this partial_symtab.  */
+  CORE_ADDR text_high () const
+  {
+    return m_text_high;
+  }
+
+  /* Set the low text address of this partial_symtab.  */
+  void set_text_low (CORE_ADDR addr)
+  {
+    m_text_low = addr;
+  }
+
+  /* Set the hight text address of this partial_symtab.  */
+  void set_text_high (CORE_ADDR addr)
+  {
+    m_text_high = addr;
+  }
+
+
   /* Chain of all existing partial symtabs.  */
 
   struct partial_symtab *next;
@@ -118,10 +143,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
+     accessors.  */
 
-  CORE_ADDR textlow;
-  CORE_ADDR texthigh;
+  CORE_ADDR m_text_low;
+  CORE_ADDR m_text_high;
 
   /* If NULL, this is an ordinary partial symbol table.
 
index f144fa339655dab764754ec3acf86d3dab366bc4..549628cad6a50a520a8770a5dff68d4d7671d453 100644 (file)
@@ -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 = pst->text_low ();
 
   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 >= tpst->text_low () && pc < tpst->text_high ())
        {
          struct partial_symbol *p;
          CORE_ADDR this_addr;
@@ -277,7 +277,7 @@ find_pc_sect_psymtab_closer (struct objfile *objfile,
          if (p != NULL)
            this_addr = p->address (objfile);
          else
-           this_addr = tpst->textlow;
+           this_addr = tpst->text_low ();
 
          /* Check whether it is closer than our current
             BEST_ADDR.  Since this symbol address is
@@ -361,7 +361,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 >= pst->text_low () && pc < pst->text_high ())
       {
        struct partial_symtab *best_pst;
 
@@ -415,7 +415,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->text_low () != 0)
+            ? psymtab->text_low () - 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
@@ -428,7 +429,7 @@ find_pc_sect_psymbol (struct objfile *objfile,
          && p->aclass == LOC_BLOCK
          && pc >= p->address (objfile)
          && (p->address (objfile) > best_pc
-             || (psymtab->textlow == 0
+             || (psymtab->text_low () == 0
                  && best_pc == 0 && p->address (objfile) == 0)))
        {
          if (section != NULL)  /* Match on a specific section.  */
@@ -451,7 +452,7 @@ find_pc_sect_psymbol (struct objfile *objfile,
          && p->aclass == LOC_BLOCK
          && pc >= p->address (objfile)
          && (p->address (objfile) > best_pc
-             || (psymtab->textlow == 0
+             || (psymtab->text_low () == 0
                  && best_pc == 0 && p->address (objfile) == 0)))
        {
          if (section != NULL)  /* Match on a specific section.  */
@@ -806,8 +807,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));
+      p->set_text_low (p->text_low ()
+                      + ANOFFSET (delta, SECT_OFF_TEXT (objfile)));
+      p->set_text_high (p->text_high ()
+                       + ANOFFSET (delta, SECT_OFF_TEXT (objfile)));
     }
 
   for (partial_symbol *psym : objfile->global_psymbols)
@@ -1012,9 +1015,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->text_low ()), outfile);
   fprintf_filtered (outfile, "-");
-  fputs_filtered (paddress (gdbarch, psymtab->texthigh), outfile);
+  fputs_filtered (paddress (gdbarch, psymtab->text_high ()), outfile);
   fprintf_filtered (outfile, "\n");
   fprintf_filtered (outfile, "  Address map supported - %s.\n",
                    psymtab->psymtabs_addrmap_supported ? "yes" : "no");
@@ -1594,8 +1597,8 @@ start_psymtab_common (struct objfile *objfile,
   struct partial_symtab *psymtab;
 
   psymtab = allocate_psymtab (filename, objfile);
-  psymtab->textlow = textlow;
-  psymtab->texthigh = psymtab->textlow;                /* default */
+  psymtab->set_text_low (textlow);
+  psymtab->set_text_high (psymtab->text_low ()); /* default */
   psymtab->globals_offset = global_psymbols.size ();
   psymtab->statics_offset = static_psymbols.size ();
   return psymtab;
@@ -2147,10 +2150,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->text_low ()),
                              gdb_stdout);
              printf_filtered (" -- ");
-             fputs_filtered (paddress (gdbarch, psymtab->texthigh),
+             fputs_filtered (paddress (gdbarch, psymtab->text_high ()),
                              gdb_stdout);
              printf_filtered ("\n");
              printf_filtered ("    psymtabs_addrmap_supported %s\n",
@@ -2230,14 +2233,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 (ps->text_high () < ps->text_low ())
       {
        printf_filtered ("Psymtab ");
        puts_filtered (ps->filename);
        printf_filtered (" covers bad range ");
-       fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout);
+       fputs_filtered (paddress (gdbarch, ps->text_low ()), gdb_stdout);
        printf_filtered (" - ");
-       fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout);
+       fputs_filtered (paddress (gdbarch, ps->text_high ()), gdb_stdout);
        printf_filtered ("\n");
        continue;
       }
@@ -2282,15 +2285,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 (ps->text_high () != 0
+       && (ps->text_low () < BLOCK_START (b)
+           || ps->text_high () > 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, ps->text_low ()), gdb_stdout);
        printf_filtered (" - ");
-       fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout);
+       fputs_filtered (paddress (gdbarch, ps->text_high ()), gdb_stdout);
        printf_filtered (" but symtab covers only ");
        fputs_filtered (paddress (gdbarch, BLOCK_START (b)), gdb_stdout);
        printf_filtered (" - ");
index 1446036621be18eb9bbab54fed71358b311c7762..1aa2e523db26d5ebd2b8af228560b85966fdb9e4 100644 (file)
@@ -2093,8 +2093,6 @@ xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
       subpst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, 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.  */
@@ -2344,10 +2342,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 > pst->text_high ())
+                         pst->set_text_high (highval);
+                       if (pst->text_low () == 0
+                           || symbol.n_value < pst->text_low ())
+                         pst->set_text_low (symbol.n_value);
                      }
                    misc_func_recorded = 0;
                    break;