[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] 1_0_1 Elf fix
|
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/ChangeLog,v
retrieving revision 1.54.2.2
diff -u -r1.54.2.2 ChangeLog
--- ChangeLog 12 Mar 2003 21:03:50 -0000 1.54.2.2
+++ ChangeLog 12 Mar 2003 21:15:23 -0000
@@ -1,4 +1,11 @@
-2003-03-06 Alain Magloire
+2003-03-12 Alain Magloire
+
+ * utils/org/eclipse/cdt/utils/elf/Elf.java (Symbol.lineInfo):
+ The address value may not align with the debug information, for example when
+ adding Profiling etc .. we try to get the nearest symbol as a fallback.
+ We've seen this behaviour on PPC and ARM boards.
+
+2003-03-12 Alain Magloire
A few corrections: The Elf parser was call to often and unnecessarly.
We can optimized the code by holding on the IBinarFile object and reuse
Index: utils/org/eclipse/cdt/utils/elf/Elf.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/Elf.java,v
retrieving revision 1.8
diff -u -r1.8 Elf.java
--- utils/org/eclipse/cdt/utils/elf/Elf.java 25 Nov 2002 05:55:31 -0000 1.8
+++ utils/org/eclipse/cdt/utils/elf/Elf.java 12 Mar 2003 21:15:24 -0000
@@ -303,8 +303,22 @@
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 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 != null) {
+ int colon = line.lastIndexOf(':');
+ String number = line.substring(colon + 1);
+ if (!number.startsWith("0")) {
+ break; // bail out
+ }
+ }
+ }
+ func = addr2line.getFunction(value);
}
return line;
}