This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]