+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,
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;
{
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;
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;
}
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. */
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,
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. */
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,
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,
/* 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,
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);
}
}
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,
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;
}
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;
}
;
/* 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;
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 ());
}
}
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. */
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;
}
}
- /* 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);
subpst->dirname = pst->dirname;
}
- subpst->textlow = 0;
- subpst->texthigh = 0;
-
subpst->dependencies
= XOBNEW (&objfile->objfile_obstack, struct partial_symtab *);
subpst->dependencies[0] = pst;
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
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);
", %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);
}
}
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;)
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
/* 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)
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))
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:
/* 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 */
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;
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;
/* 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. */
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 ();
}
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;
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;
/* 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.
{
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);
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;
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
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;
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
&& 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. */
&& 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. */
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)
}
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");
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;
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",
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;
}
}
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 (" - ");
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. */
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;