ctf: Ignore invalid clock description elements
authorAlexandre Montplaisir <alexmonthy@efficios.com>
Mon, 8 Feb 2016 21:45:28 +0000 (16:45 -0500)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Wed, 10 Feb 2016 21:53:34 +0000 (16:53 -0500)
The clock "offset" element is supposed to be signed integer constant[1].
LTTng uses 64-bit integers for this, however there is a bug with current
versions where this can be set to values above 2^63.

Right now Trace Compass refuses to open the trace and reports the
invalid value as a CTF error. We could accomodate and still load these
traces, ignoring the invalid definitions.

[1] This is not explicitly mentionned in the spec, but it was discuted
    with the spec's authors, and it should be updated in the future.

Change-Id: I44fc4f4b90c1c9f046c03d83d63cea2fee8bb57f
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Reviewed-on: https://git.eclipse.org/r/66159
Reviewed-by: Hudson CI
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/metadata/tsdl/ClockParser.java

index 4a7dce9b2780c707bd3079b3e758d0843807b47c..a3acff0e0de5e09a8080953349b89e3d4992c720 100644 (file)
@@ -12,8 +12,10 @@ package org.eclipse.tracecompass.internal.ctf.core.event.metadata.tsdl;
 import java.util.List;
 
 import org.antlr.runtime.tree.CommonTree;
+import org.eclipse.core.runtime.IStatus;
 import org.eclipse.tracecompass.ctf.core.event.CTFClock;
 import org.eclipse.tracecompass.ctf.parser.CTFParser;
+import org.eclipse.tracecompass.internal.ctf.core.Activator;
 import org.eclipse.tracecompass.internal.ctf.core.event.metadata.ICommonTreeParser;
 import org.eclipse.tracecompass.internal.ctf.core.event.metadata.ParseException;
 
@@ -140,7 +142,8 @@ public final class ClockParser implements ICommonTreeParser {
                 try {
                     numValue = Long.parseLong(text);
                 } catch (NumberFormatException e) {
-                    throw new ParseException("Number conversion issue with " + text, e); //$NON-NLS-1$
+                    Activator.log(IStatus.WARNING, "Number conversion issue with " + text + ". Assigning " + key + " = 0."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+                    numValue = Long.valueOf(0L);
                 }
                 ctfClock.addAttribute(key, numValue);
                 break;
This page took 0.02611 seconds and 5 git commands to generate.