aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
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/mi
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/mi')
-rw-r--r--gdb/mi/mi-symbol-cmds.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c
index 16947da..08e6e15 100644
--- a/gdb/mi/mi-symbol-cmds.c
+++ b/gdb/mi/mi-symbol-cmds.c
@@ -50,14 +50,16 @@ mi_cmd_symbol_list_lines (const char *command, char **argv, int argc)
already sorted by increasing values in the symbol table, so no
need to perform any other sorting. */
- gdbarch = s->compunit ()->objfile ()->arch ();
+ struct objfile *objfile = s->compunit ()->objfile ();
+ gdbarch = objfile->arch ();
ui_out_emit_list list_emitter (uiout, "lines");
if (s->linetable () != NULL && s->linetable ()->nitems > 0)
for (i = 0; i < s->linetable ()->nitems; i++)
{
ui_out_emit_tuple tuple_emitter (uiout, NULL);
- uiout->field_core_addr ("pc", gdbarch, s->linetable ()->item[i].pc);
+ uiout->field_core_addr ("pc", gdbarch,
+ s->linetable ()->item[i].pc (objfile));
uiout->field_signed ("line", s->linetable ()->item[i].line);
}
}