mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Check if the line number == 0 and keep on trying.
This commit is contained in:
parent
f28d3b262d
commit
f11a0b5d1f
1 changed files with 9 additions and 3 deletions
|
@ -305,13 +305,19 @@ public class Elf {
|
||||||
addr2line = new Addr2line(file);
|
addr2line = new Addr2line(file);
|
||||||
long value = st_value;
|
long value = st_value;
|
||||||
// We try to get the nearest match
|
// We try to get the nearest match
|
||||||
// since the symbol may not quite align with debug info.
|
// since the symbol may not exactly align with debug info.
|
||||||
|
// In C line number 0 is invalid, line starts at 1 for file, we use
|
||||||
|
// this for validation.
|
||||||
for (int i = 0; i <= 20; i += 4, value += i) {
|
for (int i = 0; i <= 20; i += 4, value += i) {
|
||||||
line = addr2line.getLine(value);
|
line = addr2line.getLine(value);
|
||||||
if (!line.startsWith("??")) {
|
if (line != null) {
|
||||||
|
int colon = line.lastIndexOf(':');
|
||||||
|
String number = line.substring(colon + 1);
|
||||||
|
if (!number.startsWith("0")) {
|
||||||
break; // bail out
|
break; // bail out
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
func = addr2line.getFunction(value);
|
func = addr2line.getFunction(value);
|
||||||
}
|
}
|
||||||
return line;
|
return line;
|
||||||
|
|
Loading…
Add table
Reference in a new issue