1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 18:05:33 +02:00

The address may no line with the debug information.

This commit is contained in:
Alain Magloire 2003-03-11 20:03:06 +00:00
parent 8ceec2dbb8
commit 71be7c5a75

View file

@ -303,8 +303,16 @@ public class Elf {
if ( line == null ) {
if ( addr2line == null )
addr2line = new Addr2line(file);
line = addr2line.getLine(st_value + 19);
func = addr2line.getFunction(st_value + 19);
long value = st_value;
// We try to get the nearest match
// since the symbol may not quite align with debug info.
for (int i = 0; i <= 20; i += 4, value += i) {
line = addr2line.getLine(value);
if (!line.startsWith("??")) {
break; // bail out
}
}
func = addr2line.getFunction(value);
}
return line;
}