aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Grunberg2018-06-06 10:47:39 -0400
committerRoland Grunberg2018-06-08 14:16:14 -0400
commit659c57b57b925421d8b5d86a296588fc79412f12 (patch)
treeaa99bc9c64a62c0e93751a744aab17df598ecfd0
parent76798f9d71df43e6605765782ad4a97dcb333e59 (diff)
downloadorg.eclipse.linuxtools-659c57b57b925421d8b5d86a296588fc79412f12.tar.gz
org.eclipse.linuxtools-659c57b57b925421d8b5d86a296588fc79412f12.tar.xz
org.eclipse.linuxtools-659c57b57b925421d8b5d86a296588fc79412f12.zip
Bug 535611 - Fix GCov plugin to work with GCC 8.1.0.
8.1.0 Release gets converted to 'A81R' as defined in the version specification. Each character gets converted to its hex value and appended, forming 0x41383152. This value is expressed as 1094201682, the base 10 representation. Consulting the gcov parsing files (gcov.c or gcov-dump.c is necessary to discover parts of the GCNO format not mentioned in the gcov-io.h file) Change-Id: I1f021b98444dac006a0039695096d3f42944cd09 Reviewed-on: https://git.eclipse.org/r/124135 Tested-by: CI Bot Reviewed-by: Roland Grunberg <rgrunber@redhat.com>
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoRecordsParser.java27
1 files changed, 24 insertions, 3 deletions
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoRecordsParser.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoRecordsParser.java
index 035c84c8a0..f137bfdb09 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoRecordsParser.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoRecordsParser.java
@@ -37,6 +37,9 @@ public class GcnoRecordsParser {
private static final int GCOV_TAG_ARCS = 0x01430000;
private static final int GCOV_TAG_LINES = 0x01450000;
+ private static final int GCC_VER_810R = 1094201682; // GCC 8.1.0 Release
+ private static final int GCC_VER_407 = 875575082; // GCC 4.0.7
+
private GcnoFunction fnctn = null;
private final ArrayList<GcnoFunction> fnctns = new ArrayList<>();
private final ArrayList<SourceFile> currentAllSrcs;
@@ -117,13 +120,23 @@ public class GcnoRecordsParser {
* announce_function: header int32:ident int32:lineno_checksum int32:cfg_checksum TL;DR Need to
* consume the extra long value.
*/
- if (version >= 875575082) {
+ if (version >= GCC_VER_407) {
// long cfgChksm = (stream.readInt()&MasksGenerator.UNSIGNED_INT_MASK);
stream.readInt();
}
String fnctnName = GcovStringReader.readString(stream);
+ if (version >= GCC_VER_810R) {
+ // long artificial = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
+ stream.readInt();
+ }
String fnctnSrcFle = GcovStringReader.readString(stream);
long fnctnFrstLnNmbr = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
+ if (version >= GCC_VER_810R) {
+ // long fnctnFrstColumnLnNmbr = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
+ stream.readInt();
+ // long fnctnLastLnNmbr = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
+ stream.readInt();
+ }
fnctn = new GcnoFunction(fnctnIdent, fnctnChksm, fnctnName, fnctnSrcFle, fnctnFrstLnNmbr);
SourceFile srcFle2 = findOrAdd(fnctn.getSrcFile());
@@ -136,10 +149,18 @@ public class GcnoRecordsParser {
}
else if (tag == GCOV_TAG_BLOCKS) {
+ if (version >= GCC_VER_810R) {
+ length = stream.readInt();
+ }
blocks = new ArrayList<>();
+ Block blck;
for (int i = 0; i < length; i++) {
- long BlckFlag = stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK;
- Block blck = new Block(BlckFlag);
+ if (version >= GCC_VER_810R) {
+ blck = new Block(0); // value not used anywhere
+ } else {
+ long BlckFlag = stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK;
+ blck = new Block(BlckFlag);
+ }
blocks.add(blck);
}
fnctn.setNumBlocks(length);