a patch for coff_find_nearest_line()
Jaka Močnik
jaka@xlab.si
Wed Aug 13 14:48:00 GMT 2008
More information about the Binutils mailing list
Wed Aug 13 14:48:00 GMT 2008
- Previous message (by thread): Why are there 2 continous R_MIPS_HI16 reloc entries in the ELF excutable?
- Next message (by thread): a patch for coff_find_nearest_line()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
hello! there is a bug in coff_find_nearest_line() (binutils 2.18), that sometimes returns no line number information when this info in fact exists ... it can be reproduced by using addr2line tool on a coff file (any coff will do, I believe ...) to look up the same address twice in a row. the bug is due to faulty priming of the look-up loop, which works like this: when an appropriate line number info for address A is found at index I in the section's lineno array, this information is returned (via the line_ptr out parameter to coff_find_nearest_line()), and the lookup loop breaks with the loop counter having the value I+1. this value I+1 is then remembered as the starting point for further lookups of addresses >= A. now consider the following lineno array entries: ... lineno[i]: offset X lineno[i+1]: offset X+10 ... looking up line number for address X+2, we end up with the info from lineno[i]. furthermore, i+1 is remembered as the starting index for priming further lookups. now try to lookup line number for address X+2 once again (or any address A, X+2 <= A < X+10). since the address is larger or equal than the previously looked up one, the lookup loop starts at index i+1. naturally, no info for any address < X+10 is found, and coff_find_nearest_line() returns wrong information. the attached simple patch (against binutils 2.18) remedies the problem. regards, jaKa -- email: jaka@xlab.si w3: http://www.gmajna.net/svojat/jaka/ -------------- next part -------------- A non-text attachment was scrubbed... Name: binutils-2.18-coff-find-nearest-line-priming.diff Type: text/x-patch Size: 373 bytes Desc: not available URL: <https://sourceware.org/pipermail/binutils/attachments/20080813/5e8afb07/attachment.bin>
- Previous message (by thread): Why are there 2 continous R_MIPS_HI16 reloc entries in the ELF excutable?
- Next message (by thread): a patch for coff_find_nearest_line()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list