aboutsummaryrefslogtreecommitdiff
path: root/gdb/mdebugread.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-05-03 16:36:19 -0600
committerTom Tromey <tom@tromey.com>2018-07-26 09:18:30 -0600
commit4ae976d1df96aee0ecd97ea1235efc4490562932 (patch)
tree06fef646b60339d2b42b63109505252742031125 /gdb/mdebugread.c
parent02e9e7f7e2bed3b82cb6541f566caf07256b9b2f (diff)
downloadgdb-4ae976d1df96aee0ecd97ea1235efc4490562932.zip
gdb-4ae976d1df96aee0ecd97ea1235efc4490562932.tar.gz
gdb-4ae976d1df96aee0ecd97ea1235efc4490562932.tar.bz2
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. 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.
Diffstat (limited to 'gdb/mdebugread.c')
-rw-r--r--gdb/mdebugread.c48
1 files changed, 25 insertions, 23 deletions
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index ed87c94..262c619 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -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;