aboutsummaryrefslogtreecommitdiff
path: root/gdb/xcoffread.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/xcoffread.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/xcoffread.c')
-rw-r--r--gdb/xcoffread.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 819735d..0642fb5 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -432,7 +432,7 @@ arrange_linetable (std::vector<linetable_entry> &old_linetable)
linetable_entry &e = fentries.back ();
e.line = ii;
e.is_stmt = 1;
- e.pc = old_linetable[ii].pc;
+ e.set_raw_pc (old_linetable[ii].raw_pc ());
}
}
@@ -457,7 +457,7 @@ arrange_linetable (std::vector<linetable_entry> &old_linetable)
extra line to cover the function prologue. */
int jj = entry.line;
if (jj + 1 < old_linetable.size ()
- && old_linetable[jj].pc != old_linetable[jj + 1].pc)
+ && old_linetable[jj].raw_pc () != old_linetable[jj + 1].raw_pc ())
{
new_linetable.push_back (old_linetable[jj]);
new_linetable.back ().line = old_linetable[jj + 1].line;
@@ -790,15 +790,16 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
if (addr < startaddr || (endaddr && addr >= endaddr))
return;
+ CORE_ADDR record_addr = (gdbarch_addr_bits_remove (gdbarch, addr)
+ - objfile->text_section_offset ());
if (int_lnno.l_lnno == 0)
{
*firstLine = read_symbol_lineno (int_lnno.l_addr.l_symndx);
- record_line (subfile, 0, gdbarch_addr_bits_remove (gdbarch, addr));
+ record_line (subfile, 0, record_addr);
--(*firstLine);
}
else
- record_line (subfile, *firstLine + int_lnno.l_lnno,
- gdbarch_addr_bits_remove (gdbarch, addr));
+ record_line (subfile, *firstLine + int_lnno.l_lnno, record_addr);
curoffset += linesz;
}
}