This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFC] Sort linetables in objfile_relocate.
- From: Klee Dienes <klee at apple dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 24 Nov 2002 02:44:03 -0500
- Subject: [RFC] Sort linetables in objfile_relocate.
When using objfile_relocate, if any of the entries in the linetable
overflow or underflow, the linetable can end up unsorted.
The following patch adds code to objfile_relocate to handle the
overflow/underflow case. For efficiency, it special-cases for a
linetable that was pre-sorted and then overflowed/underflowed, and just
rotates the linetable in the linetable buffer for that case. If the
linetable wasn't pre-sorted, the sort code issues a warning and sorts
it anyway using qsort().
Questions:
* Should it warn on the case where the objfile wasn't sorted before the
relocation? What about warning for overflow/underflow?
* Is the special-case code for a single overflow/underflow worth it?
We could just use qsort() for everything.
* The qsort code needed compare_line_numbers to be exported from
buildsym.c. Wouldn't this be better named compare_line_addresses, or
perhaps something else?
Attachment:
sort-linetable.txt
Description: Text document