diff options
author | Tom Tromey <tom@tromey.com> | 2023-03-07 17:37:45 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-03-11 08:47:40 -0700 |
commit | 1acc9dca423f78e44553928f0de839b618c13766 (patch) | |
tree | 2cd8e208a45241b90a42d54aba456944cb1cfd37 /gdb/record-btrace.c | |
parent | 6e6ac32dde61fd3019b05adaeec372eb16c12bff (diff) | |
download | gdb-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/record-btrace.c')
-rw-r--r-- | gdb/record-btrace.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 61de849..55fe25e 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -44,6 +44,7 @@ #include "cli/cli-style.h" #include "async-event.h" #include <forward_list> +#include "objfiles.h" static const target_info record_btrace_target_info = { "record-btrace", @@ -722,6 +723,9 @@ btrace_find_line_range (CORE_ADDR pc) if (nlines <= 0) return btrace_mk_line_range (symtab, 0, 0); + struct objfile *objfile = symtab->compunit ()->objfile (); + pc -= objfile->text_section_offset (); + range = btrace_mk_line_range (symtab, 0, 0); for (i = 0; i < nlines - 1; i++) { @@ -733,7 +737,7 @@ btrace_find_line_range (CORE_ADDR pc) possibly adding more line numbers to the range. At the time this change was made I was unsure how to test this so chose to go with maintaining the existing experience. */ - if ((lines[i].pc == pc) && (lines[i].line != 0) + if ((lines[i].raw_pc () == pc) && (lines[i].line != 0) && (lines[i].is_stmt == 1)) range = btrace_line_range_add (range, lines[i].line); } |