mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +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,11 +305,17 @@ public class Elf {
|
|||
addr2line = new Addr2line(file);
|
||||
long value = st_value;
|
||||
// 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) {
|
||||
line = addr2line.getLine(value);
|
||||
if (!line.startsWith("??")) {
|
||||
break; // bail out
|
||||
if (line != null) {
|
||||
int colon = line.lastIndexOf(':');
|
||||
String number = line.substring(colon + 1);
|
||||
if (!number.startsWith("0")) {
|
||||
break; // bail out
|
||||
}
|
||||
}
|
||||
}
|
||||
func = addr2line.getFunction(value);
|
||||
|
|
Loading…
Add table
Reference in a new issue