aboutsummaryrefslogtreecommitdiff
path: root/gdb/mdebugread.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-03-07 17:37:45 -0700
committerTom Tromey <tom@tromey.com>2023-03-11 08:47:40 -0700
commit1acc9dca423f78e44553928f0de839b618c13766 (patch)
tree2cd8e208a45241b90a42d54aba456944cb1cfd37 /gdb/mdebugread.c
parent6e6ac32dde61fd3019b05adaeec372eb16c12bff (diff)
downloadgdb-1acc9dca423f78e44553928f0de839b618c13766.zip
gdb-1acc9dca423f78e44553928f0de839b618c13766.tar.gz
gdb-1acc9dca423f78e44553928f0de839b618c13766.tar.bz2
Change linetables to be objfile-independent
This changes linetables to not add the text offset to the addresses they contain. I did this in a few steps, necessarily combined together in one patch: I renamed the 'pc' member to 'm_pc', added the appropriate accessors, and then recompiled. Then I fixed all the errors. Where possible I generally chose to use the raw_pc accessor, as it is less expensive. Note that this patch discounts the possibility that the text section offset might cause wraparound in the addresses in the line table. However, this was already discounted -- in particular, objfile_relocate1 did not re-sort the table in this scenario. (There was a bug open about this, but as far as I can tell this has never happened, it's not even clear what inspired that bug.) Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/mdebugread.c')
-rw-r--r--gdb/mdebugread.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 2673517..6fd3b09 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -2152,7 +2152,7 @@ parse_external (EXTR *es, int bigend, const section_offsets &section_offsets,
static void
parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines,
- CORE_ADDR textlow, CORE_ADDR lowest_pdr_addr)
+ CORE_ADDR lowest_pdr_addr)
{
unsigned char *base;
int j, k;
@@ -2183,7 +2183,7 @@ parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines,
halt = base + fh->cbLine;
base += pr->cbLineOffset;
- adr = textlow + pr->adr - lowest_pdr_addr;
+ adr = pr->adr - lowest_pdr_addr;
l = adr >> 2; /* in words */
for (lineno = pr->lnLow; base < halt;)
@@ -3982,7 +3982,6 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
else
{
/* Handle encoded stab line number. */
- valu += section_offsets[SECT_OFF_TEXT (objfile)];
record_line (get_current_subfile (), sh.index,
gdbarch_addr_bits_remove (gdbarch, valu));
}
@@ -4134,7 +4133,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
}
parse_lines (fh, pr_block.data (), lines, maxlines,
- pst->text_low (objfile), lowest_pdr_addr);
+ lowest_pdr_addr);
if (lines->nitems < fh->cline)
lines = shrink_linetable (lines);
@@ -4511,7 +4510,7 @@ add_line (struct linetable *lt, int lineno, CORE_ADDR adr, int last)
return lineno;
lt->item[lt->nitems].line = lineno;
- lt->item[lt->nitems++].pc = adr << 2;
+ lt->item[lt->nitems++].set_raw_pc (adr << 2);
return lineno;
}