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>
This commit is contained in:
Tom Tromey 2023-03-07 17:37:45 -07:00
parent 6e6ac32dde
commit 1acc9dca42
15 changed files with 110 additions and 76 deletions

View file

@ -422,7 +422,8 @@ ltpy_iternext (PyObject *self)
item = &(symtab->linetable ()->item[iter_obj->current_index]);
}
obj = build_linetable_entry (item->line, item->pc);
struct objfile *objfile = symtab->compunit ()->objfile ();
obj = build_linetable_entry (item->line, item->pc (objfile));
iter_obj->current_index++;
return obj;