Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'gcov/org.eclipse.linuxtools.gcov.core')
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/META-INF/MANIFEST.MF4
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/plugin.xml6
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/action/OpenGCAction.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/action/OpenGCAction.java)6
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/action/SwitchContentProviderAction.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/action/SwitchContentProviderAction.java)86
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/dialog/OpenGCDialog.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/dialog/OpenGCDialog.java)2
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/AbstractTreeElement.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/AbstractTreeElement.java)156
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFileTreeElement.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/CovFileTreeElement.java)50
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFolderTreeElement.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/CovFolderTreeElement.java)48
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFunctionTreeElement.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/CovFunctionTreeElement.java)114
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovRootTreeElement.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/CovRootTreeElement.java)52
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/TreeElement.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/TreeElement.java)2
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Arc.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Arc.java)262
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Block.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Block.java)354
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/CovManager.java)908
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CoverageInfo.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/CoverageInfo.java)104
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Folder.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Folder.java)130
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcdaRecordsParser.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/GcdaRecordsParser.java)544
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoFunction.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/GcnoFunction.java)510
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoRecordsParser.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/GcnoRecordsParser.java)482
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Line.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Line.java)100
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/SourceFile.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/SourceFile.java)220
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/BEDataInputStream.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/utils/BEDataInputStream.java)382
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/GcovStringReader.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/utils/GcovStringReader.java)76
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/LEDataInputStream.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/utils/LEDataInputStream.java)416
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/MasksGenerator.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/utils/MasksGenerator.java)30
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/STGcovProgramChecker.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/utils/STGcovProgramChecker.java)2
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFileContentProvider.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/CovFileContentProvider.java)120
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFolderContentProvider.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/CovFolderContentProvider.java)122
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFunctionContentProvider.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/CovFunctionContentProvider.java)102
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovView.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/CovView.java)536
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovViewer.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/CovViewer.java)238
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/FieldCoveragePercentage.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/FieldCoveragePercentage.java)198
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/FieldExecutedLines.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/FieldExecutedLines.java)136
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/FieldInstrumentedLines.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/FieldInstrumentedLines.java)154
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/FieldName.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/FieldName.java)138
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/FieldTotalLines.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/FieldTotalLines.java)164
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/CoverageAnnotationColumn.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/annotatedsource/CoverageAnnotationColumn.java)158
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/OpenSourceFileAction.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/annotatedsource/OpenSourceFileAction.java)272
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/STAnnotatedSourceEditorInput.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/annotatedsource/STAnnotatedSourceEditorInput.java)146
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditor.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditor.java)100
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditorInput.java (renamed from gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditorInput.java)4
41 files changed, 3815 insertions, 3819 deletions
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/META-INF/MANIFEST.MF b/gcov/org.eclipse.linuxtools.gcov.core/META-INF/MANIFEST.MF
index 394a011771..48ba1c9904 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/META-INF/MANIFEST.MF
+++ b/gcov/org.eclipse.linuxtools.gcov.core/META-INF/MANIFEST.MF
@@ -20,10 +20,6 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.linuxtools.dataviewers.charts,
org.eclipse.linuxtools.dataviewers.annotatedsourceeditor,
org.eclipse.cdt.debug.core
-Export-Package: org.eclipse.linuxtools.gcov.model,
- org.eclipse.linuxtools.gcov.parser,
- org.eclipse.linuxtools.gcov.utils,
- org.eclipse.linuxtools.gcov.view
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Localization: plugin
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/plugin.xml b/gcov/org.eclipse.linuxtools.gcov.core/plugin.xml
index 35247d61b6..1fac0ec963 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/plugin.xml
+++ b/gcov/org.eclipse.linuxtools.gcov.core/plugin.xml
@@ -10,7 +10,7 @@
<view
allowMultiple="true"
category="org.eclipse.linuxtools.gcov"
- class="org.eclipse.linuxtools.gcov.view.CovView"
+ class="org.eclipse.linuxtools.internal.gcov.view.CovView"
icon="icons/toggle.gif"
id="org.eclipse.linuxtools.gcov.view"
name="%gcov"
@@ -20,7 +20,7 @@
<extension
point="org.eclipse.ui.editors">
<editor
- class="org.eclipse.linuxtools.gcov.view.annotatedsource.STAnnotatedSourceNotFoundEditor"
+ class="org.eclipse.linuxtools.internal.gcov.view.annotatedsource.STAnnotatedSourceNotFoundEditor"
icon="icons/src_file_obj.gif"
id="org.eclipse.linuxtools.gcov.view.annotatedsource.STAnnotatedSourceNotFoundEditor"
name="Source Not Found">
@@ -29,7 +29,7 @@
extensions="gcda, gcno"
icon="icons/toggle.gif"
id="org.eclipse.linuxtools.gcov.editor"
- launcher="org.eclipse.linuxtools.gcov.action.OpenGCAction"
+ launcher="org.eclipse.linuxtools.internal.gcov.action.OpenGCAction"
name="%gcovEditor">
</editor>
</extension>
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/action/OpenGCAction.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/action/OpenGCAction.java
index 28807f287f..317b226b44 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/action/OpenGCAction.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/action/OpenGCAction.java
@@ -8,7 +8,7 @@
* Contributors:
* Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
*******************************************************************************/
-package org.eclipse.linuxtools.gcov.action;
+package org.eclipse.linuxtools.internal.gcov.action;
import java.io.BufferedReader;
import java.io.File;
@@ -29,8 +29,8 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.linuxtools.gcov.Activator;
-import org.eclipse.linuxtools.gcov.dialog.OpenGCDialog;
-import org.eclipse.linuxtools.gcov.view.CovView;
+import org.eclipse.linuxtools.internal.gcov.dialog.OpenGCDialog;
+import org.eclipse.linuxtools.internal.gcov.view.CovView;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorLauncher;
import org.eclipse.ui.PlatformUI;
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/action/SwitchContentProviderAction.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/action/SwitchContentProviderAction.java
index b1ac0f24f0..2838c06b30 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/action/SwitchContentProviderAction.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/action/SwitchContentProviderAction.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.action;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ColumnViewer;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.linuxtools.gcov.Activator;
-
-
- /**
- * This action changes the content provider
- */
-
- public class SwitchContentProviderAction extends Action {
-
- private final ColumnViewer viewer;
- private final IContentProvider provider;
-
- public SwitchContentProviderAction(String name, String iconPath, ColumnViewer viewer, IContentProvider provider) {
- super(name, AS_RADIO_BUTTON);
- this.setImageDescriptor(Activator.getImageDescriptor(iconPath));
- this.setToolTipText(name);
- this.viewer = viewer;
- this.provider = provider;
- }
-
- @Override
- public void run() {
- viewer.getControl().setRedraw(false);
- viewer.setContentProvider(provider);
- ((TreeViewer)viewer).expandToLevel(2);
- viewer.getControl().setRedraw(true);
- }
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.action;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.linuxtools.gcov.Activator;
+
+
+ /**
+ * This action changes the content provider
+ */
+
+ public class SwitchContentProviderAction extends Action {
+
+ private final ColumnViewer viewer;
+ private final IContentProvider provider;
+
+ public SwitchContentProviderAction(String name, String iconPath, ColumnViewer viewer, IContentProvider provider) {
+ super(name, AS_RADIO_BUTTON);
+ this.setImageDescriptor(Activator.getImageDescriptor(iconPath));
+ this.setToolTipText(name);
+ this.viewer = viewer;
+ this.provider = provider;
+ }
+
+ @Override
+ public void run() {
+ viewer.getControl().setRedraw(false);
+ viewer.setContentProvider(provider);
+ ((TreeViewer)viewer).expandToLevel(2);
+ viewer.getControl().setRedraw(true);
+ }
} \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/dialog/OpenGCDialog.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/dialog/OpenGCDialog.java
index 5b69b71a36..f66c14aac4 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/dialog/OpenGCDialog.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/dialog/OpenGCDialog.java
@@ -8,7 +8,7 @@
* Contributors:
* Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
*******************************************************************************/
-package org.eclipse.linuxtools.gcov.dialog;
+package org.eclipse.linuxtools.internal.gcov.dialog;
import java.io.File;
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/AbstractTreeElement.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/AbstractTreeElement.java
index 0fcce342d6..82fca610ee 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/AbstractTreeElement.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/AbstractTreeElement.java
@@ -1,79 +1,79 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.model;
-
-import java.util.LinkedList;
-
-public abstract class AbstractTreeElement implements TreeElement{
-
- /**
- *
- */
- private static final long serialVersionUID = -4911602250295116203L;
- private final TreeElement parent;
- private final LinkedList<TreeElement> children = new LinkedList<TreeElement>();
- private final String name;
- private final int totalLines;
- private final int executedLines;
- private final int instrumentedLines;
-
- public AbstractTreeElement(TreeElement parent, String name, int totalLines,
- int executedLines, int instrumentedLines) {
- this.parent = parent;
- this.name = name;
- this.totalLines = totalLines;
- this.executedLines = executedLines;
- this.instrumentedLines = instrumentedLines;
- }
-
- public TreeElement getParent() {
- return parent;
- }
-
- public boolean hasChildren() {
- return (children.size()>0);
- }
-
- public LinkedList<? extends TreeElement> getChildren() {
- return children;
- }
-
- public String getName() {
- return name;
- }
-
- public TreeElement getRoot() {
- if (parent == null) return this;
- return parent.getRoot();
- }
-
- public int getExecutedLines() {
- return executedLines;
- }
-
- public int getInstrumentedLines() {
- return instrumentedLines;
- }
-
- public float getCoveragePercentage() {
- if (instrumentedLines !=0 )
- return (100.f*executedLines)/(instrumentedLines);
- else return 0;
- }
-
- public void addChild(TreeElement child){
- children.add(child);
- }
-
- public int getTotalLines() {
- return totalLines;
- }
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.model;
+
+import java.util.LinkedList;
+
+public abstract class AbstractTreeElement implements TreeElement{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -4911602250295116203L;
+ private final TreeElement parent;
+ private final LinkedList<TreeElement> children = new LinkedList<TreeElement>();
+ private final String name;
+ private final int totalLines;
+ private final int executedLines;
+ private final int instrumentedLines;
+
+ public AbstractTreeElement(TreeElement parent, String name, int totalLines,
+ int executedLines, int instrumentedLines) {
+ this.parent = parent;
+ this.name = name;
+ this.totalLines = totalLines;
+ this.executedLines = executedLines;
+ this.instrumentedLines = instrumentedLines;
+ }
+
+ public TreeElement getParent() {
+ return parent;
+ }
+
+ public boolean hasChildren() {
+ return (children.size()>0);
+ }
+
+ public LinkedList<? extends TreeElement> getChildren() {
+ return children;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public TreeElement getRoot() {
+ if (parent == null) return this;
+ return parent.getRoot();
+ }
+
+ public int getExecutedLines() {
+ return executedLines;
+ }
+
+ public int getInstrumentedLines() {
+ return instrumentedLines;
+ }
+
+ public float getCoveragePercentage() {
+ if (instrumentedLines !=0 )
+ return (100.f*executedLines)/(instrumentedLines);
+ else return 0;
+ }
+
+ public void addChild(TreeElement child){
+ children.add(child);
+ }
+
+ public int getTotalLines() {
+ return totalLines;
+ }
} \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/CovFileTreeElement.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFileTreeElement.java
index 5bfa929760..82a1d4e38b 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/CovFileTreeElement.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFileTreeElement.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.model;
-
-
-public class CovFileTreeElement extends AbstractTreeElement {
-
- /**
- *
- */
- private static final long serialVersionUID = -5017234616535899796L;
-
- public CovFileTreeElement(TreeElement parent,
- String name, int totalLines, int executedLines, int instrumentedLines) {
- super(parent, name, totalLines, executedLines, instrumentedLines);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.model;
+
+
+public class CovFileTreeElement extends AbstractTreeElement {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5017234616535899796L;
+
+ public CovFileTreeElement(TreeElement parent,
+ String name, int totalLines, int executedLines, int instrumentedLines) {
+ super(parent, name, totalLines, executedLines, instrumentedLines);
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/CovFolderTreeElement.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFolderTreeElement.java
index 8bfafdf70b..9e9b6c9549 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/CovFolderTreeElement.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFolderTreeElement.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.model;
-
-public class CovFolderTreeElement extends AbstractTreeElement {
-
- /**
- *
- */
- private static final long serialVersionUID = 583359546284716138L;
-
- public CovFolderTreeElement(TreeElement parent,
- String name, int totalLines, int executedLines, int instrumentedLines) {
- super(parent, name, totalLines, executedLines, instrumentedLines);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.model;
+
+public class CovFolderTreeElement extends AbstractTreeElement {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 583359546284716138L;
+
+ public CovFolderTreeElement(TreeElement parent,
+ String name, int totalLines, int executedLines, int instrumentedLines) {
+ super(parent, name, totalLines, executedLines, instrumentedLines);
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/CovFunctionTreeElement.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFunctionTreeElement.java
index 3f5e32eeae..7f00e2f35c 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/CovFunctionTreeElement.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFunctionTreeElement.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.model;
-
-import java.util.LinkedList;
-
-
-public class CovFunctionTreeElement extends AbstractTreeElement {
-
- /**
- *
- */
- private static final long serialVersionUID = -2025221943523670378L;
- private final String sourceFilePath;
- private final long firstLnNmbr;
-
- public CovFunctionTreeElement(TreeElement parent, String name, String sourceFilePath,
- long firstLnNmbr, int executedLines, int instrumentedLines) {
- super(parent, name, 0, executedLines, instrumentedLines);
- this.sourceFilePath = sourceFilePath;
- this.firstLnNmbr = firstLnNmbr;
- }
-
-
- /* no children for functions*/
-
- public boolean hasChildren() {
- return false;
- }
-
- public LinkedList<? extends TreeElement> getChildren() {
- return null;
- }
-
- public void addChild(TreeElement child){
- }
-
-
- /* specific methods for functions*/
-
- public String getSourceFilePath() {
- return sourceFilePath;
- }
-
- public long getFirstLnNmbr() {
- return firstLnNmbr;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.model;
+
+import java.util.LinkedList;
+
+
+public class CovFunctionTreeElement extends AbstractTreeElement {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2025221943523670378L;
+ private final String sourceFilePath;
+ private final long firstLnNmbr;
+
+ public CovFunctionTreeElement(TreeElement parent, String name, String sourceFilePath,
+ long firstLnNmbr, int executedLines, int instrumentedLines) {
+ super(parent, name, 0, executedLines, instrumentedLines);
+ this.sourceFilePath = sourceFilePath;
+ this.firstLnNmbr = firstLnNmbr;
+ }
+
+
+ /* no children for functions*/
+
+ public boolean hasChildren() {
+ return false;
+ }
+
+ public LinkedList<? extends TreeElement> getChildren() {
+ return null;
+ }
+
+ public void addChild(TreeElement child){
+ }
+
+
+ /* specific methods for functions*/
+
+ public String getSourceFilePath() {
+ return sourceFilePath;
+ }
+
+ public long getFirstLnNmbr() {
+ return firstLnNmbr;
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/CovRootTreeElement.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovRootTreeElement.java
index 57d879e80d..366dc9b6e4 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/CovRootTreeElement.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovRootTreeElement.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.model;
-
-import java.io.Serializable;
-
-public class CovRootTreeElement extends AbstractTreeElement implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 877070271548608926L;
-
- public CovRootTreeElement(String name, int totalLines, int executedLines,
- int instrumentedLines) {
- super(null, name, totalLines, executedLines, instrumentedLines);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.model;
+
+import java.io.Serializable;
+
+public class CovRootTreeElement extends AbstractTreeElement implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 877070271548608926L;
+
+ public CovRootTreeElement(String name, int totalLines, int executedLines,
+ int instrumentedLines) {
+ super(null, name, totalLines, executedLines, instrumentedLines);
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/TreeElement.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/TreeElement.java
index d489010c0f..ee6d708e6a 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/model/TreeElement.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/TreeElement.java
@@ -8,7 +8,7 @@
* Contributors:
* Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
*******************************************************************************/
-package org.eclipse.linuxtools.gcov.model;
+package org.eclipse.linuxtools.internal.gcov.model;
import java.io.Serializable;
import java.util.LinkedList;
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Arc.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Arc.java
index 848462be4b..6323c8cbea 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Arc.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Arc.java
@@ -1,131 +1,131 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.parser;
-
-import java.io.Serializable;
-import java.util.List;
-
-public class Arc implements Serializable{
-
- /**
- *
- */
- private static final long serialVersionUID = 4104429137191407662L;
-
- private static final int VCOV_ARC_ON_TREE = (1 << 0);
- private static final int VCOV_ARC_FAKE = (1 << 1);
- private static final int VCOV_ARC_FALLTHROUGH = (1 << 2);
-
- private final Block srcBlock;
- private final Block dstnatnBlock;
- private final long flag;
- private final boolean fake;
- private final boolean onTree;
- private final boolean fallthrough;
-
- private long count = 0;
- private boolean countValid = false;
- private boolean isCallNonReturn = false; // Arc is for a function that abnormally returns
- private boolean isNonLoclaReturn = false; // Arc is for catch/setjump
- private boolean isUnconditionnal = false; // Is an unconditional branch.
-
- /**
- * Constructor
- */
- public Arc(int srcBlockIndice, int dstnatnBlockIndice, long flag, List<Block> otherArcParams) {
- this.flag = flag;
- this.dstnatnBlock = otherArcParams.get(dstnatnBlockIndice);
- this.srcBlock = otherArcParams.get(srcBlockIndice);
- this.count = 0;
- this.countValid = false;
- if ((flag & VCOV_ARC_ON_TREE) != 0) {
- onTree = true;
- fake = false;
- fallthrough = false;
- } else if ((flag & VCOV_ARC_FAKE) != 0) {
- onTree = false;
- fake = true;
- fallthrough = true;
- } else if ((flag & VCOV_ARC_FALLTHROUGH) != 0) {
- onTree = false;
- fake = false;
- fallthrough = true;
- } else {
- onTree = false;
- fake = false;
- fallthrough = false;
- }
- }
-
- public Block getDstnatnBlock() {
- return dstnatnBlock;
- }
-
- public long getFlag() {
- return flag;
- }
-
- public boolean isFake() {
- return fake;
- }
-
- public boolean isOnTree() {
- return onTree;
- }
-
- public boolean isFallthrough() {
- return fallthrough;
- }
-
- public boolean isUnconditionnal() {
- return isUnconditionnal;
- }
-
- public boolean isNonLoclaReturn() {
- return isNonLoclaReturn;
- }
-
- public boolean isCallNonReturn() {
- return isCallNonReturn;
- }
-
- public void setCallNonReturn(boolean isCallNonReturn) {
- this.isCallNonReturn = isCallNonReturn;
- }
-
- public void setNonLoclaReturn(boolean isNonLoclaReturn) {
- this.isNonLoclaReturn = isNonLoclaReturn;
- }
-
- public void setUnconditionnal(boolean isUnconditionnal) {
- this.isUnconditionnal = isUnconditionnal;
- }
-
- public Block getSrcBlock() {
- return srcBlock;
- }
-
- public void setCount(long count) {
- this.count = count;
- }
-
- public void setCountValid(boolean countValid) {
- this.countValid = countValid;
- }
-
- public long getCount() {
- return count;
- }
-
- public boolean isCountValid() {
- return countValid;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.parser;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class Arc implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4104429137191407662L;
+
+ private static final int VCOV_ARC_ON_TREE = (1 << 0);
+ private static final int VCOV_ARC_FAKE = (1 << 1);
+ private static final int VCOV_ARC_FALLTHROUGH = (1 << 2);
+
+ private final Block srcBlock;
+ private final Block dstnatnBlock;
+ private final long flag;
+ private final boolean fake;
+ private final boolean onTree;
+ private final boolean fallthrough;
+
+ private long count = 0;
+ private boolean countValid = false;
+ private boolean isCallNonReturn = false; // Arc is for a function that abnormally returns
+ private boolean isNonLoclaReturn = false; // Arc is for catch/setjump
+ private boolean isUnconditionnal = false; // Is an unconditional branch.
+
+ /**
+ * Constructor
+ */
+ public Arc(int srcBlockIndice, int dstnatnBlockIndice, long flag, List<Block> otherArcParams) {
+ this.flag = flag;
+ this.dstnatnBlock = otherArcParams.get(dstnatnBlockIndice);
+ this.srcBlock = otherArcParams.get(srcBlockIndice);
+ this.count = 0;
+ this.countValid = false;
+ if ((flag & VCOV_ARC_ON_TREE) != 0) {
+ onTree = true;
+ fake = false;
+ fallthrough = false;
+ } else if ((flag & VCOV_ARC_FAKE) != 0) {
+ onTree = false;
+ fake = true;
+ fallthrough = true;
+ } else if ((flag & VCOV_ARC_FALLTHROUGH) != 0) {
+ onTree = false;
+ fake = false;
+ fallthrough = true;
+ } else {
+ onTree = false;
+ fake = false;
+ fallthrough = false;
+ }
+ }
+
+ public Block getDstnatnBlock() {
+ return dstnatnBlock;
+ }
+
+ public long getFlag() {
+ return flag;
+ }
+
+ public boolean isFake() {
+ return fake;
+ }
+
+ public boolean isOnTree() {
+ return onTree;
+ }
+
+ public boolean isFallthrough() {
+ return fallthrough;
+ }
+
+ public boolean isUnconditionnal() {
+ return isUnconditionnal;
+ }
+
+ public boolean isNonLoclaReturn() {
+ return isNonLoclaReturn;
+ }
+
+ public boolean isCallNonReturn() {
+ return isCallNonReturn;
+ }
+
+ public void setCallNonReturn(boolean isCallNonReturn) {
+ this.isCallNonReturn = isCallNonReturn;
+ }
+
+ public void setNonLoclaReturn(boolean isNonLoclaReturn) {
+ this.isNonLoclaReturn = isNonLoclaReturn;
+ }
+
+ public void setUnconditionnal(boolean isUnconditionnal) {
+ this.isUnconditionnal = isUnconditionnal;
+ }
+
+ public Block getSrcBlock() {
+ return srcBlock;
+ }
+
+ public void setCount(long count) {
+ this.count = count;
+ }
+
+ public void setCountValid(boolean countValid) {
+ this.countValid = countValid;
+ }
+
+ public long getCount() {
+ return count;
+ }
+
+ public boolean isCountValid() {
+ return countValid;
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Block.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Block.java
index 5ada91b7c8..f75cfcf616 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Block.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Block.java
@@ -1,177 +1,177 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.parser;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-public class Block implements Serializable{
-
- /**
- *
- */
- private static final long serialVersionUID = -7665287885679756014L;
- private final ArrayList<Arc> entryArcs = new ArrayList<Arc>();
- private final ArrayList<Arc> exitArcs = new ArrayList<Arc>();
- private final long flag;
- private long numSuccs = 0;
- private long numPreds = 0;
- private long count = 0;
- private boolean isCallSite = false;// Does the call
- private boolean isCallReturn = false; // Is the return
- private boolean isNonLocalReturn = false;
- private boolean validChain = false;
- private boolean invalidChain = false;
- private boolean countValid = false;
- private final BlkLine blkline = new BlkLine();
-
- /**
- * Constructor
- */
- public Block(long flag) {
- this.flag = flag;
- }
-
-
- /* getters & setters */
- public long getFlag() {
- return flag;
- }
-
- public ArrayList<Arc> getEntryArcs() {
- return entryArcs;
- }
-
- public ArrayList<Arc> getExitArcs() {
- return exitArcs;
- }
-
- public boolean isCallSite() {
- return isCallSite;
- }
-
- public boolean isCallReturn() {
- return isCallReturn;
- }
-
- public boolean isNonLocalReturn() {
- return isNonLocalReturn;
- }
-
- public void addEntryArcs(Arc arcEntry) {
- this.entryArcs.add(arcEntry);
- }
-
- public void addExitArcs(Arc arcExit) {
- this.exitArcs.add(arcExit);
- }
-
- public void setCallSite(boolean isCallSite) {
- this.isCallSite = isCallSite;
- }
-
- public void setCallReturn(boolean isCallReturn) {
- this.isCallReturn = isCallReturn;
- }
-
- public void setNonLocalReturn(boolean isNonLocalReturn) {
- this.isNonLocalReturn = isNonLocalReturn;
- }
-
- public void decNumSuccs() {
- this.numSuccs--;
- }
-
- public void decNumPreds() {
- this.numPreds--;
- }
-
- public void incNumPreds() {
- this.numPreds++;
- }
-
- public void incNumSuccs() {
- this.numSuccs++;
- }
-
- public boolean isValidChain() {
- return validChain;
- }
-
- public void setValidChain(boolean validChain) {
- this.validChain = validChain;
- }
-
- public boolean isInvalidChain() {
- return invalidChain;
- }
-
- public void setInvalidChain(boolean invalidChain) {
- this.invalidChain = invalidChain;
- }
-
- public long getCount() {
- return count;
- }
-
- public void setCount(long count) {
- this.count = count;
- }
-
- public void setCountValid(boolean countValid) {
- this.countValid = countValid;
- }
-
- public boolean isCountValid() {
- return countValid;
- }
-
- public long getNumSuccs() {
- return numSuccs;
- }
-
- public long getNumPreds() {
- return numPreds;
- }
-
- public void setNumSuccs(long numSuccs) {
- this.numSuccs = numSuccs;
- }
-
- public void setNumPreds(long numPreds) {
- this.numPreds = numPreds;
- }
-
- public long[] getEncoding() {
- return blkline.encoding;
- }
-
- public void setEncoding(long[] lineNos) {
- this.blkline.encoding = lineNos;
- }
-
- public int getLineNum() {
- return blkline.num;
- }
-
- public void setNumLine(int numline) {
- this.blkline.num = numline;
- }
-
- static class BlkLine implements Serializable{
- /**
- *
- */
- private static final long serialVersionUID = 2757557929188979686L;
- public long[] encoding;
- public int num;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.parser;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+public class Block implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7665287885679756014L;
+ private final ArrayList<Arc> entryArcs = new ArrayList<Arc>();
+ private final ArrayList<Arc> exitArcs = new ArrayList<Arc>();
+ private final long flag;
+ private long numSuccs = 0;
+ private long numPreds = 0;
+ private long count = 0;
+ private boolean isCallSite = false;// Does the call
+ private boolean isCallReturn = false; // Is the return
+ private boolean isNonLocalReturn = false;
+ private boolean validChain = false;
+ private boolean invalidChain = false;
+ private boolean countValid = false;
+ private final BlkLine blkline = new BlkLine();
+
+ /**
+ * Constructor
+ */
+ public Block(long flag) {
+ this.flag = flag;
+ }
+
+
+ /* getters & setters */
+ public long getFlag() {
+ return flag;
+ }
+
+ public ArrayList<Arc> getEntryArcs() {
+ return entryArcs;
+ }
+
+ public ArrayList<Arc> getExitArcs() {
+ return exitArcs;
+ }
+
+ public boolean isCallSite() {
+ return isCallSite;
+ }
+
+ public boolean isCallReturn() {
+ return isCallReturn;
+ }
+
+ public boolean isNonLocalReturn() {
+ return isNonLocalReturn;
+ }
+
+ public void addEntryArcs(Arc arcEntry) {
+ this.entryArcs.add(arcEntry);
+ }
+
+ public void addExitArcs(Arc arcExit) {
+ this.exitArcs.add(arcExit);
+ }
+
+ public void setCallSite(boolean isCallSite) {
+ this.isCallSite = isCallSite;
+ }
+
+ public void setCallReturn(boolean isCallReturn) {
+ this.isCallReturn = isCallReturn;
+ }
+
+ public void setNonLocalReturn(boolean isNonLocalReturn) {
+ this.isNonLocalReturn = isNonLocalReturn;
+ }
+
+ public void decNumSuccs() {
+ this.numSuccs--;
+ }
+
+ public void decNumPreds() {
+ this.numPreds--;
+ }
+
+ public void incNumPreds() {
+ this.numPreds++;
+ }
+
+ public void incNumSuccs() {
+ this.numSuccs++;
+ }
+
+ public boolean isValidChain() {
+ return validChain;
+ }
+
+ public void setValidChain(boolean validChain) {
+ this.validChain = validChain;
+ }
+
+ public boolean isInvalidChain() {
+ return invalidChain;
+ }
+
+ public void setInvalidChain(boolean invalidChain) {
+ this.invalidChain = invalidChain;
+ }
+
+ public long getCount() {
+ return count;
+ }
+
+ public void setCount(long count) {
+ this.count = count;
+ }
+
+ public void setCountValid(boolean countValid) {
+ this.countValid = countValid;
+ }
+
+ public boolean isCountValid() {
+ return countValid;
+ }
+
+ public long getNumSuccs() {
+ return numSuccs;
+ }
+
+ public long getNumPreds() {
+ return numPreds;
+ }
+
+ public void setNumSuccs(long numSuccs) {
+ this.numSuccs = numSuccs;
+ }
+
+ public void setNumPreds(long numPreds) {
+ this.numPreds = numPreds;
+ }
+
+ public long[] getEncoding() {
+ return blkline.encoding;
+ }
+
+ public void setEncoding(long[] lineNos) {
+ this.blkline.encoding = lineNos;
+ }
+
+ public int getLineNum() {
+ return blkline.num;
+ }
+
+ public void setNumLine(int numline) {
+ this.blkline.num = numline;
+ }
+
+ static class BlkLine implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2757557929188979686L;
+ public long[] encoding;
+ public int num;
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/CovManager.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java
index d7345d8cf9..16739cc61c 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/CovManager.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java
@@ -1,454 +1,454 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.parser;
-
-import java.io.BufferedInputStream;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.LineNumberReader;
-import java.io.PrintStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.linuxtools.binutils.utils.STSymbolManager;
-import org.eclipse.linuxtools.gcov.Activator;
-import org.eclipse.linuxtools.gcov.model.CovFileTreeElement;
-import org.eclipse.linuxtools.gcov.model.CovFolderTreeElement;
-import org.eclipse.linuxtools.gcov.model.CovFunctionTreeElement;
-import org.eclipse.linuxtools.gcov.model.CovRootTreeElement;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Xavier Raynaud <xavier.raynaud@st.com>
- *
- */
-public class CovManager implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 5582066617970911413L;
- // input
- private final String binaryPath;
- // results
- private final ArrayList<Folder> allFolders = new ArrayList<Folder>();
- private final ArrayList<SourceFile> allSrcs = new ArrayList<SourceFile>();
- private final ArrayList<GcnoFunction> allFnctns = new ArrayList<GcnoFunction>();
- private final HashMap<String, SourceFile> sourceMap = new HashMap<String, SourceFile>();
- private long nbrPgmRuns = 0;
- // for view
- private CovRootTreeElement rootNode;
- private IProject project;
-
- /**
- * Constructor
- * @param binaryPath
- * @param project the project that will be used to get the path to run commands
- */
- public CovManager(String binaryPath, IProject project) {
- this.binaryPath = binaryPath;
- this.project = project;
- }
-
- /**
- * Constructor
- * @param binaryPath
- */
- public CovManager(String binaryPath) {
- this(binaryPath, null);
- }
-
- /**
- * parse coverage files, execute resolve graph algorithm, process counts for functions,
- * lines and folders.
- * @param List of coverage files paths
- * @throws CoreException, IOException, InterruptedException
- */
-
- public void processCovFiles(List<String> covFilesPaths, String initialGcda) throws CoreException, IOException, InterruptedException {
- GcdaRecordsParser daRcrd = null;
- DataInput traceFile;
-
- Map<File, File> sourcePath = new HashMap<File, File>();
-
- if (initialGcda != null) {
- File initialGcdaFile = new File(initialGcda).getAbsoluteFile();
- for (String s : covFilesPaths) {
- File gcda = new File(s).getAbsoluteFile();
- if (gcda.getName().equals(initialGcdaFile.getName()) && !gcda.equals(initialGcdaFile)) {
- if (!sourcePath.isEmpty()) {
- // hum... another file has the same name...
- // sorry, we have to clean sourcePath
- sourcePath.clear();
- break;
- } else {
- addSourceLookup(sourcePath, initialGcdaFile, gcda);
- }
- }
- }
- }
-
-
-
- for (String gcdaPath: covFilesPaths) {
- String gcnoPath = gcdaPath.replace(".gcda", ".gcno");
- // parse GCNO file
- traceFile = OpenTraceFileStream(gcnoPath, ".gcno", sourcePath);
- if (traceFile == null) return;
- GcnoRecordsParser noRcrd = new GcnoRecordsParser(sourceMap, allSrcs);
- noRcrd.parseData(traceFile);
-
- // add new functions parsed to AllSrcs array
- for (GcnoFunction f: noRcrd.getFnctns()) {
- allFnctns.add(f);
- }
-
- //close the input stream
- if(traceFile.getClass() == DataInputStream.class)
- ((DataInputStream)traceFile).close();
-
- // parse GCDA file
- traceFile = OpenTraceFileStream(gcdaPath, ".gcda", sourcePath);
- if (traceFile == null) return;
- if (noRcrd.getFnctns().isEmpty()){
- String message = gcnoPath + " doesn't contain any function:\n";
- Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
- throw new CoreException(status);
- }
- daRcrd = new GcdaRecordsParser(noRcrd.getFnctns());
- daRcrd.parseGcdaRecord(traceFile);
-
- //close the input stream
- if(traceFile.getClass() == DataInputStream.class)
- ((DataInputStream)traceFile).close();
- }
-
- // to fill the view title
- if (daRcrd != null)
- nbrPgmRuns = daRcrd.getObjSmryNbrPgmRuns();
- /* process counts from data parsed */
-
- // solve graph for each function
- for (GcnoFunction gf : allFnctns) {
- gf.solveGraphFnctn();
- }
-
- // allocate lines
- for (SourceFile sourceFile: allSrcs) {
- sourceFile.createLines();
- }
-
- // add line counts
- for (GcnoFunction gf : allFnctns) {
- gf.addLineCounts(allSrcs);
- }
-
- // accumulate lines
- for (SourceFile sf: allSrcs) {
- sf.accumulateLineCounts();
- }
-
- /* compute counts by folder*/
-
- // make the folders list
- for (SourceFile sf : allSrcs) {
- File srcFile = new File (sf.getName());
- String folderName = srcFile.getParent();
- if (folderName == null) folderName = "?";
- Folder folder = null;
- for (Folder f: allFolders) {
- if (f.getPath().equals(folderName))
- folder = f;
- }
- if (folder == null){
- folder = new Folder(folderName);
- allFolders.add(folder);
- }
- folder.addSrcFiles(sf);
- }
-
- // assign sourcesList for each folder
- for (Folder f : allFolders) {
- f.accumulateSourcesCounts();
- }
- }
-
-
- /**
- * fill the model by count results
- * @throws CoreException, IOException, InterruptedException
- */
-
- public void fillGcovView() {
- // process counts for summary level
- int summaryTotal = 0, summaryInstrumented = 0, summaryExecuted = 0;
- for (Folder f : allFolders) {
- summaryTotal+=f.getNumLines();
- summaryInstrumented+=f.getLinesInstrumented();
- summaryExecuted+=f.getLinesExecuted();
- }
-
- // fill rootNode model: the entry of the contentProvider
- rootNode = new CovRootTreeElement("Summary", summaryTotal,summaryExecuted,
- summaryInstrumented);
- IBinaryObject binaryObject = STSymbolManager.sharedInstance.getBinaryObject(new Path(binaryPath));
-
- for (Folder fldr : allFolders) {
- String folderLocation = fldr.getPath();
- CovFolderTreeElement fldrTreeElem = new CovFolderTreeElement(
- rootNode, folderLocation, fldr.getNumLines(), fldr.getLinesExecuted(),
- fldr.getLinesInstrumented());
- rootNode.addChild(fldrTreeElem);
-
- for (SourceFile src : fldr.getSrcFiles()) {
- CovFileTreeElement srcTreeElem = new CovFileTreeElement(
- fldrTreeElem, src.getName(), src.getNumLines(), src
- .getLinesExecuted(), src.getLinesInstrumented());
- fldrTreeElem.addChild(srcTreeElem);
-
- for (GcnoFunction fnctn : src.getFnctns()) {
- String name = fnctn.getName();
- name = STSymbolManager.sharedInstance.demangle(binaryObject, name, project);;
- srcTreeElem.addChild(new CovFunctionTreeElement(
- srcTreeElem, name, fnctn.getSrcFile(), fnctn
- .getFirstLineNmbr(), fnctn.getCvrge()
- .getLinesExecuted(), fnctn.getCvrge()
- .getLinesInstrumented()));
- }
- }
- }
- }
-
- // transform String path to stream
- private DataInput OpenTraceFileStream(String filePath, String extension, Map<File, File> sourcePath) throws FileNotFoundException{
- File f = new File(filePath).getAbsoluteFile();
- if (f.isFile() && f.canRead()) {
- FileInputStream fis = new FileInputStream(f);
- InputStream inputStream = new BufferedInputStream(fis);
- return new DataInputStream(inputStream);
- } else {
- String postfix = "";
- File dir = null;
- do {
- if ("".equals(postfix)) postfix = f.getName();
- else postfix = f.getName() + File.separator + postfix;
- f = f.getParentFile();
- if (f != null) {
- dir = sourcePath.get(f);
- } else break;
- } while (dir == null);
-
- if (dir != null) {
- f = new File(dir, postfix);
- if (f.isFile() && f.canRead()) {
- return OpenTraceFileStream(f.getAbsolutePath(), extension, sourcePath);
- }
- }
-
-
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- FileDialog fg = new FileDialog(shell, SWT.OPEN);
- fg.setFilterExtensions(new String[] {"*" + extension, "*.*", "*"});
- fg.setFileName(f.getName());
- String s = fg.open();
- if (s == null) return null;
- else {
- f = new File(s).getAbsoluteFile();
- addSourceLookup(sourcePath, f, new File(filePath).getAbsoluteFile());
- if (f.isFile() && f.canRead()) {
- FileInputStream fis = new FileInputStream(f);
- InputStream inputStream = new BufferedInputStream(fis);
- return new DataInputStream(inputStream);
- }
- }
- }
- return null;
- }
-
-
- public ArrayList<SourceFile> getAllSrcs() {
- return allSrcs;
- }
-
- public ArrayList<GcnoFunction> getAllFnctns() {
- return allFnctns;
- }
-
- public CovRootTreeElement getRootNode() {
- return rootNode;
- }
-
- public String getBinaryPath() {
- return binaryPath;
- }
-
- public SourceFile getSourceFile(String sourcePath){
- return sourceMap.get(sourcePath);
- }
-
- public long getNbrPgmRuns() {
- return nbrPgmRuns;
- }
-
- /**
- * Retrieve a list containing gcda paths from a binary file
- * @return
- * @throws CoreException
- * @throws IOException
- * @throws InterruptedException
- */
- public List<String> getGCDALocations() throws CoreException, IOException, InterruptedException
- {
- IBinaryObject binaryObject = STSymbolManager.sharedInstance.getBinaryObject(new Path(binaryPath));
- String binaryPath = binaryObject.getPath().toOSString();
- List<String> l = new LinkedList<String>();
- String cpu = binaryObject.getCPU();
- Process p;
- if ("sh".equals(cpu)) {
- String stringsTool = "sh4strings";
- p = getStringsProcess(stringsTool, binaryPath);
- if ( p == null) p = getStringsProcess("sh4-linux-strings", binaryPath);
- } else if ("stxp70".equals(cpu)) {
- String stringsTool = "stxp70v3-strings";
- p = getStringsProcess(stringsTool, binaryPath);
- } else if ("st200".equals(cpu)){
- String stringsTool = cpu + "strings";
- p = getStringsProcess(stringsTool, binaryPath);
- } else {
- String stringsTool = "strings";
- p = getStringsProcess(stringsTool, binaryPath);
- }
- if (p == null) {
- Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR,
- "An error occured during analysis: unable to retrieve gcov data", new IOException());
- Activator.getDefault().getLog().log(status);
- return l;
- }
- ThreadConsumer t = new ThreadConsumer(p, l);
- t.start();
- p.waitFor();
- t.join();
- return l;
- }
-
-
- private Process getStringsProcess(String stringsTool, String binaryPath) {
- try {
- Process p = Runtime.getRuntime().exec(new String[] {stringsTool, binaryPath });
- return p;
- } catch (Exception _) {
- return null;
- }
- }
-
-
-
- private static final class ThreadConsumer extends Thread
- {
- private final Process p;
- private final List<String> list;
- ThreadConsumer(Process p, List<String> files)
- {
- super();
- this.p = p;
- this.list = files;
- }
-
- public void run()
- {
- try {
- populateGCDAFiles(p.getInputStream());
- } catch (Exception _) {
- }
- }
-
- private void populateGCDAFiles(InputStream s) throws IOException
- {
- InputStreamReader isr = new InputStreamReader(s);
- LineNumberReader lnr = new LineNumberReader(isr);
- String line = null;
- while ((line =lnr.readLine()) != null) {
- if (line.endsWith(".gcda"))
- {
- // absolute .gcda filepaths retrieved using the "strings" tool may
- // be prefixed by random printable characters so strip leading
- // characters until the filepath starts with "X:/", "X:\", "/" or "\"
- // FIXME: need a more robust mechanism to locate .gcda files [Bugzilla 329710]
- while ((line.length() > 6) && !line.matches("^([A-Za-z]:)?[/\\\\].*")) {
- line = line.substring(1);
- }
- IPath p = new Path(line);
- String filename = p.toString();
-
-
- if (!list.contains(filename)) list.add(filename);
- }
- }
- }
- }
-
- public void dumpProcessCovFilesResult(PrintStream ps) throws FileNotFoundException {
- ps.println("Parse gcda and gcno files done, resolve graph algorithm executed, now display results");
- ps.println("- PRINT FUNCTIONS ARRAY : ");
- for (int i = 0; i < allFnctns.size(); i++) {
- ps.println("-- FUNCTION " +i);
- ps.println(" name = " + allFnctns.get(i).getName());
- ps.println(" instrumentd lines = " + allFnctns.get(i).getCvrge().getLinesInstrumented());
- ps.println(" executed lines = "+ allFnctns.get(i).getCvrge().getLinesExecuted());
- }
- ps.println("- PRINT SRCS ARRAY : ");
- for (int i = 0; i < allSrcs.size(); i++) {
- ps.println("-- FILE " + i);
- ps.println(" name = " + allSrcs.get(i).getName());
- ps.println(" total lines = " + allSrcs.get(i).getNumLines());
- ps.println(" instrumentd lines = "+ allSrcs.get(i).getLinesInstrumented());
- ps.println(" executed lines = "+ allSrcs.get(i).getLinesExecuted());
- }
- }
-
-
- /**
- * @return the sourceMap
- */
- public HashMap<String, SourceFile> getSourceMap() {
- return sourceMap;
- }
-
-
- private void addSourceLookup(Map<File, File> map, File hostPath, File compilerPath) {
- while (hostPath.getName().equals(compilerPath.getName())) {
- hostPath = hostPath.getParentFile();
- compilerPath = compilerPath.getParentFile();
- }
- map.put(compilerPath, hostPath);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.parser;
+
+import java.io.BufferedInputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.io.PrintStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.linuxtools.binutils.utils.STSymbolManager;
+import org.eclipse.linuxtools.gcov.Activator;
+import org.eclipse.linuxtools.internal.gcov.model.CovFileTreeElement;
+import org.eclipse.linuxtools.internal.gcov.model.CovFolderTreeElement;
+import org.eclipse.linuxtools.internal.gcov.model.CovFunctionTreeElement;
+import org.eclipse.linuxtools.internal.gcov.model.CovRootTreeElement;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Xavier Raynaud <xavier.raynaud@st.com>
+ *
+ */
+public class CovManager implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5582066617970911413L;
+ // input
+ private final String binaryPath;
+ // results
+ private final ArrayList<Folder> allFolders = new ArrayList<Folder>();
+ private final ArrayList<SourceFile> allSrcs = new ArrayList<SourceFile>();
+ private final ArrayList<GcnoFunction> allFnctns = new ArrayList<GcnoFunction>();
+ private final HashMap<String, SourceFile> sourceMap = new HashMap<String, SourceFile>();
+ private long nbrPgmRuns = 0;
+ // for view
+ private CovRootTreeElement rootNode;
+ private IProject project;
+
+ /**
+ * Constructor
+ * @param binaryPath
+ * @param project the project that will be used to get the path to run commands
+ */
+ public CovManager(String binaryPath, IProject project) {
+ this.binaryPath = binaryPath;
+ this.project = project;
+ }
+
+ /**
+ * Constructor
+ * @param binaryPath
+ */
+ public CovManager(String binaryPath) {
+ this(binaryPath, null);
+ }
+
+ /**
+ * parse coverage files, execute resolve graph algorithm, process counts for functions,
+ * lines and folders.
+ * @param List of coverage files paths
+ * @throws CoreException, IOException, InterruptedException
+ */
+
+ public void processCovFiles(List<String> covFilesPaths, String initialGcda) throws CoreException, IOException, InterruptedException {
+ GcdaRecordsParser daRcrd = null;
+ DataInput traceFile;
+
+ Map<File, File> sourcePath = new HashMap<File, File>();
+
+ if (initialGcda != null) {
+ File initialGcdaFile = new File(initialGcda).getAbsoluteFile();
+ for (String s : covFilesPaths) {
+ File gcda = new File(s).getAbsoluteFile();
+ if (gcda.getName().equals(initialGcdaFile.getName()) && !gcda.equals(initialGcdaFile)) {
+ if (!sourcePath.isEmpty()) {
+ // hum... another file has the same name...
+ // sorry, we have to clean sourcePath
+ sourcePath.clear();
+ break;
+ } else {
+ addSourceLookup(sourcePath, initialGcdaFile, gcda);
+ }
+ }
+ }
+ }
+
+
+
+ for (String gcdaPath: covFilesPaths) {
+ String gcnoPath = gcdaPath.replace(".gcda", ".gcno");
+ // parse GCNO file
+ traceFile = OpenTraceFileStream(gcnoPath, ".gcno", sourcePath);
+ if (traceFile == null) return;
+ GcnoRecordsParser noRcrd = new GcnoRecordsParser(sourceMap, allSrcs);
+ noRcrd.parseData(traceFile);
+
+ // add new functions parsed to AllSrcs array
+ for (GcnoFunction f: noRcrd.getFnctns()) {
+ allFnctns.add(f);
+ }
+
+ //close the input stream
+ if(traceFile.getClass() == DataInputStream.class)
+ ((DataInputStream)traceFile).close();
+
+ // parse GCDA file
+ traceFile = OpenTraceFileStream(gcdaPath, ".gcda", sourcePath);
+ if (traceFile == null) return;
+ if (noRcrd.getFnctns().isEmpty()){
+ String message = gcnoPath + " doesn't contain any function:\n";
+ Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
+ throw new CoreException(status);
+ }
+ daRcrd = new GcdaRecordsParser(noRcrd.getFnctns());
+ daRcrd.parseGcdaRecord(traceFile);
+
+ //close the input stream
+ if(traceFile.getClass() == DataInputStream.class)
+ ((DataInputStream)traceFile).close();
+ }
+
+ // to fill the view title
+ if (daRcrd != null)
+ nbrPgmRuns = daRcrd.getObjSmryNbrPgmRuns();
+ /* process counts from data parsed */
+
+ // solve graph for each function
+ for (GcnoFunction gf : allFnctns) {
+ gf.solveGraphFnctn();
+ }
+
+ // allocate lines
+ for (SourceFile sourceFile: allSrcs) {
+ sourceFile.createLines();
+ }
+
+ // add line counts
+ for (GcnoFunction gf : allFnctns) {
+ gf.addLineCounts(allSrcs);
+ }
+
+ // accumulate lines
+ for (SourceFile sf: allSrcs) {
+ sf.accumulateLineCounts();
+ }
+
+ /* compute counts by folder*/
+
+ // make the folders list
+ for (SourceFile sf : allSrcs) {
+ File srcFile = new File (sf.getName());
+ String folderName = srcFile.getParent();
+ if (folderName == null) folderName = "?";
+ Folder folder = null;
+ for (Folder f: allFolders) {
+ if (f.getPath().equals(folderName))
+ folder = f;
+ }
+ if (folder == null){
+ folder = new Folder(folderName);
+ allFolders.add(folder);
+ }
+ folder.addSrcFiles(sf);
+ }
+
+ // assign sourcesList for each folder
+ for (Folder f : allFolders) {
+ f.accumulateSourcesCounts();
+ }
+ }
+
+
+ /**
+ * fill the model by count results
+ * @throws CoreException, IOException, InterruptedException
+ */
+
+ public void fillGcovView() {
+ // process counts for summary level
+ int summaryTotal = 0, summaryInstrumented = 0, summaryExecuted = 0;
+ for (Folder f : allFolders) {
+ summaryTotal+=f.getNumLines();
+ summaryInstrumented+=f.getLinesInstrumented();
+ summaryExecuted+=f.getLinesExecuted();
+ }
+
+ // fill rootNode model: the entry of the contentProvider
+ rootNode = new CovRootTreeElement("Summary", summaryTotal,summaryExecuted,
+ summaryInstrumented);
+ IBinaryObject binaryObject = STSymbolManager.sharedInstance.getBinaryObject(new Path(binaryPath));
+
+ for (Folder fldr : allFolders) {
+ String folderLocation = fldr.getPath();
+ CovFolderTreeElement fldrTreeElem = new CovFolderTreeElement(
+ rootNode, folderLocation, fldr.getNumLines(), fldr.getLinesExecuted(),
+ fldr.getLinesInstrumented());
+ rootNode.addChild(fldrTreeElem);
+
+ for (SourceFile src : fldr.getSrcFiles()) {
+ CovFileTreeElement srcTreeElem = new CovFileTreeElement(
+ fldrTreeElem, src.getName(), src.getNumLines(), src
+ .getLinesExecuted(), src.getLinesInstrumented());
+ fldrTreeElem.addChild(srcTreeElem);
+
+ for (GcnoFunction fnctn : src.getFnctns()) {
+ String name = fnctn.getName();
+ name = STSymbolManager.sharedInstance.demangle(binaryObject, name, project);;
+ srcTreeElem.addChild(new CovFunctionTreeElement(
+ srcTreeElem, name, fnctn.getSrcFile(), fnctn
+ .getFirstLineNmbr(), fnctn.getCvrge()
+ .getLinesExecuted(), fnctn.getCvrge()
+ .getLinesInstrumented()));
+ }
+ }
+ }
+ }
+
+ // transform String path to stream
+ private DataInput OpenTraceFileStream(String filePath, String extension, Map<File, File> sourcePath) throws FileNotFoundException{
+ File f = new File(filePath).getAbsoluteFile();
+ if (f.isFile() && f.canRead()) {
+ FileInputStream fis = new FileInputStream(f);
+ InputStream inputStream = new BufferedInputStream(fis);
+ return new DataInputStream(inputStream);
+ } else {
+ String postfix = "";
+ File dir = null;
+ do {
+ if ("".equals(postfix)) postfix = f.getName();
+ else postfix = f.getName() + File.separator + postfix;
+ f = f.getParentFile();
+ if (f != null) {
+ dir = sourcePath.get(f);
+ } else break;
+ } while (dir == null);
+
+ if (dir != null) {
+ f = new File(dir, postfix);
+ if (f.isFile() && f.canRead()) {
+ return OpenTraceFileStream(f.getAbsolutePath(), extension, sourcePath);
+ }
+ }
+
+
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ FileDialog fg = new FileDialog(shell, SWT.OPEN);
+ fg.setFilterExtensions(new String[] {"*" + extension, "*.*", "*"});
+ fg.setFileName(f.getName());
+ String s = fg.open();
+ if (s == null) return null;
+ else {
+ f = new File(s).getAbsoluteFile();
+ addSourceLookup(sourcePath, f, new File(filePath).getAbsoluteFile());
+ if (f.isFile() && f.canRead()) {
+ FileInputStream fis = new FileInputStream(f);
+ InputStream inputStream = new BufferedInputStream(fis);
+ return new DataInputStream(inputStream);
+ }
+ }
+ }
+ return null;
+ }
+
+
+ public ArrayList<SourceFile> getAllSrcs() {
+ return allSrcs;
+ }
+
+ public ArrayList<GcnoFunction> getAllFnctns() {
+ return allFnctns;
+ }
+
+ public CovRootTreeElement getRootNode() {
+ return rootNode;
+ }
+
+ public String getBinaryPath() {
+ return binaryPath;
+ }
+
+ public SourceFile getSourceFile(String sourcePath){
+ return sourceMap.get(sourcePath);
+ }
+
+ public long getNbrPgmRuns() {
+ return nbrPgmRuns;
+ }
+
+ /**
+ * Retrieve a list containing gcda paths from a binary file
+ * @return
+ * @throws CoreException
+ * @throws IOException
+ * @throws InterruptedException
+ */
+ public List<String> getGCDALocations() throws CoreException, IOException, InterruptedException
+ {
+ IBinaryObject binaryObject = STSymbolManager.sharedInstance.getBinaryObject(new Path(binaryPath));
+ String binaryPath = binaryObject.getPath().toOSString();
+ List<String> l = new LinkedList<String>();
+ String cpu = binaryObject.getCPU();
+ Process p;
+ if ("sh".equals(cpu)) {
+ String stringsTool = "sh4strings";
+ p = getStringsProcess(stringsTool, binaryPath);
+ if ( p == null) p = getStringsProcess("sh4-linux-strings", binaryPath);
+ } else if ("stxp70".equals(cpu)) {
+ String stringsTool = "stxp70v3-strings";
+ p = getStringsProcess(stringsTool, binaryPath);
+ } else if ("st200".equals(cpu)){
+ String stringsTool = cpu + "strings";
+ p = getStringsProcess(stringsTool, binaryPath);
+ } else {
+ String stringsTool = "strings";
+ p = getStringsProcess(stringsTool, binaryPath);
+ }
+ if (p == null) {
+ Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR,
+ "An error occured during analysis: unable to retrieve gcov data", new IOException());
+ Activator.getDefault().getLog().log(status);
+ return l;
+ }
+ ThreadConsumer t = new ThreadConsumer(p, l);
+ t.start();
+ p.waitFor();
+ t.join();
+ return l;
+ }
+
+
+ private Process getStringsProcess(String stringsTool, String binaryPath) {
+ try {
+ Process p = Runtime.getRuntime().exec(new String[] {stringsTool, binaryPath });
+ return p;
+ } catch (Exception _) {
+ return null;
+ }
+ }
+
+
+
+ private static final class ThreadConsumer extends Thread
+ {
+ private final Process p;
+ private final List<String> list;
+ ThreadConsumer(Process p, List<String> files)
+ {
+ super();
+ this.p = p;
+ this.list = files;
+ }
+
+ public void run()
+ {
+ try {
+ populateGCDAFiles(p.getInputStream());
+ } catch (Exception _) {
+ }
+ }
+
+ private void populateGCDAFiles(InputStream s) throws IOException
+ {
+ InputStreamReader isr = new InputStreamReader(s);
+ LineNumberReader lnr = new LineNumberReader(isr);
+ String line = null;
+ while ((line =lnr.readLine()) != null) {
+ if (line.endsWith(".gcda"))
+ {
+ // absolute .gcda filepaths retrieved using the "strings" tool may
+ // be prefixed by random printable characters so strip leading
+ // characters until the filepath starts with "X:/", "X:\", "/" or "\"
+ // FIXME: need a more robust mechanism to locate .gcda files [Bugzilla 329710]
+ while ((line.length() > 6) && !line.matches("^([A-Za-z]:)?[/\\\\].*")) {
+ line = line.substring(1);
+ }
+ IPath p = new Path(line);
+ String filename = p.toString();
+
+
+ if (!list.contains(filename)) list.add(filename);
+ }
+ }
+ }
+ }
+
+ public void dumpProcessCovFilesResult(PrintStream ps) throws FileNotFoundException {
+ ps.println("Parse gcda and gcno files done, resolve graph algorithm executed, now display results");
+ ps.println("- PRINT FUNCTIONS ARRAY : ");
+ for (int i = 0; i < allFnctns.size(); i++) {
+ ps.println("-- FUNCTION " +i);
+ ps.println(" name = " + allFnctns.get(i).getName());
+ ps.println(" instrumentd lines = " + allFnctns.get(i).getCvrge().getLinesInstrumented());
+ ps.println(" executed lines = "+ allFnctns.get(i).getCvrge().getLinesExecuted());
+ }
+ ps.println("- PRINT SRCS ARRAY : ");
+ for (int i = 0; i < allSrcs.size(); i++) {
+ ps.println("-- FILE " + i);
+ ps.println(" name = " + allSrcs.get(i).getName());
+ ps.println(" total lines = " + allSrcs.get(i).getNumLines());
+ ps.println(" instrumentd lines = "+ allSrcs.get(i).getLinesInstrumented());
+ ps.println(" executed lines = "+ allSrcs.get(i).getLinesExecuted());
+ }
+ }
+
+
+ /**
+ * @return the sourceMap
+ */
+ public HashMap<String, SourceFile> getSourceMap() {
+ return sourceMap;
+ }
+
+
+ private void addSourceLookup(Map<File, File> map, File hostPath, File compilerPath) {
+ while (hostPath.getName().equals(compilerPath.getName())) {
+ hostPath = hostPath.getParentFile();
+ compilerPath = compilerPath.getParentFile();
+ }
+ map.put(compilerPath, hostPath);
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/CoverageInfo.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CoverageInfo.java
index 15956356dc..761289ee43 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/CoverageInfo.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CoverageInfo.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.parser;
-
-import java.io.Serializable;
-
-public class CoverageInfo implements Serializable{
-
- /**
- *
- */
- private static final long serialVersionUID = -6067335353999481231L;
-
- private int linesInstrumented = 0;
- private int linesExecuted = 0;
-
- /**
- * Constructor
- */
- public CoverageInfo() {
-
- }
-
-
- /*getters & setters */
-
- public int getLinesInstrumented() {
- return linesInstrumented;
- }
-
- public int getLinesExecuted() {
- return linesExecuted;
- }
-
- public void incLinesInstrumented(){
- this.linesInstrumented++;
- }
-
- public void incLinesExecuted(){
- this.linesExecuted++;
- }
-
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.parser;
+
+import java.io.Serializable;
+
+public class CoverageInfo implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6067335353999481231L;
+
+ private int linesInstrumented = 0;
+ private int linesExecuted = 0;
+
+ /**
+ * Constructor
+ */
+ public CoverageInfo() {
+
+ }
+
+
+ /*getters & setters */
+
+ public int getLinesInstrumented() {
+ return linesInstrumented;
+ }
+
+ public int getLinesExecuted() {
+ return linesExecuted;
+ }
+
+ public void incLinesInstrumented(){
+ this.linesInstrumented++;
+ }
+
+ public void incLinesExecuted(){
+ this.linesExecuted++;
+ }
+
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Folder.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Folder.java
index 482ae810fa..7fad0babab 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Folder.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Folder.java
@@ -1,65 +1,65 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.parser;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-public class Folder implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 5155033391199109661L;
- private final String path;
- private final ArrayList<SourceFile> srcFiles = new ArrayList<SourceFile>();
- private int numLines = 0;
- private int linesInstrumented = 0;
- private int linesExecuted = 0;
-
- /**
- * Constructor
- */
- public Folder(String path) {
- this.path = path;
- }
-
-
- public void accumulateSourcesCounts(){
- for (int i = 0; i < srcFiles.size(); i++) {
- numLines += (srcFiles.get(i)).getNumLines();
- linesInstrumented += (srcFiles.get(i)).getLinesInstrumented();
- linesExecuted += (srcFiles.get(i)).getLinesExecuted();
- }
- }
-
- public String getPath() {
- return path;
- }
-
- public ArrayList<SourceFile> getSrcFiles() {
- return srcFiles;
- }
-
- public void addSrcFiles(SourceFile srcFile) {
- this.srcFiles.add(srcFile);
- }
-
- public int getNumLines() {
- return numLines;
- }
- public int getLinesExecuted() {
- return linesExecuted;
- }
- public int getLinesInstrumented() {
- return linesInstrumented;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.parser;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+public class Folder implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5155033391199109661L;
+ private final String path;
+ private final ArrayList<SourceFile> srcFiles = new ArrayList<SourceFile>();
+ private int numLines = 0;
+ private int linesInstrumented = 0;
+ private int linesExecuted = 0;
+
+ /**
+ * Constructor
+ */
+ public Folder(String path) {
+ this.path = path;
+ }
+
+
+ public void accumulateSourcesCounts(){
+ for (int i = 0; i < srcFiles.size(); i++) {
+ numLines += (srcFiles.get(i)).getNumLines();
+ linesInstrumented += (srcFiles.get(i)).getLinesInstrumented();
+ linesExecuted += (srcFiles.get(i)).getLinesExecuted();
+ }
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public ArrayList<SourceFile> getSrcFiles() {
+ return srcFiles;
+ }
+
+ public void addSrcFiles(SourceFile srcFile) {
+ this.srcFiles.add(srcFile);
+ }
+
+ public int getNumLines() {
+ return numLines;
+ }
+ public int getLinesExecuted() {
+ return linesExecuted;
+ }
+ public int getLinesInstrumented() {
+ return linesInstrumented;
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/GcdaRecordsParser.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcdaRecordsParser.java
index a82d724386..5b51b3fffe 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/GcdaRecordsParser.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcdaRecordsParser.java
@@ -1,272 +1,272 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.parser;
-
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.linuxtools.gcov.Activator;
-import org.eclipse.linuxtools.gcov.utils.BEDataInputStream;
-import org.eclipse.linuxtools.gcov.utils.LEDataInputStream;
-import org.eclipse.linuxtools.gcov.utils.MasksGenerator;
-
-
-
-public class GcdaRecordsParser {
-
-
- private static final int GCOV_DATA_MAGIC = 0x67636461; // en ASCII: 67=g 63=c 64=d 61=a
- private static final int GCOV_TAG_FUNCTION = 0x01000000;
- private static final int GCOV_COUNTER_ARCS = 0x01a10000;
- private static final int GCOV_TAG_OBJECT_SYMMARY = 0xa1000000;
- private static final int GCOV_TAG_PROGRAM_SUMMARY = 0xa3000000;
-
- private final ArrayList<GcnoFunction> fnctns;
- private long objSmryNbrPgmRuns = 0;
- private long pgmSmryChksm = 0;
- private long objSmryChksm = 0;
- private long objSmryArcCnts = 0;
- private long objSmrytotalCnts = 0;
- private long objSmryRunMax = 0;
- private long objSmrySumMax = 0;
-
-
- public GcdaRecordsParser(ArrayList<GcnoFunction> fnctns) {
- this.fnctns = fnctns;
- }
-
- public void parseGcdaRecord(DataInput stream) throws IOException, CoreException {
- // header data
- int magic = 0;
-
- // data & flags to process tests
- GcnoFunction currentFnctn = null;
-
- //read magic
- magic = stream.readInt();
- //read version
- //version = stream.readInt();
- stream.readInt();
- //read stamp
- //stamp = stream.readInt();
- stream.readInt();
-
- if (magic == GCOV_DATA_MAGIC){
- stream = new BEDataInputStream((DataInputStream) stream);
- }else{
- magic = (magic >> 16) | (magic << 16);
- magic = ((magic & 0xff00ff) << 8) | ((magic >> 8) & 0xff00ff);
- if (magic == GCOV_DATA_MAGIC){
- stream = new LEDataInputStream((DataInputStream) stream);
- }else{
- String message = magic + " :desn't correspond to a correct data file header\n";
- Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
- throw new CoreException(status);
- }
- }
-
- while (true) {
- try {
- // parse header
- int tag = stream.readInt();
- long length = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
- // parse gcda data
- switch ((int) tag) {
- case GCOV_TAG_FUNCTION: {
- long fnctnId = stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK;
- if (!fnctns.isEmpty()) {
- boolean fnctnFound = false;
- for (GcnoFunction f: fnctns) {
- if (f.getIdent() == fnctnId) {
- fnctnFound = true;
- currentFnctn = f;
- long fnctnChksm = stream.readInt()& MasksGenerator.UNSIGNED_INT_MASK;
- if (f.getCheksum() != fnctnChksm){
- String message = "Checksums don't correspond for " +
- currentFnctn.getName() + " (Id: " + fnctnId + ")\n";
- Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
- throw new CoreException(status);
- }
- break;
- }
- }
-
- if (fnctnFound == false){
- currentFnctn = null;
- String message = "Function with Id: " + fnctnId +
- " not found in function list\n";
- Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
- throw new CoreException(status);
- }
-
- }
- break;
- }
-
- case GCOV_COUNTER_ARCS: {
- if (currentFnctn == null){
- String message = "Missing function or duplicate counter tag\n";
- Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
- throw new CoreException(status);
- }
-
- if (length != 2 * (currentFnctn.getNumCounts())){
- String message = "GCDA content is inconsistent\n";
- Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
- throw new CoreException(status);
- }
-
- ArrayList<Block> fnctnBlcks = currentFnctn.getFunctionBlocks();
- if (fnctnBlcks.isEmpty()){
- String message = "Function block list is empty\n";
- Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
- throw new CoreException(status);
- }
-
- for (int i = 0; i < fnctnBlcks.size(); i++) {
- Block b = fnctnBlcks.get(i);
- int nonFakeExit = 0;
-
- ArrayList<Arc> arcsExit = b.getExitArcs();
- for (Arc extArc: arcsExit) {
- if (extArc.isFake() == false)
- nonFakeExit++;
- if (extArc.isOnTree() == false) {
- long arcsCnts = stream.readLong();
- extArc.setCount(arcsCnts);
- extArc.setCountValid(true);
- b.decNumSuccs();
- extArc.getDstnatnBlock().decNumPreds();
- }
- }
-
- // If there is only one non-fake exit, it is an
- // unconditional branch.
- if (nonFakeExit == 1) {
- for (Arc extArc: arcsExit) {
- if (extArc.isFake() == false) {
- extArc.setUnconditionnal(true);
-
- // If this block is instrumenting a call, it might be
- // an artificial block. It is not artificial if it has
- // a non-fallthrough exit, or the destination of this
- // arc has more than one entry. Mark the destination
- // block as a return site, if none of those conditions hold.
-
- if (b.isCallSite() == true
- && extArc.isFallthrough() == true
- && extArc.getDstnatnBlock()
- .getEntryArcs().get(0)
- .equals(extArc)
- && extArc.getDstnatnBlock()
- .getEntryArcs().size() == 1)
- extArc.getDstnatnBlock()
- .setCallReturn(true);
- }
- }
- }
- }
-
- // counters arcs process data reset
- currentFnctn = null;
- break;
- }
-
- case GCOV_TAG_OBJECT_SYMMARY: {
- objSmryChksm = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
- objSmryArcCnts = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
- objSmryNbrPgmRuns = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
- objSmrytotalCnts = stream.readLong();
- objSmryRunMax = stream.readLong();
- objSmrySumMax = stream.readLong();
- break;
- }
-
- // program summary tag
- case GCOV_TAG_PROGRAM_SUMMARY: {
- //long[] pgmSmryskips = new long[(int) length];
- pgmSmryChksm = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
- for (int i = 0; i < length - 1; i++) {
- //pgmSmryskips[i] = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
- stream.readInt();
- }
- break;
- }
-
- default: {
- //System.out.println("wrong gcda tag");
- break;
- }
- }
- }
- catch (EOFException _) {
- break;
- }
- }
- }
-
- /**
- * @return the objSmryNbrPgmRuns
- */
- public long getObjSmryNbrPgmRuns() {
- return objSmryNbrPgmRuns;
- }
-
- /**
- * @return the objSmryChksm
- */
- public long getObjSmryChksm() {
- return objSmryChksm;
- }
-
- /**
- * @return the objSmryArcCnts
- */
- public long getObjSmryArcCnts() {
- return objSmryArcCnts;
- }
-
- /**
- * @return the objSmrytotalCnts
- */
- public long getObjSmrytotalCnts() {
- return objSmrytotalCnts;
- }
-
- /**
- * @return the objSmryRunMax
- */
- public long getObjSmryRunMax() {
- return objSmryRunMax;
- }
-
- /**
- * @return the objSmrySumMax
- */
- public long getObjSmrySumMax() {
- return objSmrySumMax;
- }
-
- /**
- * @return the pgmSmryChksm
- */
- public long getPgmSmryChksm() {
- return pgmSmryChksm;
- }
-
-
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.parser;
+
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.linuxtools.gcov.Activator;
+import org.eclipse.linuxtools.internal.gcov.utils.BEDataInputStream;
+import org.eclipse.linuxtools.internal.gcov.utils.LEDataInputStream;
+import org.eclipse.linuxtools.internal.gcov.utils.MasksGenerator;
+
+
+
+public class GcdaRecordsParser {
+
+
+ private static final int GCOV_DATA_MAGIC = 0x67636461; // en ASCII: 67=g 63=c 64=d 61=a
+ private static final int GCOV_TAG_FUNCTION = 0x01000000;
+ private static final int GCOV_COUNTER_ARCS = 0x01a10000;
+ private static final int GCOV_TAG_OBJECT_SYMMARY = 0xa1000000;
+ private static final int GCOV_TAG_PROGRAM_SUMMARY = 0xa3000000;
+
+ private final ArrayList<GcnoFunction> fnctns;
+ private long objSmryNbrPgmRuns = 0;
+ private long pgmSmryChksm = 0;
+ private long objSmryChksm = 0;
+ private long objSmryArcCnts = 0;
+ private long objSmrytotalCnts = 0;
+ private long objSmryRunMax = 0;
+ private long objSmrySumMax = 0;
+
+
+ public GcdaRecordsParser(ArrayList<GcnoFunction> fnctns) {
+ this.fnctns = fnctns;
+ }
+
+ public void parseGcdaRecord(DataInput stream) throws IOException, CoreException {
+ // header data
+ int magic = 0;
+
+ // data & flags to process tests
+ GcnoFunction currentFnctn = null;
+
+ //read magic
+ magic = stream.readInt();
+ //read version
+ //version = stream.readInt();
+ stream.readInt();
+ //read stamp
+ //stamp = stream.readInt();
+ stream.readInt();
+
+ if (magic == GCOV_DATA_MAGIC){
+ stream = new BEDataInputStream((DataInputStream) stream);
+ }else{
+ magic = (magic >> 16) | (magic << 16);
+ magic = ((magic & 0xff00ff) << 8) | ((magic >> 8) & 0xff00ff);
+ if (magic == GCOV_DATA_MAGIC){
+ stream = new LEDataInputStream((DataInputStream) stream);
+ }else{
+ String message = magic + " :desn't correspond to a correct data file header\n";
+ Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
+ throw new CoreException(status);
+ }
+ }
+
+ while (true) {
+ try {
+ // parse header
+ int tag = stream.readInt();
+ long length = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
+ // parse gcda data
+ switch ((int) tag) {
+ case GCOV_TAG_FUNCTION: {
+ long fnctnId = stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK;
+ if (!fnctns.isEmpty()) {
+ boolean fnctnFound = false;
+ for (GcnoFunction f: fnctns) {
+ if (f.getIdent() == fnctnId) {
+ fnctnFound = true;
+ currentFnctn = f;
+ long fnctnChksm = stream.readInt()& MasksGenerator.UNSIGNED_INT_MASK;
+ if (f.getCheksum() != fnctnChksm){
+ String message = "Checksums don't correspond for " +
+ currentFnctn.getName() + " (Id: " + fnctnId + ")\n";
+ Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
+ throw new CoreException(status);
+ }
+ break;
+ }
+ }
+
+ if (fnctnFound == false){
+ currentFnctn = null;
+ String message = "Function with Id: " + fnctnId +
+ " not found in function list\n";
+ Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
+ throw new CoreException(status);
+ }
+
+ }
+ break;
+ }
+
+ case GCOV_COUNTER_ARCS: {
+ if (currentFnctn == null){
+ String message = "Missing function or duplicate counter tag\n";
+ Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
+ throw new CoreException(status);
+ }
+
+ if (length != 2 * (currentFnctn.getNumCounts())){
+ String message = "GCDA content is inconsistent\n";
+ Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
+ throw new CoreException(status);
+ }
+
+ ArrayList<Block> fnctnBlcks = currentFnctn.getFunctionBlocks();
+ if (fnctnBlcks.isEmpty()){
+ String message = "Function block list is empty\n";
+ Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
+ throw new CoreException(status);
+ }
+
+ for (int i = 0; i < fnctnBlcks.size(); i++) {
+ Block b = fnctnBlcks.get(i);
+ int nonFakeExit = 0;
+
+ ArrayList<Arc> arcsExit = b.getExitArcs();
+ for (Arc extArc: arcsExit) {
+ if (extArc.isFake() == false)
+ nonFakeExit++;
+ if (extArc.isOnTree() == false) {
+ long arcsCnts = stream.readLong();
+ extArc.setCount(arcsCnts);
+ extArc.setCountValid(true);
+ b.decNumSuccs();
+ extArc.getDstnatnBlock().decNumPreds();
+ }
+ }
+
+ // If there is only one non-fake exit, it is an
+ // unconditional branch.
+ if (nonFakeExit == 1) {
+ for (Arc extArc: arcsExit) {
+ if (extArc.isFake() == false) {
+ extArc.setUnconditionnal(true);
+
+ // If this block is instrumenting a call, it might be
+ // an artificial block. It is not artificial if it has
+ // a non-fallthrough exit, or the destination of this
+ // arc has more than one entry. Mark the destination
+ // block as a return site, if none of those conditions hold.
+
+ if (b.isCallSite() == true
+ && extArc.isFallthrough() == true
+ && extArc.getDstnatnBlock()
+ .getEntryArcs().get(0)
+ .equals(extArc)
+ && extArc.getDstnatnBlock()
+ .getEntryArcs().size() == 1)
+ extArc.getDstnatnBlock()
+ .setCallReturn(true);
+ }
+ }
+ }
+ }
+
+ // counters arcs process data reset
+ currentFnctn = null;
+ break;
+ }
+
+ case GCOV_TAG_OBJECT_SYMMARY: {
+ objSmryChksm = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
+ objSmryArcCnts = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
+ objSmryNbrPgmRuns = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
+ objSmrytotalCnts = stream.readLong();
+ objSmryRunMax = stream.readLong();
+ objSmrySumMax = stream.readLong();
+ break;
+ }
+
+ // program summary tag
+ case GCOV_TAG_PROGRAM_SUMMARY: {
+ //long[] pgmSmryskips = new long[(int) length];
+ pgmSmryChksm = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
+ for (int i = 0; i < length - 1; i++) {
+ //pgmSmryskips[i] = (stream.readInt() & MasksGenerator.UNSIGNED_INT_MASK);
+ stream.readInt();
+ }
+ break;
+ }
+
+ default: {
+ //System.out.println("wrong gcda tag");
+ break;
+ }
+ }
+ }
+ catch (EOFException _) {
+ break;
+ }
+ }
+ }
+
+ /**
+ * @return the objSmryNbrPgmRuns
+ */
+ public long getObjSmryNbrPgmRuns() {
+ return objSmryNbrPgmRuns;
+ }
+
+ /**
+ * @return the objSmryChksm
+ */
+ public long getObjSmryChksm() {
+ return objSmryChksm;
+ }
+
+ /**
+ * @return the objSmryArcCnts
+ */
+ public long getObjSmryArcCnts() {
+ return objSmryArcCnts;
+ }
+
+ /**
+ * @return the objSmrytotalCnts
+ */
+ public long getObjSmrytotalCnts() {
+ return objSmrytotalCnts;
+ }
+
+ /**
+ * @return the objSmryRunMax
+ */
+ public long getObjSmryRunMax() {
+ return objSmryRunMax;
+ }
+
+ /**
+ * @return the objSmrySumMax
+ */
+ public long getObjSmrySumMax() {
+ return objSmrySumMax;
+ }
+
+ /**
+ * @return the pgmSmryChksm
+ */
+ public long getPgmSmryChksm() {
+ return pgmSmryChksm;
+ }
+
+
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/GcnoFunction.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoFunction.java
index 2549883e85..40ab3aaa61 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/GcnoFunction.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoFunction.java
@@ -1,255 +1,255 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.parser;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-public class GcnoFunction implements Serializable, Comparable<GcnoFunction> {
-
- /**
- *
- */
- private static final long serialVersionUID = -4159055012321132651L;
-
- private final long ident;
- private final long cheksum;
- private final long firstLineNmbr;
- private final String name;
- private final String srcFile;
- private ArrayList<Block> functionBlocks = new ArrayList<Block>();
- private int numCounts = 0, blocksExecuted = 0, numBlocks = 0;;
- private final CoverageInfo cvrge = new CoverageInfo();
-
- public GcnoFunction(long fnctnIdent, long fnctnChksm, String fnctnName, String fnctnSrcFle, long fnctnFrstLnNmbr) {
- this.ident = fnctnIdent;
- this.cheksum = fnctnChksm;
- this.name = fnctnName;
- this.srcFile = fnctnSrcFle;
- this.firstLineNmbr = fnctnFrstLnNmbr;
- }
-
- @Override
- public int compareTo(GcnoFunction o) {
- if (getFirstLineNmbr()>o.getFirstLineNmbr()) return 1;
- else if (getFirstLineNmbr()<o.getFirstLineNmbr()) return -1;
- return 0;
- }
-
-
- public void addLineCounts(ArrayList<SourceFile> srcs) {
- for (int i = 0; i != numBlocks; i++) {
- Block blk = functionBlocks.get(i);
- SourceFile fileSrc = null;
- if ((blk.getCount() != 0) && (i != 0) && (i + 1 != numBlocks))
- blocksExecuted++;
-
- long[] enc = blk.getEncoding();
- for (int j = 0, k = 0; j != blk.getLineNum(); j++, k++) {
- if (enc[k] == 0) {
- int srcn = (int) enc[++k];
- for (SourceFile sf : srcs) {
- if (sf.getIndex() == srcn) {
- fileSrc = sf;
- break;
- }
- }
- j++;
- } else if ((fileSrc != null) && enc[k] < fileSrc.getLines().size()) {
- Line line = fileSrc.getLines().get((int) enc[k]);
- if (line.isExists() == false)
- cvrge.incLinesInstrumented();
- if ((line.getCount() == 0) && (blk.getCount() != 0))
- cvrge.incLinesExecuted();
- line.setExists(true);
- line.setCount(line.getCount()+ blk.getCount());
- }
- }
- }
- }
-
- public void solveGraphFnctn() {
- ArrayList<Block> fnctnBlcks = this.functionBlocks;
- ArrayList<Block> validBlocks = new ArrayList<Block>();
- ArrayList<Block> invalidBlocks = new ArrayList<Block>();
-
-
- // Function should contain at least one block
- if (fnctnBlcks.size() >= 2){
- if (fnctnBlcks.get(0).getNumPreds() == 0)
- fnctnBlcks.get(0).setNumPreds(50000);
- if (fnctnBlcks.get(fnctnBlcks.size() - 1).getNumSuccs() == 0)
- fnctnBlcks.get(fnctnBlcks.size() - 1).setNumSuccs(50000);
- }
-
-
- for (int i = 0; i < fnctnBlcks.size(); i++) {
- Block b = fnctnBlcks.get(i);
- b.setInvalidChain(true);
- invalidBlocks.add(b);
- }
-
- while (validBlocks.isEmpty() == false
- || invalidBlocks.isEmpty() == false) {
-
- if (invalidBlocks.isEmpty() == false) {
- for (int i = invalidBlocks.size() - 1; i >= 0; i--) {
- Block invb = invalidBlocks.get(i);
- long total = 0;
- invalidBlocks.remove(i);
- invb.setInvalidChain(false);
-
- if (invb.getNumSuccs() == 0) {
- ArrayList<Arc> extArcs = invb.getExitArcs();
- for (Arc arc : extArcs)
- total += arc.getCount();
- } else if (invb.getNumPreds() == 0) {
- ArrayList<Arc> entrArcs = invb.getEntryArcs();
- for (Arc arc : entrArcs)
- total += arc.getCount();
- } else
- continue;
-
- invb.setCount(total);
- invb.setCountValid(true);
- invb.setValidChain(true);
- validBlocks.add(invb);
- }
- }/*else
- System.out.println("NO, invalid blocks = 0");
- */
- while (validBlocks.isEmpty() == false) {
- int last = validBlocks.size() - 1;
- Block vb = validBlocks.get(last);
- Arc invarc = null;
- int total = 0;
- validBlocks.remove(last);
-
- vb.setValidChain(false);
-
- if (vb.getNumSuccs() == 1) {
- Block blcksdst;
- total = (int) vb.getCount();
-
- for (Arc extAr : vb.getExitArcs()) {
- total -= extAr.getCount();
- if (extAr.isCountValid() == false)
- invarc = extAr;
- }
- blcksdst = invarc.getDstnatnBlock();
- invarc.setCountValid(true);
- invarc.setCount(total);
- vb.decNumSuccs();
- blcksdst.decNumPreds();
-
- if (blcksdst.isCountValid() == true) {
- if (blcksdst.getNumPreds() == 1
- && blcksdst.isValidChain() == false) {
- blcksdst.setValidChain(true);
- validBlocks.add(blcksdst);
- }
- } else {
- if (blcksdst.getNumPreds() == 0
- && blcksdst.isInvalidChain() == false) {
- blcksdst.setInvalidChain(true);
- invalidBlocks.add(blcksdst);
- }
- }
- }
-
- if (vb.getNumPreds() == 1) {
- Block blcksrc;
- total = (int) vb.getCount();
- invarc = null;
-
- for (Arc entrAr: vb.getEntryArcs()) {
- total -= entrAr.getCount();
- if (entrAr.isCountValid() == false)
- invarc = entrAr;
- }
-
- blcksrc = invarc.getSrcBlock();
- invarc.setCountValid(true);
- invarc.setCount(total);
- vb.decNumPreds();
- blcksrc.decNumSuccs();
-
- if (blcksrc.isCountValid() == true) {
- if (blcksrc.getNumSuccs() == 1
- && blcksrc.isInvalidChain() == false) {
- blcksrc.setValidChain(true);
- validBlocks.add(blcksrc);
- }
- } else if (blcksrc.getNumSuccs() == 0
- && blcksrc.isInvalidChain() == false) {
- blcksrc.setInvalidChain(true);
- invalidBlocks.add(blcksrc);
- }
- }
- }
- }
- }
-
- /* getters & setters */
-
- public long getIdent() {
- return ident;
- }
-
- public long getCheksum() {
- return cheksum;
- }
-
- public String getName() {
- return name;
- }
-
- public String getSrcFile() {
- return srcFile;
- }
-
- public long getFirstLineNmbr() {
- return firstLineNmbr;
- }
-
- public ArrayList<Block> getFunctionBlocks() {
- return functionBlocks;
- }
-
- public Block getFunctionBlock(int i) {
- return functionBlocks.get(i);
- }
-
- public void setFunctionBlocks(ArrayList<Block> functionBlocks) {
- this.functionBlocks = functionBlocks;
- }
-
- public void incNumCounts() {
- this.numCounts++;
- }
-
- public int getNumCounts() {
- return numCounts;
- }
-
- public int getNumBlocks() {
- return numBlocks;
- }
-
- public void setNumBlocks(int numBlocks) {
- this.numBlocks = numBlocks;
- }
-
- public CoverageInfo getCvrge() {
- return cvrge;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.parser;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+public class GcnoFunction implements Serializable, Comparable<GcnoFunction> {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -4159055012321132651L;
+
+ private final long ident;
+ private final long cheksum;
+ private final long firstLineNmbr;
+ private final String name;
+ private final String srcFile;
+ private ArrayList<Block> functionBlocks = new ArrayList<Block>();
+ private int numCounts = 0, blocksExecuted = 0, numBlocks = 0;;
+ private final CoverageInfo cvrge = new CoverageInfo();
+
+ public GcnoFunction(long fnctnIdent, long fnctnChksm, String fnctnName, String fnctnSrcFle, long fnctnFrstLnNmbr) {
+ this.ident = fnctnIdent;
+ this.cheksum = fnctnChksm;
+ this.name = fnctnName;
+ this.srcFile = fnctnSrcFle;
+ this.firstLineNmbr = fnctnFrstLnNmbr;
+ }
+
+ @Override
+ public int compareTo(GcnoFunction o) {
+ if (getFirstLineNmbr()>o.getFirstLineNmbr()) return 1;
+ else if (getFirstLineNmbr()<o.getFirstLineNmbr()) return -1;
+ return 0;
+ }
+
+
+ public void addLineCounts(ArrayList<SourceFile> srcs) {
+ for (int i = 0; i != numBlocks; i++) {
+ Block blk = functionBlocks.get(i);
+ SourceFile fileSrc = null;
+ if ((blk.getCount() != 0) && (i != 0) && (i + 1 != numBlocks))
+ blocksExecuted++;
+
+ long[] enc = blk.getEncoding();
+ for (int j = 0, k = 0; j != blk.getLineNum(); j++, k++) {
+ if (enc[k] == 0) {
+ int srcn = (int) enc[++k];
+ for (SourceFile sf : srcs) {
+ if (sf.getIndex() == srcn) {
+ fileSrc = sf;
+ break;
+ }
+ }
+ j++;
+ } else if ((fileSrc != null) && enc[k] < fileSrc.getLines().size()) {
+ Line line = fileSrc.getLines().get((int) enc[k]);
+ if (line.isExists() == false)
+ cvrge.incLinesInstrumented();
+ if ((line.getCount() == 0) && (blk.getCount() != 0))
+ cvrge.incLinesExecuted();
+ line.setExists(true);
+ line.setCount(line.getCount()+ blk.getCount());
+ }
+ }
+ }
+ }
+
+ public void solveGraphFnctn() {
+ ArrayList<Block> fnctnBlcks = this.functionBlocks;
+ ArrayList<Block> validBlocks = new ArrayList<Block>();
+ ArrayList<Block> invalidBlocks = new ArrayList<Block>();
+
+
+ // Function should contain at least one block
+ if (fnctnBlcks.size() >= 2){
+ if (fnctnBlcks.get(0).getNumPreds() == 0)
+ fnctnBlcks.get(0).setNumPreds(50000);
+ if (fnctnBlcks.get(fnctnBlcks.size() - 1).getNumSuccs() == 0)
+ fnctnBlcks.get(fnctnBlcks.size() - 1).setNumSuccs(50000);
+ }
+
+
+ for (int i = 0; i < fnctnBlcks.size(); i++) {
+ Block b = fnctnBlcks.get(i);
+ b.setInvalidChain(true);
+ invalidBlocks.add(b);
+ }
+
+ while (validBlocks.isEmpty() == false
+ || invalidBlocks.isEmpty() == false) {
+
+ if (invalidBlocks.isEmpty() == false) {
+ for (int i = invalidBlocks.size() - 1; i >= 0; i--) {
+ Block invb = invalidBlocks.get(i);
+ long total = 0;
+ invalidBlocks.remove(i);
+ invb.setInvalidChain(false);
+
+ if (invb.getNumSuccs() == 0) {
+ ArrayList<Arc> extArcs = invb.getExitArcs();
+ for (Arc arc : extArcs)
+ total += arc.getCount();
+ } else if (invb.getNumPreds() == 0) {
+ ArrayList<Arc> entrArcs = invb.getEntryArcs();
+ for (Arc arc : entrArcs)
+ total += arc.getCount();
+ } else
+ continue;
+
+ invb.setCount(total);
+ invb.setCountValid(true);
+ invb.setValidChain(true);
+ validBlocks.add(invb);
+ }
+ }/*else
+ System.out.println("NO, invalid blocks = 0");
+ */
+ while (validBlocks.isEmpty() == false) {
+ int last = validBlocks.size() - 1;
+ Block vb = validBlocks.get(last);
+ Arc invarc = null;
+ int total = 0;
+ validBlocks.remove(last);
+
+ vb.setValidChain(false);
+
+ if (vb.getNumSuccs() == 1) {
+ Block blcksdst;
+ total = (int) vb.getCount();
+
+ for (Arc extAr : vb.getExitArcs()) {
+ total -= extAr.getCount();
+ if (extAr.isCountValid() == false)
+ invarc = extAr;
+ }
+ blcksdst = invarc.getDstnatnBlock();
+ invarc.setCountValid(true);
+ invarc.setCount(total);
+ vb.decNumSuccs();
+ blcksdst.decNumPreds();
+
+ if (blcksdst.isCountValid() == true) {
+ if (blcksdst.getNumPreds() == 1
+ && blcksdst.isValidChain() == false) {
+ blcksdst.setValidChain(true);
+ validBlocks.add(blcksdst);
+ }
+ } else {
+ if (blcksdst.getNumPreds() == 0
+ && blcksdst.isInvalidChain() == false) {
+ blcksdst.setInvalidChain(true);
+ invalidBlocks.add(blcksdst);
+ }
+ }
+ }
+
+ if (vb.getNumPreds() == 1) {
+ Block blcksrc;
+ total = (int) vb.getCount();
+ invarc = null;
+
+ for (Arc entrAr: vb.getEntryArcs()) {
+ total -= entrAr.getCount();
+ if (entrAr.isCountValid() == false)
+ invarc = entrAr;
+ }
+
+ blcksrc = invarc.getSrcBlock();
+ invarc.setCountValid(true);
+ invarc.setCount(total);
+ vb.decNumPreds();
+ blcksrc.decNumSuccs();
+
+ if (blcksrc.isCountValid() == true) {
+ if (blcksrc.getNumSuccs() == 1
+ && blcksrc.isInvalidChain() == false) {
+ blcksrc.setValidChain(true);
+ validBlocks.add(blcksrc);
+ }
+ } else if (blcksrc.getNumSuccs() == 0
+ && blcksrc.isInvalidChain() == false) {
+ blcksrc.setInvalidChain(true);
+ invalidBlocks.add(blcksrc);
+ }
+ }
+ }
+ }
+ }
+
+ /* getters & setters */
+
+ public long getIdent() {
+ return ident;
+ }
+
+ public long getCheksum() {
+ return cheksum;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getSrcFile() {
+ return srcFile;
+ }
+
+ public long getFirstLineNmbr() {
+ return firstLineNmbr;
+ }
+
+ public ArrayList<Block> getFunctionBlocks() {
+ return functionBlocks;
+ }
+
+ public Block getFunctionBlock(int i) {
+ return functionBlocks.get(i);
+ }
+
+ public void setFunctionBlocks(ArrayList<Block> functionBlocks) {
+ this.functionBlocks = functionBlocks;
+ }
+
+ public void incNumCounts() {
+ this.numCounts++;
+ }
+
+ public int getNumCounts() {
+ return numCounts;
+ }
+
+ public int getNumBlocks() {
+ return numBlocks;
+ }
+
+ public void setNumBlocks(int numBlocks) {
+ this.numBlocks = numBlocks;
+ }
+
+ public CoverageInfo getCvrge() {
+ return cvrge;
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/GcnoRecordsParser.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoRecordsParser.java
index c21e16f016..397f777819 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/GcnoRecordsParser.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoRecordsParser.java
@@ -1,241 +1,241 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.parser;
-
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.linuxtools.gcov.Activator;
-import org.eclipse.linuxtools.gcov.utils.BEDataInputStream;
-import org.eclipse.linuxtools.gcov.utils.GcovStringReader;
-import org.eclipse.linuxtools.gcov.utils.LEDataInputStream;
-import org.eclipse.linuxtools.gcov.utils.MasksGenerator;
-
-
-public class GcnoRecordsParser {
-
- private static final int GCOV_NOTE_MAGIC = 0x67636e6f; // en ASCII: 67=g 63=c 6e=n 6f=o
- private static final int GCOV_TAG_FUNCTION = 0x01000000;
- private static final int GCOV_TAG_BLOCKS = 0x01410000;
- private static final int GCOV_TAG_ARCS = 0x01430000;
- private static final int GCOV_TAG_LINES = 0x01450000;
-
- private GcnoFunction fnctn = null;
- private final ArrayList<GcnoFunction> fnctns = new ArrayList<GcnoFunction>();
- private final ArrayList<SourceFile> currentAllSrcs;
- private final HashMap<String, SourceFile> sourceMap;
-
- public GcnoRecordsParser(HashMap<String, SourceFile> sourceMap, ArrayList<SourceFile> AllSrcs){
- this.sourceMap = sourceMap;
- this.currentAllSrcs = AllSrcs;
- }
-
- private SourceFile findOrAdd (String fileName, ArrayList<SourceFile> srcs)
- {
- SourceFile newsrc = sourceMap.get(fileName);
- if (newsrc == null) {
- newsrc = new SourceFile(fileName, srcs.size()+1);
- srcs.add(newsrc);
- sourceMap.put(fileName, newsrc);
- }
- return newsrc; //return the new added element
- }
-
-
- public void parseData(DataInput stream) throws IOException, CoreException{
- // header data
- int magic = 0;
- // blocks data
- ArrayList<Block> blocks = null;
- // source file data
- SourceFile source = null;
- // flag
- boolean parseFirstFnctn = false;
-
- magic = stream.readInt();
- //version = stream.readInt();
- stream.readInt();
- //stamp = stream.readInt();
- stream.readInt();
-
- if (magic == GCOV_NOTE_MAGIC){
- stream = new BEDataInputStream((DataInputStream) stream);
- }else{
- magic = (magic >> 16) | (magic << 16);
- magic = ((magic & 0xff00ff) << 8) | ((magic >> 8) & 0xff00ff);
- if (magic == GCOV_NOTE_MAGIC){
- stream = new LEDataInputStream((DataInputStream) stream);
- }else{
- String message = magic + " :desn't correspond to a correct note file header\n";
- Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
- throw new CoreException(status);
- }
- }
-
- /*------------------------------------------------------------------------------
- System.out.println("Gcno LE, Magic "+magic+" version "+version+" stamp "+stamp);
- */
-
- while (true){
- try{
- int tag;
- // parse header
- while (true){
- tag=stream.readInt();
- if (tag == GCOV_TAG_FUNCTION || tag == GCOV_TAG_BLOCKS ||
- tag == GCOV_TAG_ARCS || tag == GCOV_TAG_LINES)
- break;
- }
- int length=stream.readInt();
-
- // parse gcno data
- if ((int)tag == GCOV_TAG_FUNCTION){
- // before parse new function, add current function to functions list
- if (parseFirstFnctn == true) fnctns.add(fnctn);
-
- long fnctnIdent = (stream.readInt()&MasksGenerator.UNSIGNED_INT_MASK);
- long fnctnChksm = (stream.readInt()&MasksGenerator.UNSIGNED_INT_MASK);
- String fnctnName = GcovStringReader.readString(stream);
- String fnctnSrcFle = GcovStringReader.readString(stream);
- long fnctnFrstLnNmbr= (stream.readInt()&MasksGenerator.UNSIGNED_INT_MASK);
-
- fnctn = new GcnoFunction(fnctnIdent, fnctnChksm, fnctnName, fnctnSrcFle, fnctnFrstLnNmbr);
- SourceFile srcFle2 = findOrAdd (fnctn.getSrcFile(),currentAllSrcs);
- if (fnctn.getFirstLineNmbr() >= srcFle2.getNumLines()){
- srcFle2.setNumLines((int)fnctn.getFirstLineNmbr()+1);
- }
- srcFle2.addFnctn(fnctn);
- parseFirstFnctn = true;
- continue;
- }
-
- else if ((int)tag == GCOV_TAG_BLOCKS){
- blocks = new ArrayList<Block>();
- for (int i = 0; i < length; i++) {
- long BlckFlag = stream.readInt()& MasksGenerator.UNSIGNED_INT_MASK;
- Block blck = new Block(BlckFlag);
- blocks.add(blck);
- }
- fnctn.setNumBlocks(length);
- continue;
- }
- else if (tag == GCOV_TAG_ARCS){
- int srcBlockIndice = stream.readInt();
- int nmbrArcs = (length-1)/2;
- ArrayList<Arc> arcs = new ArrayList<Arc>(nmbrArcs);
-
- for (int i = 0; i < nmbrArcs; i++) {
- int dstnatnBlockIndice = stream.readInt();
- long flag = (stream.readInt()&MasksGenerator.UNSIGNED_INT_MASK);
- Arc arc = new Arc(srcBlockIndice, dstnatnBlockIndice, flag, blocks);
- arcs.add(arc);
- }
-
- // each arc, register it as exit of the src block
- Block srcBlk = blocks.get(srcBlockIndice);
- for (Arc a : arcs) {
- srcBlk.addExitArcs(a);
- srcBlk.incNumSuccs();
- }
-
- // each arc, register it as entry of its dstntn block
- for (Arc a : arcs) {
- Block dstntnBlk = a.getDstnatnBlock();
- dstntnBlk.addEntryArcs(a);
- dstntnBlk.incNumPreds();
- }
-
- for (Arc a : arcs) {
- if (a.isFake() == true) {
- if (a.getSrcBlock() != null ) {
- // Exceptional exit from this function, the
- // source block must be a call.
- srcBlk = blocks.get((int)srcBlockIndice);
- srcBlk.setCallSite(true);
- a.setCallNonReturn(true);
- } else {
- a.setNonLoclaReturn(true);
- Block dstntnBlk = a.getDstnatnBlock();
- dstntnBlk.setNonLocalReturn(true);
- }
- }
-
- if (a.isOnTree() == false)
- fnctn.incNumCounts();
- //nbrCounts++;
- }
-
- fnctn.setFunctionBlocks(blocks);
- continue;
- }
-
-
- else if (tag == GCOV_TAG_LINES) {
- int numBlock = stream.readInt();
- long[] lineNos = new long[length-1];
- int ix = 0;
- do {
- long lineNumber = stream.readInt()&MasksGenerator.UNSIGNED_INT_MASK;
- if (lineNumber != 0){
- if (ix == 0){
- lineNos[ix++] = 0;
- lineNos[ix++] = source.getIndex();
- }
- lineNos[ix++]=lineNumber;
- if (lineNumber >= source.getNumLines()){
- source.setNumLines((int)lineNumber+1);
- }
- } else {
- String fileName = GcovStringReader.readString(stream);
- if (fileName == "NULL string")
- break;
-
- source = findOrAdd (fileName, currentAllSrcs);
- lineNos[ix++]=0;
- lineNos[ix++]=source.getIndex();
- }
- } while (true);
-
- fnctn.getFunctionBlocks().get(((int)numBlock))
- .setEncoding(lineNos);
-
- fnctn.getFunctionBlocks().get(((int)numBlock))
- .setNumLine(ix);
-
- continue;
- }
- }
- catch (EOFException e) {
-
- fnctn.setFunctionBlocks(blocks);
- fnctns.add(fnctn);
-
- break;
-
- }
- }//while
- }
-
- /* Getters */
- public ArrayList<GcnoFunction> getFnctns() {
- return fnctns;
- }
-
- public ArrayList<SourceFile> getcurrentAllSrcs() {
- return currentAllSrcs;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.parser;
+
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.linuxtools.gcov.Activator;
+import org.eclipse.linuxtools.internal.gcov.utils.BEDataInputStream;
+import org.eclipse.linuxtools.internal.gcov.utils.GcovStringReader;
+import org.eclipse.linuxtools.internal.gcov.utils.LEDataInputStream;
+import org.eclipse.linuxtools.internal.gcov.utils.MasksGenerator;
+
+
+public class GcnoRecordsParser {
+
+ private static final int GCOV_NOTE_MAGIC = 0x67636e6f; // en ASCII: 67=g 63=c 6e=n 6f=o
+ private static final int GCOV_TAG_FUNCTION = 0x01000000;
+ private static final int GCOV_TAG_BLOCKS = 0x01410000;
+ private static final int GCOV_TAG_ARCS = 0x01430000;
+ private static final int GCOV_TAG_LINES = 0x01450000;
+
+ private GcnoFunction fnctn = null;
+ private final ArrayList<GcnoFunction> fnctns = new ArrayList<GcnoFunction>();
+ private final ArrayList<SourceFile> currentAllSrcs;
+ private final HashMap<String, SourceFile> sourceMap;
+
+ public GcnoRecordsParser(HashMap<String, SourceFile> sourceMap, ArrayList<SourceFile> AllSrcs){
+ this.sourceMap = sourceMap;
+ this.currentAllSrcs = AllSrcs;
+ }
+
+ private SourceFile findOrAdd (String fileName, ArrayList<SourceFile> srcs)
+ {
+ SourceFile newsrc = sourceMap.get(fileName);
+ if (newsrc == null) {
+ newsrc = new SourceFile(fileName, srcs.size()+1);
+ srcs.add(newsrc);
+ sourceMap.put(fileName, newsrc);
+ }
+ return newsrc; //return the new added element
+ }
+
+
+ public void parseData(DataInput stream) throws IOException, CoreException{
+ // header data
+ int magic = 0;
+ // blocks data
+ ArrayList<Block> blocks = null;
+ // source file data
+ SourceFile source = null;
+ // flag
+ boolean parseFirstFnctn = false;
+
+ magic = stream.readInt();
+ //version = stream.readInt();
+ stream.readInt();
+ //stamp = stream.readInt();
+ stream.readInt();
+
+ if (magic == GCOV_NOTE_MAGIC){
+ stream = new BEDataInputStream((DataInputStream) stream);
+ }else{
+ magic = (magic >> 16) | (magic << 16);
+ magic = ((magic & 0xff00ff) << 8) | ((magic >> 8) & 0xff00ff);
+ if (magic == GCOV_NOTE_MAGIC){
+ stream = new LEDataInputStream((DataInputStream) stream);
+ }else{
+ String message = magic + " :desn't correspond to a correct note file header\n";
+ Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
+ throw new CoreException(status);
+ }
+ }
+
+ /*------------------------------------------------------------------------------
+ System.out.println("Gcno LE, Magic "+magic+" version "+version+" stamp "+stamp);
+ */
+
+ while (true){
+ try{
+ int tag;
+ // parse header
+ while (true){
+ tag=stream.readInt();
+ if (tag == GCOV_TAG_FUNCTION || tag == GCOV_TAG_BLOCKS ||
+ tag == GCOV_TAG_ARCS || tag == GCOV_TAG_LINES)
+ break;
+ }
+ int length=stream.readInt();
+
+ // parse gcno data
+ if ((int)tag == GCOV_TAG_FUNCTION){
+ // before parse new function, add current function to functions list
+ if (parseFirstFnctn == true) fnctns.add(fnctn);
+
+ long fnctnIdent = (stream.readInt()&MasksGenerator.UNSIGNED_INT_MASK);
+ long fnctnChksm = (stream.readInt()&MasksGenerator.UNSIGNED_INT_MASK);
+ String fnctnName = GcovStringReader.readString(stream);
+ String fnctnSrcFle = GcovStringReader.readString(stream);
+ long fnctnFrstLnNmbr= (stream.readInt()&MasksGenerator.UNSIGNED_INT_MASK);
+
+ fnctn = new GcnoFunction(fnctnIdent, fnctnChksm, fnctnName, fnctnSrcFle, fnctnFrstLnNmbr);
+ SourceFile srcFle2 = findOrAdd (fnctn.getSrcFile(),currentAllSrcs);
+ if (fnctn.getFirstLineNmbr() >= srcFle2.getNumLines()){
+ srcFle2.setNumLines((int)fnctn.getFirstLineNmbr()+1);
+ }
+ srcFle2.addFnctn(fnctn);
+ parseFirstFnctn = true;
+ continue;
+ }
+
+ else if ((int)tag == GCOV_TAG_BLOCKS){
+ blocks = new ArrayList<Block>();
+ for (int i = 0; i < length; i++) {
+ long BlckFlag = stream.readInt()& MasksGenerator.UNSIGNED_INT_MASK;
+ Block blck = new Block(BlckFlag);
+ blocks.add(blck);
+ }
+ fnctn.setNumBlocks(length);
+ continue;
+ }
+ else if (tag == GCOV_TAG_ARCS){
+ int srcBlockIndice = stream.readInt();
+ int nmbrArcs = (length-1)/2;
+ ArrayList<Arc> arcs = new ArrayList<Arc>(nmbrArcs);
+
+ for (int i = 0; i < nmbrArcs; i++) {
+ int dstnatnBlockIndice = stream.readInt();
+ long flag = (stream.readInt()&MasksGenerator.UNSIGNED_INT_MASK);
+ Arc arc = new Arc(srcBlockIndice, dstnatnBlockIndice, flag, blocks);
+ arcs.add(arc);
+ }
+
+ // each arc, register it as exit of the src block
+ Block srcBlk = blocks.get(srcBlockIndice);
+ for (Arc a : arcs) {
+ srcBlk.addExitArcs(a);
+ srcBlk.incNumSuccs();
+ }
+
+ // each arc, register it as entry of its dstntn block
+ for (Arc a : arcs) {
+ Block dstntnBlk = a.getDstnatnBlock();
+ dstntnBlk.addEntryArcs(a);
+ dstntnBlk.incNumPreds();
+ }
+
+ for (Arc a : arcs) {
+ if (a.isFake() == true) {
+ if (a.getSrcBlock() != null ) {
+ // Exceptional exit from this function, the
+ // source block must be a call.
+ srcBlk = blocks.get((int)srcBlockIndice);
+ srcBlk.setCallSite(true);
+ a.setCallNonReturn(true);
+ } else {
+ a.setNonLoclaReturn(true);
+ Block dstntnBlk = a.getDstnatnBlock();
+ dstntnBlk.setNonLocalReturn(true);
+ }
+ }
+
+ if (a.isOnTree() == false)
+ fnctn.incNumCounts();
+ //nbrCounts++;
+ }
+
+ fnctn.setFunctionBlocks(blocks);
+ continue;
+ }
+
+
+ else if (tag == GCOV_TAG_LINES) {
+ int numBlock = stream.readInt();
+ long[] lineNos = new long[length-1];
+ int ix = 0;
+ do {
+ long lineNumber = stream.readInt()&MasksGenerator.UNSIGNED_INT_MASK;
+ if (lineNumber != 0){
+ if (ix == 0){
+ lineNos[ix++] = 0;
+ lineNos[ix++] = source.getIndex();
+ }
+ lineNos[ix++]=lineNumber;
+ if (lineNumber >= source.getNumLines()){
+ source.setNumLines((int)lineNumber+1);
+ }
+ } else {
+ String fileName = GcovStringReader.readString(stream);
+ if (fileName == "NULL string")
+ break;
+
+ source = findOrAdd (fileName, currentAllSrcs);
+ lineNos[ix++]=0;
+ lineNos[ix++]=source.getIndex();
+ }
+ } while (true);
+
+ fnctn.getFunctionBlocks().get(((int)numBlock))
+ .setEncoding(lineNos);
+
+ fnctn.getFunctionBlocks().get(((int)numBlock))
+ .setNumLine(ix);
+
+ continue;
+ }
+ }
+ catch (EOFException e) {
+
+ fnctn.setFunctionBlocks(blocks);
+ fnctns.add(fnctn);
+
+ break;
+
+ }
+ }//while
+ }
+
+ /* Getters */
+ public ArrayList<GcnoFunction> getFnctns() {
+ return fnctns;
+ }
+
+ public ArrayList<SourceFile> getcurrentAllSrcs() {
+ return currentAllSrcs;
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Line.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Line.java
index e2b0c4a121..e02fcb4263 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Line.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Line.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.parser;
-
-import java.io.Serializable;
-
-
-public class Line implements Serializable{
-
- /**
- *
- */
- private static final long serialVersionUID = 8804878976767948267L;
- private boolean exists = false;
- private long count = 0;
-
- /**
- * Constructor
- */
- public Line() {
- }
-
-
- /*Getters & setters*/
-
- public boolean isExists() {
- return exists;
- }
-
- public void setExists(boolean exists) {
- this.exists = exists;
- }
-
- public void setCount(long count) {
- this.count = count;
- }
-
- public long getCount() {
- return count;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.parser;
+
+import java.io.Serializable;
+
+
+public class Line implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8804878976767948267L;
+ private boolean exists = false;
+ private long count = 0;
+
+ /**
+ * Constructor
+ */
+ public Line() {
+ }
+
+
+ /*Getters & setters*/
+
+ public boolean isExists() {
+ return exists;
+ }
+
+ public void setExists(boolean exists) {
+ this.exists = exists;
+ }
+
+ public void setCount(long count) {
+ this.count = count;
+ }
+
+ public long getCount() {
+ return count;
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/SourceFile.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/SourceFile.java
index 3ba9d68173..5dc38f244c 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/SourceFile.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/SourceFile.java
@@ -1,110 +1,110 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.parser;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-public class SourceFile implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -9182882194956475711L;
- private final String name;
- private final int index;
- private final ArrayList<Line> lines = new ArrayList<Line>();
- private final TreeSet<GcnoFunction> fnctns = new TreeSet<GcnoFunction>();
- private int numLines = 1;
- private final CoverageInfo cvrge = new CoverageInfo();
- private long maxCount = -1;
-
- /**
- * Constructor
- */
- public SourceFile(String name, int index) {
- this.name = name;
- this.index = index;
- }
-
-
- public void accumulateLineCounts() {
- for (Line line : lines) {
- if (line.isExists()) {
- cvrge.incLinesInstrumented();
- if (line.getCount() != 0)
- cvrge.incLinesExecuted();
- }
- }
- }
-
- public long getmaxLineCount() {
- if (maxCount < 0) {
- for (Line line : lines) {
- if (line.getCount() > maxCount)
- maxCount = line.getCount();
- }
- }
- return maxCount;
- }
-
- /* getters & setters */
-
-
-
- public int getLinesExecuted() {
- return cvrge.getLinesExecuted();
- }
-
- public int getLinesInstrumented() {
- return cvrge.getLinesInstrumented();
- }
-
- public String getName() {
- return name;
- }
-
- public ArrayList<Line> getLines() {
- return lines;
- }
-
- public SortedSet<GcnoFunction> getFnctns() {
- return fnctns;
- }
-
- public void addFnctn(GcnoFunction fnctn) {
- this.fnctns.add(fnctn);
- }
-
- public int getNumLines() {
- return numLines;
- }
-
- public void setNumLines(int numLines) {
- this.numLines = numLines;
- }
-
- public int getIndex() {
- return index;
- }
-
- public void createLines() {
- int n = getNumLines();
- lines.ensureCapacity(n);
- for (int j = 0; j<n ; j++) {
- lines.add(new Line());
- }
- }
-
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.parser;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+public class SourceFile implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -9182882194956475711L;
+ private final String name;
+ private final int index;
+ private final ArrayList<Line> lines = new ArrayList<Line>();
+ private final TreeSet<GcnoFunction> fnctns = new TreeSet<GcnoFunction>();
+ private int numLines = 1;
+ private final CoverageInfo cvrge = new CoverageInfo();
+ private long maxCount = -1;
+
+ /**
+ * Constructor
+ */
+ public SourceFile(String name, int index) {
+ this.name = name;
+ this.index = index;
+ }
+
+
+ public void accumulateLineCounts() {
+ for (Line line : lines) {
+ if (line.isExists()) {
+ cvrge.incLinesInstrumented();
+ if (line.getCount() != 0)
+ cvrge.incLinesExecuted();
+ }
+ }
+ }
+
+ public long getmaxLineCount() {
+ if (maxCount < 0) {
+ for (Line line : lines) {
+ if (line.getCount() > maxCount)
+ maxCount = line.getCount();
+ }
+ }
+ return maxCount;
+ }
+
+ /* getters & setters */
+
+
+
+ public int getLinesExecuted() {
+ return cvrge.getLinesExecuted();
+ }
+
+ public int getLinesInstrumented() {
+ return cvrge.getLinesInstrumented();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public ArrayList<Line> getLines() {
+ return lines;
+ }
+
+ public SortedSet<GcnoFunction> getFnctns() {
+ return fnctns;
+ }
+
+ public void addFnctn(GcnoFunction fnctn) {
+ this.fnctns.add(fnctn);
+ }
+
+ public int getNumLines() {
+ return numLines;
+ }
+
+ public void setNumLines(int numLines) {
+ this.numLines = numLines;
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ public void createLines() {
+ int n = getNumLines();
+ lines.ensureCapacity(n);
+ for (int j = 0; j<n ; j++) {
+ lines.add(new Line());
+ }
+ }
+
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/utils/BEDataInputStream.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/BEDataInputStream.java
index 9765c94582..e6d31beddf 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/utils/BEDataInputStream.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/BEDataInputStream.java
@@ -1,191 +1,191 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.utils;
-
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.IOException;
-/**
- *
- */
-public class BEDataInputStream implements DataInput {
-
- private final DataInputStream in;
- private final byte[] buffer = new byte[8];
-
- /**
- * Constructor
- * @param in
- */
- public BEDataInputStream(DataInputStream in) {
- this.in = in;
- }
-
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readShort()
- */
- public final short readShort() throws IOException
- {
- return in.readShort();
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readUnsignedShort()
- */
- public final int readUnsignedShort() throws IOException
- {
- return in.readUnsignedShort();
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readChar()
- */
- public final char readChar() throws IOException
- {
- return in.readChar();
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readInt()
- */
- public final int readInt() throws IOException
- {
- return in.readInt();
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readLong()
- */
- public final long readLong() throws IOException
- {
- in.readFully(buffer, 0, 8);
- return (((long)buffer[7] << 32) +
- ((long)(buffer[6] & 255) << 40) +
- ((long)(buffer[5] & 255) << 48) +
- ((long)(buffer[4] & 255) << 56) +
- ((long)(buffer[3] & 255) << 0) +
- ((buffer[2] & 255) << 8) +
- ((buffer[1] & 255) << 16) +
- ((buffer[0] & 255) << 24));
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readFloat()
- */
- public final float readFloat() throws IOException
- {
- return Float.intBitsToFloat(readInt());
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readDouble()
- */
- public final double readDouble() throws IOException
- {
- return Double.longBitsToDouble(readLong());
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readBoolean()
- */
- public boolean readBoolean() throws IOException {
- return in.readBoolean();
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readByte()
- */
- public byte readByte() throws IOException {
- return in.readByte();
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readFully(byte[])
- */
- public void readFully(byte[] b) throws IOException {
- in.readFully(b);
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readFully(byte[], int, int)
- */
- public void readFully(byte[] b, int off, int len) throws IOException {
- in.readFully(b,off,len);
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readLine()
- */
- @Deprecated
- public String readLine() throws IOException {
- return in.readLine();
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readUTF()
- */
- public String readUTF() throws IOException {
- return in.readUTF();
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readUnsignedByte()
- */
- public int readUnsignedByte() throws IOException {
- return in.readUnsignedByte();
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#skipBytes(int)
- */
- public int skipBytes(int n) throws IOException {
- return in.skipBytes(n);
- }
-
- /**
- * Close this stream.
- */
- public void close() throws IOException {
- in.close();
- }
-
- public final long readUnsignedInt() throws IOException
- {
- in.readFully(buffer, 0, 4);
- return
- ((
- (buffer[0]) << 24 |
- (buffer[1]&0xff) << 16 |
- (buffer[2]&0xff) << 8 |
- (buffer[3]&0xff)
- )
- & MasksGenerator.UNSIGNED_INT_MASK );
- }
-
-
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.utils;
+
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.IOException;
+/**
+ *
+ */
+public class BEDataInputStream implements DataInput {
+
+ private final DataInputStream in;
+ private final byte[] buffer = new byte[8];
+
+ /**
+ * Constructor
+ * @param in
+ */
+ public BEDataInputStream(DataInputStream in) {
+ this.in = in;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readShort()
+ */
+ public final short readShort() throws IOException
+ {
+ return in.readShort();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readUnsignedShort()
+ */
+ public final int readUnsignedShort() throws IOException
+ {
+ return in.readUnsignedShort();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readChar()
+ */
+ public final char readChar() throws IOException
+ {
+ return in.readChar();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readInt()
+ */
+ public final int readInt() throws IOException
+ {
+ return in.readInt();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readLong()
+ */
+ public final long readLong() throws IOException
+ {
+ in.readFully(buffer, 0, 8);
+ return (((long)buffer[7] << 32) +
+ ((long)(buffer[6] & 255) << 40) +
+ ((long)(buffer[5] & 255) << 48) +
+ ((long)(buffer[4] & 255) << 56) +
+ ((long)(buffer[3] & 255) << 0) +
+ ((buffer[2] & 255) << 8) +
+ ((buffer[1] & 255) << 16) +
+ ((buffer[0] & 255) << 24));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readFloat()
+ */
+ public final float readFloat() throws IOException
+ {
+ return Float.intBitsToFloat(readInt());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readDouble()
+ */
+ public final double readDouble() throws IOException
+ {
+ return Double.longBitsToDouble(readLong());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readBoolean()
+ */
+ public boolean readBoolean() throws IOException {
+ return in.readBoolean();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readByte()
+ */
+ public byte readByte() throws IOException {
+ return in.readByte();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readFully(byte[])
+ */
+ public void readFully(byte[] b) throws IOException {
+ in.readFully(b);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readFully(byte[], int, int)
+ */
+ public void readFully(byte[] b, int off, int len) throws IOException {
+ in.readFully(b,off,len);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readLine()
+ */
+ @Deprecated
+ public String readLine() throws IOException {
+ return in.readLine();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readUTF()
+ */
+ public String readUTF() throws IOException {
+ return in.readUTF();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readUnsignedByte()
+ */
+ public int readUnsignedByte() throws IOException {
+ return in.readUnsignedByte();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#skipBytes(int)
+ */
+ public int skipBytes(int n) throws IOException {
+ return in.skipBytes(n);
+ }
+
+ /**
+ * Close this stream.
+ */
+ public void close() throws IOException {
+ in.close();
+ }
+
+ public final long readUnsignedInt() throws IOException
+ {
+ in.readFully(buffer, 0, 4);
+ return
+ ((
+ (buffer[0]) << 24 |
+ (buffer[1]&0xff) << 16 |
+ (buffer[2]&0xff) << 8 |
+ (buffer[3]&0xff)
+ )
+ & MasksGenerator.UNSIGNED_INT_MASK );
+ }
+
+
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/utils/GcovStringReader.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/GcovStringReader.java
index e6b13a6aaa..1c1158507e 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/utils/GcovStringReader.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/GcovStringReader.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.utils;
-
-import java.io.DataInput;
-import java.io.IOException;
-
-public class GcovStringReader {
-
-
- public static String readString(DataInput stream) throws IOException {
- String res = "NULL string";
- long length = stream.readInt()&MasksGenerator.UNSIGNED_INT_MASK;
- if (length != 0) {
- int ln = ((int) length) << 2;
- byte[] name = new byte[ln];
- stream.readFully(name);
- StringBuffer sb = new StringBuffer();
- for(int j=0; j < ln; j++){
- if(name[j]!=0){
- char c = (char) name[j];
- sb.append(c);
- }
- }
- res = sb.toString();
- }
- return res;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.utils;
+
+import java.io.DataInput;
+import java.io.IOException;
+
+public class GcovStringReader {
+
+
+ public static String readString(DataInput stream) throws IOException {
+ String res = "NULL string";
+ long length = stream.readInt()&MasksGenerator.UNSIGNED_INT_MASK;
+ if (length != 0) {
+ int ln = ((int) length) << 2;
+ byte[] name = new byte[ln];
+ stream.readFully(name);
+ StringBuffer sb = new StringBuffer();
+ for(int j=0; j < ln; j++){
+ if(name[j]!=0){
+ char c = (char) name[j];
+ sb.append(c);
+ }
+ }
+ res = sb.toString();
+ }
+ return res;
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/utils/LEDataInputStream.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/LEDataInputStream.java
index 51648e5620..3adde28110 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/utils/LEDataInputStream.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/LEDataInputStream.java
@@ -1,208 +1,208 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.utils;
-
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.IOException;
-/**
- * Little-endian implementation of DataInputStream
- * @author Xavier Raynaud <xavier.raynaud@st.com>
- *
- */
-public class LEDataInputStream implements DataInput {
-
- private final DataInputStream in;
- private final byte[] buffer = new byte[8];
-
- /**
- * Constructor
- * @param in
- */
- public LEDataInputStream(DataInputStream in) {
- this.in = in;
- }
-
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readShort()
- */
- public final short readShort() throws IOException
- {
- in.readFully(buffer, 0, 2);
- return (short)(
- (buffer[1]&0xff) << 8 |
- (buffer[0]&0xff));
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readUnsignedShort()
- */
- public final int readUnsignedShort() throws IOException
- {
- in.readFully(buffer, 0, 2);
- return (
- (buffer[1]&0xff) << 8 |
- (buffer[0]&0xff));
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readChar()
- */
- public final char readChar() throws IOException
- {
- in.readFully(buffer, 0, 2);
- return (char) (
- (buffer[1]&0xff) << 8 |
- (buffer[0]&0xff));
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readInt()
- */
- public final int readInt() throws IOException
- {
- in.readFully(buffer, 0, 4);
- return
- (buffer[3]) << 24 |
- (buffer[2]&0xff) << 16 |
- (buffer[1]&0xff) << 8 |
- (buffer[0]&0xff);
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readLong()
- */
- public final long readLong() throws IOException
- {
- in.readFully(buffer, 0, 8);
- return
- (long)(buffer[7]) << 56 | /* long cast needed or shift done modulo 32 */
- (long)(buffer[6]&0xff) << 48 |
- (long)(buffer[5]&0xff) << 40 |
- (long)(buffer[4]&0xff) << 32 |
- (long)(buffer[3]&0xff) << 24 |
- (long)(buffer[2]&0xff) << 16 |
- (long)(buffer[1]&0xff) << 8 |
- (long)(buffer[0]&0xff);
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readFloat()
- */
- public final float readFloat() throws IOException
- {
- return Float.intBitsToFloat(readInt());
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readDouble()
- */
- public final double readDouble() throws IOException
- {
- return Double.longBitsToDouble(readLong());
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readBoolean()
- */
- public boolean readBoolean() throws IOException {
- return in.readBoolean();
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readByte()
- */
- public byte readByte() throws IOException {
- return in.readByte();
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readFully(byte[])
- */
- public void readFully(byte[] b) throws IOException {
- in.readFully(b);
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readFully(byte[], int, int)
- */
- public void readFully(byte[] b, int off, int len) throws IOException {
- in.readFully(b,off,len);
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readLine()
- */
- @Deprecated
- public String readLine() throws IOException {
- return in.readLine();
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readUTF()
- */
- public String readUTF() throws IOException {
- return in.readUTF();
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#readUnsignedByte()
- */
- public int readUnsignedByte() throws IOException {
- return in.readUnsignedByte();
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.DataInput#skipBytes(int)
- */
- public int skipBytes(int n) throws IOException {
- return in.skipBytes(n);
- }
-
- /**
- * Close this stream.
- */
- public void close() throws IOException {
- in.close();
- }
-
- public final long readUnsignedInt() throws IOException
- {
- in.readFully(buffer, 0, 4);
- return
- ((
- (buffer[3]) << 24 |
- (buffer[2]&0xff) << 16 |
- (buffer[1]&0xff) << 8 |
- (buffer[0]&0xff)
- )
- & MasksGenerator.UNSIGNED_INT_MASK );
- }
-
-
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.utils;
+
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.IOException;
+/**
+ * Little-endian implementation of DataInputStream
+ * @author Xavier Raynaud <xavier.raynaud@st.com>
+ *
+ */
+public class LEDataInputStream implements DataInput {
+
+ private final DataInputStream in;
+ private final byte[] buffer = new byte[8];
+
+ /**
+ * Constructor
+ * @param in
+ */
+ public LEDataInputStream(DataInputStream in) {
+ this.in = in;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readShort()
+ */
+ public final short readShort() throws IOException
+ {
+ in.readFully(buffer, 0, 2);
+ return (short)(
+ (buffer[1]&0xff) << 8 |
+ (buffer[0]&0xff));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readUnsignedShort()
+ */
+ public final int readUnsignedShort() throws IOException
+ {
+ in.readFully(buffer, 0, 2);
+ return (
+ (buffer[1]&0xff) << 8 |
+ (buffer[0]&0xff));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readChar()
+ */
+ public final char readChar() throws IOException
+ {
+ in.readFully(buffer, 0, 2);
+ return (char) (
+ (buffer[1]&0xff) << 8 |
+ (buffer[0]&0xff));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readInt()
+ */
+ public final int readInt() throws IOException
+ {
+ in.readFully(buffer, 0, 4);
+ return
+ (buffer[3]) << 24 |
+ (buffer[2]&0xff) << 16 |
+ (buffer[1]&0xff) << 8 |
+ (buffer[0]&0xff);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readLong()
+ */
+ public final long readLong() throws IOException
+ {
+ in.readFully(buffer, 0, 8);
+ return
+ (long)(buffer[7]) << 56 | /* long cast needed or shift done modulo 32 */
+ (long)(buffer[6]&0xff) << 48 |
+ (long)(buffer[5]&0xff) << 40 |
+ (long)(buffer[4]&0xff) << 32 |
+ (long)(buffer[3]&0xff) << 24 |
+ (long)(buffer[2]&0xff) << 16 |
+ (long)(buffer[1]&0xff) << 8 |
+ (long)(buffer[0]&0xff);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readFloat()
+ */
+ public final float readFloat() throws IOException
+ {
+ return Float.intBitsToFloat(readInt());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readDouble()
+ */
+ public final double readDouble() throws IOException
+ {
+ return Double.longBitsToDouble(readLong());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readBoolean()
+ */
+ public boolean readBoolean() throws IOException {
+ return in.readBoolean();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readByte()
+ */
+ public byte readByte() throws IOException {
+ return in.readByte();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readFully(byte[])
+ */
+ public void readFully(byte[] b) throws IOException {
+ in.readFully(b);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readFully(byte[], int, int)
+ */
+ public void readFully(byte[] b, int off, int len) throws IOException {
+ in.readFully(b,off,len);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readLine()
+ */
+ @Deprecated
+ public String readLine() throws IOException {
+ return in.readLine();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readUTF()
+ */
+ public String readUTF() throws IOException {
+ return in.readUTF();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#readUnsignedByte()
+ */
+ public int readUnsignedByte() throws IOException {
+ return in.readUnsignedByte();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.io.DataInput#skipBytes(int)
+ */
+ public int skipBytes(int n) throws IOException {
+ return in.skipBytes(n);
+ }
+
+ /**
+ * Close this stream.
+ */
+ public void close() throws IOException {
+ in.close();
+ }
+
+ public final long readUnsignedInt() throws IOException
+ {
+ in.readFully(buffer, 0, 4);
+ return
+ ((
+ (buffer[3]) << 24 |
+ (buffer[2]&0xff) << 16 |
+ (buffer[1]&0xff) << 8 |
+ (buffer[0]&0xff)
+ )
+ & MasksGenerator.UNSIGNED_INT_MASK );
+ }
+
+
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/utils/MasksGenerator.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/MasksGenerator.java
index 4b8adf51c9..eb8a61ba9d 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/utils/MasksGenerator.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/MasksGenerator.java
@@ -1,15 +1,15 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.utils;
-
-public class MasksGenerator {
- public static final long UNSIGNED_INT_MASK = 0xffffffffL;
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.utils;
+
+public class MasksGenerator {
+ public static final long UNSIGNED_INT_MASK = 0xffffffffL;
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/utils/STGcovProgramChecker.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/STGcovProgramChecker.java
index ae21182799..9e8ab64bc5 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/utils/STGcovProgramChecker.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/STGcovProgramChecker.java
@@ -8,7 +8,7 @@
* Contributors:
* Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
*******************************************************************************/
-package org.eclipse.linuxtools.gcov.utils;
+package org.eclipse.linuxtools.internal.gcov.utils;
import java.io.File;
import java.io.IOException;
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/CovFileContentProvider.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFileContentProvider.java
index 1f011bccff..df069e56f7 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/CovFileContentProvider.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFileContentProvider.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.view;
-
-import java.util.LinkedList;
-
-import org.eclipse.linuxtools.gcov.model.CovFolderTreeElement;
-import org.eclipse.linuxtools.gcov.model.CovRootTreeElement;
-import org.eclipse.linuxtools.gcov.model.TreeElement;
-
-
-
-public class CovFileContentProvider extends CovFolderContentProvider {
-
- public static final CovFileContentProvider sharedInstance = new CovFileContentProvider();
-
- /**
- * Constructor
- */
- protected CovFileContentProvider() {
- }
-
- @Override
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof CovRootTreeElement) {
- CovRootTreeElement root = (CovRootTreeElement) parentElement;
- LinkedList<? extends TreeElement> ret = getElementChildrenList(root);
- return ret.toArray();
- }
- return super.getChildren(parentElement);
- }
-
- protected LinkedList<? extends TreeElement> getElementChildrenList(CovRootTreeElement root) {
- LinkedList<TreeElement> ret = new LinkedList<TreeElement>();
- LinkedList<? extends TreeElement> list = root.getChildren();
- for (TreeElement folderlist : list) {
- LinkedList<? extends TreeElement> partialList = folderlist.getChildren();
- ret.addAll(partialList);
- }
- return ret;
- }
-
- @Override
- public Object getParent(Object element) {
- Object o = super.getParent(element);
- if (o instanceof CovFolderTreeElement) {
- o = super.getParent(o);
- }
- return o;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.view;
+
+import java.util.LinkedList;
+
+import org.eclipse.linuxtools.internal.gcov.model.CovFolderTreeElement;
+import org.eclipse.linuxtools.internal.gcov.model.CovRootTreeElement;
+import org.eclipse.linuxtools.internal.gcov.model.TreeElement;
+
+
+
+public class CovFileContentProvider extends CovFolderContentProvider {
+
+ public static final CovFileContentProvider sharedInstance = new CovFileContentProvider();
+
+ /**
+ * Constructor
+ */
+ protected CovFileContentProvider() {
+ }
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof CovRootTreeElement) {
+ CovRootTreeElement root = (CovRootTreeElement) parentElement;
+ LinkedList<? extends TreeElement> ret = getElementChildrenList(root);
+ return ret.toArray();
+ }
+ return super.getChildren(parentElement);
+ }
+
+ protected LinkedList<? extends TreeElement> getElementChildrenList(CovRootTreeElement root) {
+ LinkedList<TreeElement> ret = new LinkedList<TreeElement>();
+ LinkedList<? extends TreeElement> list = root.getChildren();
+ for (TreeElement folderlist : list) {
+ LinkedList<? extends TreeElement> partialList = folderlist.getChildren();
+ ret.addAll(partialList);
+ }
+ return ret;
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ Object o = super.getParent(element);
+ if (o instanceof CovFolderTreeElement) {
+ o = super.getParent(o);
+ }
+ return o;
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/CovFolderContentProvider.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFolderContentProvider.java
index f3fbfc13c7..88e32bfb17 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/CovFolderContentProvider.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFolderContentProvider.java
@@ -1,61 +1,61 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.view;
-
-
-import java.util.LinkedList;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.linuxtools.gcov.model.TreeElement;
-import org.eclipse.linuxtools.gcov.parser.CovManager;
-
-
-public class CovFolderContentProvider implements ITreeContentProvider {
-
- /** Shared instance: this class is implemented as a Singleton */
- public static final CovFolderContentProvider sharedInstance = new CovFolderContentProvider();
-
-
- protected CovFolderContentProvider(){
- }
-
- public Object[] getChildren(Object parentElement) {
- TreeElement elem = (TreeElement) parentElement;
- LinkedList<? extends TreeElement> list = elem.getChildren();
- if (list != null)
- return list.toArray();
- else return null;
- }
-
- public Object getParent(Object element) {
- TreeElement elem = (TreeElement) element;
- return elem.getParent();
- }
-
- public boolean hasChildren(Object element) {
- TreeElement elem = (TreeElement) element;
- return elem.hasChildren();
- }
-
- public Object[] getElements(Object inputElement) {
- if (inputElement == null) return new Object[0];
- CovManager cvrgMnger = (CovManager)inputElement;
- return new Object[] {
- cvrgMnger.getRootNode()
- };
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.view;
+
+
+import java.util.LinkedList;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.linuxtools.internal.gcov.model.TreeElement;
+import org.eclipse.linuxtools.internal.gcov.parser.CovManager;
+
+
+public class CovFolderContentProvider implements ITreeContentProvider {
+
+ /** Shared instance: this class is implemented as a Singleton */
+ public static final CovFolderContentProvider sharedInstance = new CovFolderContentProvider();
+
+
+ protected CovFolderContentProvider(){
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ TreeElement elem = (TreeElement) parentElement;
+ LinkedList<? extends TreeElement> list = elem.getChildren();
+ if (list != null)
+ return list.toArray();
+ else return null;
+ }
+
+ public Object getParent(Object element) {
+ TreeElement elem = (TreeElement) element;
+ return elem.getParent();
+ }
+
+ public boolean hasChildren(Object element) {
+ TreeElement elem = (TreeElement) element;
+ return elem.hasChildren();
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement == null) return new Object[0];
+ CovManager cvrgMnger = (CovManager)inputElement;
+ return new Object[] {
+ cvrgMnger.getRootNode()
+ };
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/CovFunctionContentProvider.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFunctionContentProvider.java
index 8093b2a453..276e0e6c7a 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/CovFunctionContentProvider.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFunctionContentProvider.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.view;
-
-import java.util.LinkedList;
-
-import org.eclipse.linuxtools.gcov.model.CovFileTreeElement;
-import org.eclipse.linuxtools.gcov.model.CovRootTreeElement;
-import org.eclipse.linuxtools.gcov.model.TreeElement;
-
-
-
-
-public class CovFunctionContentProvider extends CovFileContentProvider {
-
- public static final CovFunctionContentProvider sharedInstance = new CovFunctionContentProvider();
-
- /**
- * Constructor
- */
- protected CovFunctionContentProvider() {
- }
-
- protected LinkedList<? extends TreeElement> getElementChildrenList(CovRootTreeElement root) {
- LinkedList<? extends TreeElement> list = super.getElementChildrenList(root);
- LinkedList<TreeElement> ret = new LinkedList<TreeElement>();
- for (TreeElement histTreeElem : list) {
- LinkedList<? extends TreeElement> partialList = histTreeElem.getChildren();
- ret.addAll(partialList);
- }
- return ret;
- }
-
-
- @Override
- public Object getParent(Object element) {
- Object o = super.getParent(element);
- if (o instanceof CovFileTreeElement) {
- o = super.getParent(o);
- }
- return o;
- }
-
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.view;
+
+import java.util.LinkedList;
+
+import org.eclipse.linuxtools.internal.gcov.model.CovFileTreeElement;
+import org.eclipse.linuxtools.internal.gcov.model.CovRootTreeElement;
+import org.eclipse.linuxtools.internal.gcov.model.TreeElement;
+
+
+
+
+public class CovFunctionContentProvider extends CovFileContentProvider {
+
+ public static final CovFunctionContentProvider sharedInstance = new CovFunctionContentProvider();
+
+ /**
+ * Constructor
+ */
+ protected CovFunctionContentProvider() {
+ }
+
+ protected LinkedList<? extends TreeElement> getElementChildrenList(CovRootTreeElement root) {
+ LinkedList<? extends TreeElement> list = super.getElementChildrenList(root);
+ LinkedList<TreeElement> ret = new LinkedList<TreeElement>();
+ for (TreeElement histTreeElem : list) {
+ LinkedList<? extends TreeElement> partialList = histTreeElem.getChildren();
+ ret.addAll(partialList);
+ }
+ return ret;
+ }
+
+
+ @Override
+ public Object getParent(Object element) {
+ Object o = super.getParent(element);
+ if (o instanceof CovFileTreeElement) {
+ o = super.getParent(o);
+ }
+ return o;
+ }
+
} \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/CovView.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovView.java
index 93006f5bcb..2a830eea80 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/CovView.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovView.java
@@ -1,268 +1,268 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.view;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.linuxtools.dataviewers.abstractview.AbstractSTDataView;
-import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer;
-import org.eclipse.linuxtools.dataviewers.abstractviewers.STDataViewersImages;
-import org.eclipse.linuxtools.dataviewers.actions.STExportToCSVAction;
-import org.eclipse.linuxtools.dataviewers.charts.actions.ChartAction;
-import org.eclipse.linuxtools.gcov.Activator;
-import org.eclipse.linuxtools.gcov.action.SwitchContentProviderAction;
-import org.eclipse.linuxtools.gcov.parser.CovManager;
-import org.eclipse.linuxtools.gcov.parser.SourceFile;
-import org.eclipse.linuxtools.gcov.view.annotatedsource.OpenSourceFileAction;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * @author Xavier Raynaud <xavier.raynaud@st.com>
- *
- */
-public class CovView extends AbstractSTDataView {
-
- private String defaultCSVPath = "gcov.csv";
-
- private Label label;
-
- private Action folderAction;
- private Action fileAction;
- private Action functionAction;
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractview.AbstractSTDataView#createAbstractSTViewer
- * (org.eclipse.swt.widgets.Composite)
- */
- protected AbstractSTViewer createAbstractSTViewer(Composite parent) {
- return new CovViewer(parent);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractview.AbstractSTDataViewer#contributeToToolbar(org.eclipse.jface.action.IToolBarManager)
- */
- @Override
- protected void contributeToToolbar(IToolBarManager manager) {
- super.contributeToToolbar(manager);
- manager.add(new Separator());
- manager.add(new Separator());
- manager.add(folderAction);
- manager.add(fileAction);
- manager.add(functionAction);
- manager.add(new Separator());
- manager.add(new ChartAction(getViewSite().getShell(), getSTViewer()));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractview.AbstractSTDataViewer#createActions()
- */
- @Override
- protected void createActions() {
- STDataViewersImages.getImageDescriptor(""); // workaround a bug
- super.createActions();
- folderAction = new SwitchContentProviderAction(
- "Sort coverage per folder",
- "icons/directory_obj.gif",
- getSTViewer().getViewer(),
- CovFolderContentProvider.sharedInstance);
-
- fileAction = new SwitchContentProviderAction(
- "Sort coverage per file",
- "icons/c_file_obj.gif",
- getSTViewer().getViewer(),
- CovFileContentProvider.sharedInstance);
- fileAction.setChecked(true);
-
- functionAction = new SwitchContentProviderAction(
- "Sort coverage per function",
- "icons/function_obj.gif",
- getSTViewer().getViewer(),
- CovFunctionContentProvider.sharedInstance);
- }
-
- /**
- * This is a callback that will allow us
- * to create the viewer and initialize it.
- */
- public void createPartControl(Composite parent) {
- STDataViewersImages.getImageDescriptor(""); // workaround a bug
- super.createPartControl(parent);
- GridLayout l = (GridLayout) parent.getLayout();
- l.horizontalSpacing = 0;
- l.verticalSpacing = 0;
- l.marginHeight = 0;
- l.marginWidth = 0;
- }
-
- protected void createTitle(Composite parent) {
- label = new Label(parent, SWT.WRAP);
- GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 1, 1);
- label.setLayoutData(data);
- }
-
- public static void setCovViewTitle(CovView view, String title,
- String binaryPath) {
- view.label.setText(" \n program runs = " + title
- + " \n program file : " + binaryPath + "\n ");
- view.label.getParent().layout(true);
- }
-
-
- public static void displayCovDetailedResult(String binaryPath, String gcdaFile) {
- try {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IFile binary = root.getFileForLocation(new Path(binaryPath));
- IProject project = null;
- if (binary != null) project = binary.getProject();
-
- // parse and process coverage data
- CovManager cvrgeMnger = new CovManager(binaryPath, project);
- List<String> gcdaPaths = new LinkedList<String>();
- gcdaPaths.add(gcdaFile);
- cvrgeMnger.processCovFiles(gcdaPaths, gcdaFile);
- // generate model for view
- cvrgeMnger.fillGcovView();
-
- for (SourceFile sf : cvrgeMnger.getSourceMap().values()) {
- OpenSourceFileAction.sharedInstance.openAnnotatedSourceFile(project,
- binary, sf, 0);
- }
- } catch (Exception _) {
- final String message = "An error has occured when parsing "
- + "the coverage data files :\n" + _.getMessage();
- Status status = new Status(Status.ERROR, Activator.PLUGIN_ID,
- IStatus.ERROR, message, _);
-
- Activator.getDefault().getLog().log(status);
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell();
- MessageDialog.openError(s, "Gcov Parsing Error", message);
- }
- });
- return;
- }
- }
-
- public static CovView displayCovResults(String binaryPath, String gcda) {
- try {
-
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IFile binary = root.getFileForLocation(new Path(binaryPath));
- IProject project = null;
- if (binary != null) project = binary.getProject();
-
- // parse and process coverage data
- CovManager cvrgeMnger = new CovManager(binaryPath, project);
- List<String> gcdaPaths = cvrgeMnger.getGCDALocations();
- cvrgeMnger.processCovFiles(gcdaPaths, gcda);
- // generate model for view
- cvrgeMnger.fillGcovView();
- //load an Eclipse view
- CovView cvrgeView = displayCovResults(cvrgeMnger);
- return cvrgeView;
- } catch (Exception _) {
- final String message = "An error has occured when parsing "
- + "the coverage data files :\n" + _.getMessage();
- Status status = new Status(Status.ERROR, Activator.PLUGIN_ID,
- IStatus.ERROR, message, _);
-
- Activator.getDefault().getLog().log(status);
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell();
- MessageDialog.openError(s, "Gcov Parsing Error", message);
- }
- });
- }
- return null;
- }
-
- /**
- * Used by Test engine and OpenSerAction
- * @param cvrgeMnger
- */
- public static CovView displayCovResults(CovManager cvrgeMnger) throws PartInitException {
- //load an Eclipse view
- IWorkbenchWindow window = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow();
- IWorkbenchPage page = window.getActivePage();
- CovView cvrgeView = (CovView) page.showView("org.eclipse.linuxtools.gcov.view");
-
- //view title
- CovView.setCovViewTitle(cvrgeView, Integer
- .toString((int) cvrgeMnger.getNbrPgmRuns()), cvrgeMnger
- .getBinaryPath());
-
- // load the controller
- cvrgeView.setInput(cvrgeMnger);
- CovViewer stviewer = (CovViewer) cvrgeView.getSTViewer();
- stviewer.getViewer().expandToLevel(2);
- return cvrgeView;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractview.AbstractSTDataView#createExportToCSVAction()
- */
- @Override
- protected IAction createExportToCSVAction() {
- IAction action = new STExportToCSVAction(this.getSTViewer()) {
- public void run() {
- Object o = getSTViewer().getInput();
- if (o instanceof CovManager) {
- getExporter().setFilePath(getDefaultCSVPath());
- }
- super.run();
- }
-
- };
- return action;
- }
-
- /**
- * @return the defaultCSVPath
- */
- public String getDefaultCSVPath() {
- return defaultCSVPath;
- }
-
- /**
- * @param defaultCSVPath the defaultCSVPath to set
- */
- public void setDefaultCSVPath(String defaultCSVPath) {
- this.defaultCSVPath = defaultCSVPath;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.view;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.linuxtools.dataviewers.abstractview.AbstractSTDataView;
+import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer;
+import org.eclipse.linuxtools.dataviewers.abstractviewers.STDataViewersImages;
+import org.eclipse.linuxtools.dataviewers.actions.STExportToCSVAction;
+import org.eclipse.linuxtools.dataviewers.charts.actions.ChartAction;
+import org.eclipse.linuxtools.gcov.Activator;
+import org.eclipse.linuxtools.internal.gcov.action.SwitchContentProviderAction;
+import org.eclipse.linuxtools.internal.gcov.parser.CovManager;
+import org.eclipse.linuxtools.internal.gcov.parser.SourceFile;
+import org.eclipse.linuxtools.internal.gcov.view.annotatedsource.OpenSourceFileAction;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * @author Xavier Raynaud <xavier.raynaud@st.com>
+ *
+ */
+public class CovView extends AbstractSTDataView {
+
+ private String defaultCSVPath = "gcov.csv";
+
+ private Label label;
+
+ private Action folderAction;
+ private Action fileAction;
+ private Action functionAction;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractview.AbstractSTDataView#createAbstractSTViewer
+ * (org.eclipse.swt.widgets.Composite)
+ */
+ protected AbstractSTViewer createAbstractSTViewer(Composite parent) {
+ return new CovViewer(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractview.AbstractSTDataViewer#contributeToToolbar(org.eclipse.jface.action.IToolBarManager)
+ */
+ @Override
+ protected void contributeToToolbar(IToolBarManager manager) {
+ super.contributeToToolbar(manager);
+ manager.add(new Separator());
+ manager.add(new Separator());
+ manager.add(folderAction);
+ manager.add(fileAction);
+ manager.add(functionAction);
+ manager.add(new Separator());
+ manager.add(new ChartAction(getViewSite().getShell(), getSTViewer()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractview.AbstractSTDataViewer#createActions()
+ */
+ @Override
+ protected void createActions() {
+ STDataViewersImages.getImageDescriptor(""); // workaround a bug
+ super.createActions();
+ folderAction = new SwitchContentProviderAction(
+ "Sort coverage per folder",
+ "icons/directory_obj.gif",
+ getSTViewer().getViewer(),
+ CovFolderContentProvider.sharedInstance);
+
+ fileAction = new SwitchContentProviderAction(
+ "Sort coverage per file",
+ "icons/c_file_obj.gif",
+ getSTViewer().getViewer(),
+ CovFileContentProvider.sharedInstance);
+ fileAction.setChecked(true);
+
+ functionAction = new SwitchContentProviderAction(
+ "Sort coverage per function",
+ "icons/function_obj.gif",
+ getSTViewer().getViewer(),
+ CovFunctionContentProvider.sharedInstance);
+ }
+
+ /**
+ * This is a callback that will allow us
+ * to create the viewer and initialize it.
+ */
+ public void createPartControl(Composite parent) {
+ STDataViewersImages.getImageDescriptor(""); // workaround a bug
+ super.createPartControl(parent);
+ GridLayout l = (GridLayout) parent.getLayout();
+ l.horizontalSpacing = 0;
+ l.verticalSpacing = 0;
+ l.marginHeight = 0;
+ l.marginWidth = 0;
+ }
+
+ protected void createTitle(Composite parent) {
+ label = new Label(parent, SWT.WRAP);
+ GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 1, 1);
+ label.setLayoutData(data);
+ }
+
+ public static void setCovViewTitle(CovView view, String title,
+ String binaryPath) {
+ view.label.setText(" \n program runs = " + title
+ + " \n program file : " + binaryPath + "\n ");
+ view.label.getParent().layout(true);
+ }
+
+
+ public static void displayCovDetailedResult(String binaryPath, String gcdaFile) {
+ try {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IFile binary = root.getFileForLocation(new Path(binaryPath));
+ IProject project = null;
+ if (binary != null) project = binary.getProject();
+
+ // parse and process coverage data
+ CovManager cvrgeMnger = new CovManager(binaryPath, project);
+ List<String> gcdaPaths = new LinkedList<String>();
+ gcdaPaths.add(gcdaFile);
+ cvrgeMnger.processCovFiles(gcdaPaths, gcdaFile);
+ // generate model for view
+ cvrgeMnger.fillGcovView();
+
+ for (SourceFile sf : cvrgeMnger.getSourceMap().values()) {
+ OpenSourceFileAction.sharedInstance.openAnnotatedSourceFile(project,
+ binary, sf, 0);
+ }
+ } catch (Exception _) {
+ final String message = "An error has occured when parsing "
+ + "the coverage data files :\n" + _.getMessage();
+ Status status = new Status(Status.ERROR, Activator.PLUGIN_ID,
+ IStatus.ERROR, message, _);
+
+ Activator.getDefault().getLog().log(status);
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell();
+ MessageDialog.openError(s, "Gcov Parsing Error", message);
+ }
+ });
+ return;
+ }
+ }
+
+ public static CovView displayCovResults(String binaryPath, String gcda) {
+ try {
+
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IFile binary = root.getFileForLocation(new Path(binaryPath));
+ IProject project = null;
+ if (binary != null) project = binary.getProject();
+
+ // parse and process coverage data
+ CovManager cvrgeMnger = new CovManager(binaryPath, project);
+ List<String> gcdaPaths = cvrgeMnger.getGCDALocations();
+ cvrgeMnger.processCovFiles(gcdaPaths, gcda);
+ // generate model for view
+ cvrgeMnger.fillGcovView();
+ //load an Eclipse view
+ CovView cvrgeView = displayCovResults(cvrgeMnger);
+ return cvrgeView;
+ } catch (Exception _) {
+ final String message = "An error has occured when parsing "
+ + "the coverage data files :\n" + _.getMessage();
+ Status status = new Status(Status.ERROR, Activator.PLUGIN_ID,
+ IStatus.ERROR, message, _);
+
+ Activator.getDefault().getLog().log(status);
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell();
+ MessageDialog.openError(s, "Gcov Parsing Error", message);
+ }
+ });
+ }
+ return null;
+ }
+
+ /**
+ * Used by Test engine and OpenSerAction
+ * @param cvrgeMnger
+ */
+ public static CovView displayCovResults(CovManager cvrgeMnger) throws PartInitException {
+ //load an Eclipse view
+ IWorkbenchWindow window = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
+ IWorkbenchPage page = window.getActivePage();
+ CovView cvrgeView = (CovView) page.showView("org.eclipse.linuxtools.gcov.view");
+
+ //view title
+ CovView.setCovViewTitle(cvrgeView, Integer
+ .toString((int) cvrgeMnger.getNbrPgmRuns()), cvrgeMnger
+ .getBinaryPath());
+
+ // load the controller
+ cvrgeView.setInput(cvrgeMnger);
+ CovViewer stviewer = (CovViewer) cvrgeView.getSTViewer();
+ stviewer.getViewer().expandToLevel(2);
+ return cvrgeView;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractview.AbstractSTDataView#createExportToCSVAction()
+ */
+ @Override
+ protected IAction createExportToCSVAction() {
+ IAction action = new STExportToCSVAction(this.getSTViewer()) {
+ public void run() {
+ Object o = getSTViewer().getInput();
+ if (o instanceof CovManager) {
+ getExporter().setFilePath(getDefaultCSVPath());
+ }
+ super.run();
+ }
+
+ };
+ return action;
+ }
+
+ /**
+ * @return the defaultCSVPath
+ */
+ public String getDefaultCSVPath() {
+ return defaultCSVPath;
+ }
+
+ /**
+ * @param defaultCSVPath the defaultCSVPath to set
+ */
+ public void setDefaultCSVPath(String defaultCSVPath) {
+ this.defaultCSVPath = defaultCSVPath;
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/CovViewer.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovViewer.java
index 5ec9694df1..bf3b2bf08a 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/CovViewer.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovViewer.java
@@ -1,119 +1,119 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.view;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer;
-import org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField;
-import org.eclipse.linuxtools.gcov.model.CovFileTreeElement;
-import org.eclipse.linuxtools.gcov.model.CovFunctionTreeElement;
-import org.eclipse.linuxtools.gcov.model.TreeElement;
-import org.eclipse.linuxtools.gcov.parser.CovManager;
-import org.eclipse.linuxtools.gcov.parser.SourceFile;
-import org.eclipse.linuxtools.gcov.view.annotatedsource.OpenSourceFileAction;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-
-
-public class CovViewer extends AbstractSTTreeViewer {
-
- private ISTDataViewersField[] fields;
-
- /**
- * Constructor
- * @param parent
- */
- public CovViewer(Composite parent) {
- super(parent, SWT.BORDER | SWT.H_SCROLL| SWT.V_SCROLL | SWT.MULTI |
- SWT.FULL_SELECTION);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer#createContentProvider()
- */
- @Override
- protected IContentProvider createContentProvider() {
- return CovFileContentProvider.sharedInstance;
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer#getAllFields()
- */
- @Override
- public ISTDataViewersField[] getAllFields() {
- if (fields == null) {
- fields = new ISTDataViewersField[] {
- new FieldName(),
- new FieldTotalLines(),
- new FieldInstrumentedLines(),
- new FieldExecutedLines(),
- new FieldCoveragePercentage() };
- }
- return fields;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer#getDialogSettings()
- */
- public IDialogSettings getDialogSettings() {
- return org.eclipse.linuxtools.gcov.Activator.getDefault().getDialogSettings();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer#handleOpenEvent(org.eclipse.jface.viewers.OpenEvent)
- */
- protected void handleOpenEvent(OpenEvent event) {
-
- IStructuredSelection selection = (IStructuredSelection) event
- .getSelection();
- TreeElement element = (TreeElement) selection.getFirstElement();
-
- if (element != null) {
- if (element.getParent() != null) {
- String sourceLoc = "";
- long lineNumber = 0;
-
- if (element.getClass() == CovFileTreeElement.class)
- sourceLoc = element.getName();
-
- else if (element.getClass() == CovFunctionTreeElement.class) {
- sourceLoc = ((CovFunctionTreeElement) element).getSourceFilePath();
- lineNumber =((CovFunctionTreeElement)element).getFirstLnNmbr();
- }
- CovManager cvm = (CovManager) this.getInput();
- SourceFile sourceFile = cvm.getSourceFile(sourceLoc);
- if (sourceFile != null) {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- String binaryLoc = cvm.getBinaryPath();
- IPath binaryPath = new Path(binaryLoc);
- IFile binary = root.getFileForLocation(binaryPath);
- IProject project = null;
- if (binary != null) project = binary.getProject();
-
- OpenSourceFileAction.sharedInstance.openAnnotatedSourceFile(project,
- binary, sourceFile, (int)lineNumber);
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.view;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer;
+import org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField;
+import org.eclipse.linuxtools.internal.gcov.model.CovFileTreeElement;
+import org.eclipse.linuxtools.internal.gcov.model.CovFunctionTreeElement;
+import org.eclipse.linuxtools.internal.gcov.model.TreeElement;
+import org.eclipse.linuxtools.internal.gcov.parser.CovManager;
+import org.eclipse.linuxtools.internal.gcov.parser.SourceFile;
+import org.eclipse.linuxtools.internal.gcov.view.annotatedsource.OpenSourceFileAction;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+
+
+public class CovViewer extends AbstractSTTreeViewer {
+
+ private ISTDataViewersField[] fields;
+
+ /**
+ * Constructor
+ * @param parent
+ */
+ public CovViewer(Composite parent) {
+ super(parent, SWT.BORDER | SWT.H_SCROLL| SWT.V_SCROLL | SWT.MULTI |
+ SWT.FULL_SELECTION);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer#createContentProvider()
+ */
+ @Override
+ protected IContentProvider createContentProvider() {
+ return CovFileContentProvider.sharedInstance;
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer#getAllFields()
+ */
+ @Override
+ public ISTDataViewersField[] getAllFields() {
+ if (fields == null) {
+ fields = new ISTDataViewersField[] {
+ new FieldName(),
+ new FieldTotalLines(),
+ new FieldInstrumentedLines(),
+ new FieldExecutedLines(),
+ new FieldCoveragePercentage() };
+ }
+ return fields;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer#getDialogSettings()
+ */
+ public IDialogSettings getDialogSettings() {
+ return org.eclipse.linuxtools.gcov.Activator.getDefault().getDialogSettings();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer#handleOpenEvent(org.eclipse.jface.viewers.OpenEvent)
+ */
+ protected void handleOpenEvent(OpenEvent event) {
+
+ IStructuredSelection selection = (IStructuredSelection) event
+ .getSelection();
+ TreeElement element = (TreeElement) selection.getFirstElement();
+
+ if (element != null) {
+ if (element.getParent() != null) {
+ String sourceLoc = "";
+ long lineNumber = 0;
+
+ if (element.getClass() == CovFileTreeElement.class)
+ sourceLoc = element.getName();
+
+ else if (element.getClass() == CovFunctionTreeElement.class) {
+ sourceLoc = ((CovFunctionTreeElement) element).getSourceFilePath();
+ lineNumber =((CovFunctionTreeElement)element).getFirstLnNmbr();
+ }
+ CovManager cvm = (CovManager) this.getInput();
+ SourceFile sourceFile = cvm.getSourceFile(sourceLoc);
+ if (sourceFile != null) {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ String binaryLoc = cvm.getBinaryPath();
+ IPath binaryPath = new Path(binaryLoc);
+ IFile binary = root.getFileForLocation(binaryPath);
+ IProject project = null;
+ if (binary != null) project = binary.getProject();
+
+ OpenSourceFileAction.sharedInstance.openAnnotatedSourceFile(project,
+ binary, sourceFile, (int)lineNumber);
+ }
+ }
+ }
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/FieldCoveragePercentage.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/FieldCoveragePercentage.java
index aef5074886..85f2cc21e6 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/FieldCoveragePercentage.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/FieldCoveragePercentage.java
@@ -1,99 +1,99 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.view;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-
-import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractPercentageDrawerField;
-import org.eclipse.linuxtools.dataviewers.charts.provider.IChartField;
-import org.eclipse.linuxtools.gcov.model.CovRootTreeElement;
-import org.eclipse.linuxtools.gcov.model.TreeElement;
-
-
-
-public class FieldCoveragePercentage extends AbstractPercentageDrawerField implements IChartField {
-
- public final static NumberFormat nf = new DecimalFormat("##0.0#");
-
-
- public String getColumnHeaderText() {
- return "Coverage %";
- }
-
- @Override
- public String getValue(Object obj) {
- float f = getPercentage(obj);
- if (f < 0)
- f = 0.0f;
- return nf.format(f);
- }
-
-
- /**
- * Gets the percentage value to display
- * @param obj
- * @return the percentage value to display, as a float
- */
- public float getPercentage(Object obj) {
- TreeElement e = (TreeElement) obj;
- return e.getCoveragePercentage();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractPercentageDrawerField#getNumberFormat()
- */
- @Override
- public NumberFormat getNumberFormat() {
- return nf;
- }
-
- @Override
- public boolean isSettedNumberFormat() {
- return true;
- }
-
- public String getToolTipText(Object element) {
- TreeElement e = (TreeElement) element;
- String s =" Coverage % = "+Integer.toString((int)e.getCoveragePercentage());
- return s ;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object obj1, Object obj2) {
- TreeElement e1 = (TreeElement) obj1;
- TreeElement e2 = (TreeElement) obj2;
- float f1 = e1.getCoveragePercentage();
- float f2 = e2.getCoveragePercentage();
- return Float.compare(f1, f2);
- }
-
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.charts.provider.IChartField#getNumber(java.lang.Object)
- */
- public Number getNumber(Object obj) {
- TreeElement e = (TreeElement) obj;
- float f = getPercentage(obj);
- if (e.getClass() == CovRootTreeElement.class)
- return 0;
- else {
- if (f < 0)
- f = 0.0f;
- return f;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.view;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+
+import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractPercentageDrawerField;
+import org.eclipse.linuxtools.dataviewers.charts.provider.IChartField;
+import org.eclipse.linuxtools.internal.gcov.model.CovRootTreeElement;
+import org.eclipse.linuxtools.internal.gcov.model.TreeElement;
+
+
+
+public class FieldCoveragePercentage extends AbstractPercentageDrawerField implements IChartField {
+
+ public final static NumberFormat nf = new DecimalFormat("##0.0#");
+
+
+ public String getColumnHeaderText() {
+ return "Coverage %";
+ }
+
+ @Override
+ public String getValue(Object obj) {
+ float f = getPercentage(obj);
+ if (f < 0)
+ f = 0.0f;
+ return nf.format(f);
+ }
+
+
+ /**
+ * Gets the percentage value to display
+ * @param obj
+ * @return the percentage value to display, as a float
+ */
+ public float getPercentage(Object obj) {
+ TreeElement e = (TreeElement) obj;
+ return e.getCoveragePercentage();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractPercentageDrawerField#getNumberFormat()
+ */
+ @Override
+ public NumberFormat getNumberFormat() {
+ return nf;
+ }
+
+ @Override
+ public boolean isSettedNumberFormat() {
+ return true;
+ }
+
+ public String getToolTipText(Object element) {
+ TreeElement e = (TreeElement) element;
+ String s =" Coverage % = "+Integer.toString((int)e.getCoveragePercentage());
+ return s ;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare(Object obj1, Object obj2) {
+ TreeElement e1 = (TreeElement) obj1;
+ TreeElement e2 = (TreeElement) obj2;
+ float f1 = e1.getCoveragePercentage();
+ float f2 = e2.getCoveragePercentage();
+ return Float.compare(f1, f2);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.charts.provider.IChartField#getNumber(java.lang.Object)
+ */
+ public Number getNumber(Object obj) {
+ TreeElement e = (TreeElement) obj;
+ float f = getPercentage(obj);
+ if (e.getClass() == CovRootTreeElement.class)
+ return 0;
+ else {
+ if (f < 0)
+ f = 0.0f;
+ return f;
+ }
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/FieldExecutedLines.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/FieldExecutedLines.java
index 718a117b26..3724d523a6 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/FieldExecutedLines.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/FieldExecutedLines.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.view;
-
-import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTDataViewersField;
-import org.eclipse.linuxtools.dataviewers.charts.provider.IChartField;
-import org.eclipse.linuxtools.gcov.model.TreeElement;
-
-
-public class FieldExecutedLines extends AbstractSTDataViewersField implements IChartField{
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getColumnHeaderText()
- */
- public String getColumnHeaderText() {
- return "Executed Lines";
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getValue(java.lang.Object)
- */
- public String getValue(Object obj) {
- TreeElement e = (TreeElement) obj;
- return Integer.toString(e.getExecutedLines());
- }
-
- @Override
- public String getToolTipText(Object element) {
- TreeElement e = (TreeElement) element;
- String s = "Executed lines number = "
- + Integer.toString(e.getExecutedLines());
- return s;
- }
-
- public int compare(Object obj1, Object obj2) {
- TreeElement e1 = (TreeElement) obj1;
- TreeElement e2 = (TreeElement) obj2;
- String s1 = Integer.toString(e1.getExecutedLines());
- String s2 = Integer.toString(e2.getExecutedLines());
- if (s1 == null) {
- if (s2 == null)
- return 0;
- return -1;
- }
- if (s2 == null)
- return 1;
- return s1.compareTo(s2);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.charts.provider.IChartField#getNumber(java.lang.Object)
- */
- public Number getNumber(Object obj) {
- TreeElement e = (TreeElement) obj;
- return e.getExecutedLines();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.view;
+
+import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTDataViewersField;
+import org.eclipse.linuxtools.dataviewers.charts.provider.IChartField;
+import org.eclipse.linuxtools.internal.gcov.model.TreeElement;
+
+
+public class FieldExecutedLines extends AbstractSTDataViewersField implements IChartField{
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getColumnHeaderText()
+ */
+ public String getColumnHeaderText() {
+ return "Executed Lines";
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getValue(java.lang.Object)
+ */
+ public String getValue(Object obj) {
+ TreeElement e = (TreeElement) obj;
+ return Integer.toString(e.getExecutedLines());
+ }
+
+ @Override
+ public String getToolTipText(Object element) {
+ TreeElement e = (TreeElement) element;
+ String s = "Executed lines number = "
+ + Integer.toString(e.getExecutedLines());
+ return s;
+ }
+
+ public int compare(Object obj1, Object obj2) {
+ TreeElement e1 = (TreeElement) obj1;
+ TreeElement e2 = (TreeElement) obj2;
+ String s1 = Integer.toString(e1.getExecutedLines());
+ String s2 = Integer.toString(e2.getExecutedLines());
+ if (s1 == null) {
+ if (s2 == null)
+ return 0;
+ return -1;
+ }
+ if (s2 == null)
+ return 1;
+ return s1.compareTo(s2);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.charts.provider.IChartField#getNumber(java.lang.Object)
+ */
+ public Number getNumber(Object obj) {
+ TreeElement e = (TreeElement) obj;
+ return e.getExecutedLines();
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/FieldInstrumentedLines.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/FieldInstrumentedLines.java
index 3d478ddd99..7994197c89 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/FieldInstrumentedLines.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/FieldInstrumentedLines.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.view;
-
-import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTDataViewersField;
-import org.eclipse.linuxtools.dataviewers.charts.provider.IChartField;
-import org.eclipse.linuxtools.gcov.model.TreeElement;
-
-
-
-public class FieldInstrumentedLines extends AbstractSTDataViewersField implements IChartField{
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getColumnHeaderText()
- */
- public String getColumnHeaderText() {
- return "Instrumented Lines";
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getValue(java.lang.Object)
- */
- public String getValue(Object obj) {
- TreeElement e = (TreeElement) obj;
- return Integer.toString(e.getInstrumentedLines());
- }
-
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTDataViewersField#getToolTipText(java.lang.Object)
- */
- @Override
- public String getToolTipText(Object element) {
- TreeElement e = (TreeElement) element;
- String s = "Instrumented lines number = "+Integer.toString(e.getInstrumentedLines());
- return s;
- }
-
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object obj1, Object obj2) {
- TreeElement e1 = (TreeElement) obj1;
- TreeElement e2 = (TreeElement) obj2;
- String s1 = Integer.toString(e1.getInstrumentedLines());
- String s2 = Integer.toString(e2.getInstrumentedLines());
- if (s1 == null) {
- if (s2 == null) return 0;
- return -1;
- }
- if (s2 == null) return 1;
- return s1.compareTo(s2);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.charts.provider.IChartField#getNumber(java.lang.Object)
- */
- public Number getNumber(Object obj) {
- TreeElement e = (TreeElement) obj;
- return e.getInstrumentedLines();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.view;
+
+import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTDataViewersField;
+import org.eclipse.linuxtools.dataviewers.charts.provider.IChartField;
+import org.eclipse.linuxtools.internal.gcov.model.TreeElement;
+
+
+
+public class FieldInstrumentedLines extends AbstractSTDataViewersField implements IChartField{
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getColumnHeaderText()
+ */
+ public String getColumnHeaderText() {
+ return "Instrumented Lines";
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getValue(java.lang.Object)
+ */
+ public String getValue(Object obj) {
+ TreeElement e = (TreeElement) obj;
+ return Integer.toString(e.getInstrumentedLines());
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTDataViewersField#getToolTipText(java.lang.Object)
+ */
+ @Override
+ public String getToolTipText(Object element) {
+ TreeElement e = (TreeElement) element;
+ String s = "Instrumented lines number = "+Integer.toString(e.getInstrumentedLines());
+ return s;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare(Object obj1, Object obj2) {
+ TreeElement e1 = (TreeElement) obj1;
+ TreeElement e2 = (TreeElement) obj2;
+ String s1 = Integer.toString(e1.getInstrumentedLines());
+ String s2 = Integer.toString(e2.getInstrumentedLines());
+ if (s1 == null) {
+ if (s2 == null) return 0;
+ return -1;
+ }
+ if (s2 == null) return 1;
+ return s1.compareTo(s2);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.charts.provider.IChartField#getNumber(java.lang.Object)
+ */
+ public Number getNumber(Object obj) {
+ TreeElement e = (TreeElement) obj;
+ return e.getInstrumentedLines();
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/FieldName.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/FieldName.java
index 7193628892..cd41c37492 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/FieldName.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/FieldName.java
@@ -1,69 +1,69 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.view;
-
-import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTDataViewersField;
-import org.eclipse.linuxtools.gcov.model.TreeElement;
-
-
-public class FieldName extends AbstractSTDataViewersField {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getColumnHeaderText()
- */
- @Override
- public String getColumnHeaderText() {
- return "Name";
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getValue(java.lang.Object)
- */
- @Override
- public String getValue(Object obj) {
- TreeElement e = (TreeElement) obj;
- String nm = e.getName();
- nm = nm.substring(nm.lastIndexOf('/')+1);
- nm = nm.substring(nm.lastIndexOf('\\')+1);
- return nm;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTDataViewersField#getToolTipText(java.lang.Object)
- */
- @Override
- public String getToolTipText(Object element) {
- TreeElement elem = (TreeElement) element;
- String s = elem.getName();
- return s;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#compare(java.lang.Object, java.lang.Object)
- */
- @Override
- public int compare(Object obj1, Object obj2) {
- String s1 = getValue(obj1);
- String s2 = getValue(obj2);
- if (s1 == null) {
- if (s2 == null)
- return 0;
- return -1;
- }
- if (s2 == null)
- return 1;
- return s1.compareTo(s2);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.view;
+
+import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTDataViewersField;
+import org.eclipse.linuxtools.internal.gcov.model.TreeElement;
+
+
+public class FieldName extends AbstractSTDataViewersField {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getColumnHeaderText()
+ */
+ @Override
+ public String getColumnHeaderText() {
+ return "Name";
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getValue(java.lang.Object)
+ */
+ @Override
+ public String getValue(Object obj) {
+ TreeElement e = (TreeElement) obj;
+ String nm = e.getName();
+ nm = nm.substring(nm.lastIndexOf('/')+1);
+ nm = nm.substring(nm.lastIndexOf('\\')+1);
+ return nm;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTDataViewersField#getToolTipText(java.lang.Object)
+ */
+ @Override
+ public String getToolTipText(Object element) {
+ TreeElement elem = (TreeElement) element;
+ String s = elem.getName();
+ return s;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#compare(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public int compare(Object obj1, Object obj2) {
+ String s1 = getValue(obj1);
+ String s2 = getValue(obj2);
+ if (s1 == null) {
+ if (s2 == null)
+ return 0;
+ return -1;
+ }
+ if (s2 == null)
+ return 1;
+ return s1.compareTo(s2);
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/FieldTotalLines.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/FieldTotalLines.java
index 993679ba12..1ec3913dcf 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/FieldTotalLines.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/FieldTotalLines.java
@@ -1,82 +1,82 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.view;
-
-
-import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTDataViewersField;
-import org.eclipse.linuxtools.gcov.model.CovFileTreeElement;
-import org.eclipse.linuxtools.gcov.model.CovFunctionTreeElement;
-import org.eclipse.linuxtools.gcov.model.TreeElement;
-
-
-
-public class FieldTotalLines extends AbstractSTDataViewersField {
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getColumnHeaderText()
- */
- @Override
- public String getColumnHeaderText() {
- return "Total Lines";
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getValue(java.lang.Object)
- */
- @Override
- public String getValue(Object obj) {
- TreeElement e = (TreeElement) obj;
- if (e.getClass() != CovFunctionTreeElement.class)
- return Integer.toString(e.getTotalLines());
- else
- return "";
- }
-
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTDataViewersField#getToolTipText(java.lang.Object)
- */
- @Override
- public String getToolTipText(Object element) {
- TreeElement e = (TreeElement) element;
- if (e.getClass() != CovFunctionTreeElement.class)
- return "Total lines number = "+Integer.toString(e.getTotalLines());
- else
- return "";
- }
-
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#compare(java.lang.Object, java.lang.Object)
- */
- @Override
- public int compare(Object obj1, Object obj2) {
- TreeElement e1 = (TreeElement) obj1;
- TreeElement e2 = (TreeElement) obj2;
-
- if (e1.getClass() == CovFileTreeElement.class) {
- String s1 = Integer.toString(((CovFileTreeElement)e1).getTotalLines());
- String s2 = Integer.toString(((CovFileTreeElement)e2).getTotalLines());
- if (s1 == null) {
- if (s2 == null)
- return 0;
- return -1;
- }
- if (s2 == null)
- return 1;
- return s1.compareTo(s2);
- }
- else return 0;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.view;
+
+
+import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTDataViewersField;
+import org.eclipse.linuxtools.internal.gcov.model.CovFileTreeElement;
+import org.eclipse.linuxtools.internal.gcov.model.CovFunctionTreeElement;
+import org.eclipse.linuxtools.internal.gcov.model.TreeElement;
+
+
+
+public class FieldTotalLines extends AbstractSTDataViewersField {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getColumnHeaderText()
+ */
+ @Override
+ public String getColumnHeaderText() {
+ return "Total Lines";
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#getValue(java.lang.Object)
+ */
+ @Override
+ public String getValue(Object obj) {
+ TreeElement e = (TreeElement) obj;
+ if (e.getClass() != CovFunctionTreeElement.class)
+ return Integer.toString(e.getTotalLines());
+ else
+ return "";
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTDataViewersField#getToolTipText(java.lang.Object)
+ */
+ @Override
+ public String getToolTipText(Object element) {
+ TreeElement e = (TreeElement) element;
+ if (e.getClass() != CovFunctionTreeElement.class)
+ return "Total lines number = "+Integer.toString(e.getTotalLines());
+ else
+ return "";
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField#compare(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public int compare(Object obj1, Object obj2) {
+ TreeElement e1 = (TreeElement) obj1;
+ TreeElement e2 = (TreeElement) obj2;
+
+ if (e1.getClass() == CovFileTreeElement.class) {
+ String s1 = Integer.toString(((CovFileTreeElement)e1).getTotalLines());
+ String s2 = Integer.toString(((CovFileTreeElement)e2).getTotalLines());
+ if (s1 == null) {
+ if (s2 == null)
+ return 0;
+ return -1;
+ }
+ if (s2 == null)
+ return 1;
+ return s1.compareTo(s2);
+ }
+ else return 0;
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/annotatedsource/CoverageAnnotationColumn.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/CoverageAnnotationColumn.java
index 8e098b58ac..e727be4f95 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/annotatedsource/CoverageAnnotationColumn.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/CoverageAnnotationColumn.java
@@ -1,79 +1,79 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.view.annotatedsource;
-
-
-import java.util.ArrayList;
-
-import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.ISTAnnotationColumn;
-import org.eclipse.linuxtools.gcov.parser.Line;
-import org.eclipse.linuxtools.gcov.parser.SourceFile;
-
-
-public class CoverageAnnotationColumn implements ISTAnnotationColumn {
-
-
- private final ArrayList<Line> lines;
-
- public CoverageAnnotationColumn(SourceFile sourceFile) {
- lines = sourceFile.getLines();
- }
-
- @Override
- public String getAnnotation(int index) {
- try {
- Line l = lines.get(index+1);
- if (!l.isExists()) {
- return "";
- } else {
- return Long.toString(l.getCount());
- }
- } catch (IndexOutOfBoundsException _) {
- return "";
- }
- }
-
- @Override
- public String getLongDescription(int line) {
- return null;
- }
-
- @Override
- public String getTitle() {
- return "Coverage";
- }
-
-
- @Override
- public String getHeaderTooltip() {
- return "Coverage";
- }
-
- @Override
- public String getTooltip(int index) {
- try {
- Line l = lines.get(index+1);
- if (!l.isExists()) {
- return "non executable line";
- } else {
- long count = l.getCount();
- if (count == 0) return "line never executed";
- if (count == 1) return "line executed 1 time";
- return "line executed "
- + Long.toString(count)
- + " times";
- }
- } catch (IndexOutOfBoundsException _) {
- return "non executable line";
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.view.annotatedsource;
+
+
+import java.util.ArrayList;
+
+import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.ISTAnnotationColumn;
+import org.eclipse.linuxtools.internal.gcov.parser.Line;
+import org.eclipse.linuxtools.internal.gcov.parser.SourceFile;
+
+
+public class CoverageAnnotationColumn implements ISTAnnotationColumn {
+
+
+ private final ArrayList<Line> lines;
+
+ public CoverageAnnotationColumn(SourceFile sourceFile) {
+ lines = sourceFile.getLines();
+ }
+
+ @Override
+ public String getAnnotation(int index) {
+ try {
+ Line l = lines.get(index+1);
+ if (!l.isExists()) {
+ return "";
+ } else {
+ return Long.toString(l.getCount());
+ }
+ } catch (IndexOutOfBoundsException _) {
+ return "";
+ }
+ }
+
+ @Override
+ public String getLongDescription(int line) {
+ return null;
+ }
+
+ @Override
+ public String getTitle() {
+ return "Coverage";
+ }
+
+
+ @Override
+ public String getHeaderTooltip() {
+ return "Coverage";
+ }
+
+ @Override
+ public String getTooltip(int index) {
+ try {
+ Line l = lines.get(index+1);
+ if (!l.isExists()) {
+ return "non executable line";
+ } else {
+ long count = l.getCount();
+ if (count == 0) return "line never executed";
+ if (count == 1) return "line executed 1 time";
+ return "line executed "
+ + Long.toString(count)
+ + " times";
+ }
+ } catch (IndexOutOfBoundsException _) {
+ return "non executable line";
+ }
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/annotatedsource/OpenSourceFileAction.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/OpenSourceFileAction.java
index 4852144a0d..6da345625e 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/annotatedsource/OpenSourceFileAction.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/OpenSourceFileAction.java
@@ -1,136 +1,136 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.view.annotatedsource;
-
-import java.net.URI;
-
-import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.linuxtools.binutils.link2source.STLink2SourceSupport;
-import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.AbstractSTAnnotatedSourceEditorInput;
-import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.actions.AbstractOpenSourceFileAction;
-import org.eclipse.linuxtools.gcov.Activator;
-import org.eclipse.linuxtools.gcov.parser.SourceFile;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IURIEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-
-public class OpenSourceFileAction {
-
- /**
- * Shared instance of this class
- */
- public static final OpenSourceFileAction sharedInstance = new OpenSourceFileAction();
-
- private OpenSourceFileAction() {
- }
-
-
- // FIXME: move this method in binutils plugin.
- private IFileStore getFileStore(IProject project, IPath path) {
- IEditorInput input = STLink2SourceSupport.sharedInstance.getEditorInput(path, project);
- if (input instanceof IURIEditorInput) {
- IURIEditorInput editorInput = (IURIEditorInput) input;
- URI uri = editorInput.getURI();
- try {
- IFileStore fs = EFS.getStore(uri);
- return fs;
- } catch (CoreException _) {
- return null;
- }
- }
- return null;
- }
-
-
- private AbstractSTAnnotatedSourceEditorInput getInput(SourceFile sourceFile,
- IFileStore fs) {
- AbstractSTAnnotatedSourceEditorInput input = new STAnnotatedSourceEditorInput(
- fs, sourceFile);
- IWorkbenchPage p = CUIPlugin.getActivePage();
- IEditorPart editorPart = p.findEditor(input);
- if (editorPart != null)
- p.closeEditor(editorPart, false);
- return input;
- }
-
- public void openAnnotatedSourceFile(IProject project, IFile binary, SourceFile sourceFile, int lineNumber) {
- if (sourceFile == null) return;
- String pathName = sourceFile.getName();
- if (pathName == null) return;
- IPath path = new Path(pathName);
- openAnnotatedSourceFile(project, binary, sourceFile, path, lineNumber);
- }
-
- public void openAnnotatedSourceFile(IProject project, IFile binary, SourceFile sourceFile, IPath realLocation, int lineNumber) {
- IWorkbenchPage page = CUIPlugin.getActivePage();
- if (page != null) {
- IFileStore fs = getFileStore(project, realLocation);
- if (fs == null && !realLocation.isAbsolute() && binary != null) {
- IPath p = binary.getProjectRelativePath().removeLastSegments(1);
- fs = getFileStore(project, p.append(realLocation));
- }
- if (fs == null) {
- try {
- page.openEditor(new STAnnotatedSourceNotFoundEditorInput(project,sourceFile,
- realLocation, lineNumber),
- STAnnotatedSourceNotFoundEditor.ID, true);
- } catch (PartInitException e) {
- Status s = new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- IStatus.ERROR, "Error when opening annotated source view",
- e);
- Activator.getDefault().getLog().log(s);
- }
- } else {
- IEditorInput input = getInput(sourceFile, fs);
- try {
- IEditorPart editor = page.openEditor(input,
- AbstractOpenSourceFileAction.EDITOR_ID, true);
- if (lineNumber > 0 && editor instanceof ITextEditor) {
- IDocumentProvider provider = ((ITextEditor) editor).getDocumentProvider();
- IDocument document = provider.getDocument(editor.getEditorInput());
- try {
- int start = document.getLineOffset(lineNumber - 1);
- ((ITextEditor) editor).selectAndReveal(start, 0);
- } catch (BadLocationException _) {
- // ignore
- }
- IWorkbenchPage p = editor.getSite().getPage();
- p.activate(editor);
- }
- } catch (PartInitException e) {
- Status s = new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- IStatus.ERROR, "Error when opening annotated source view",
- e);
- Activator.getDefault().getLog().log(s);
- }
- }
- }
- }
-
-
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.view.annotatedsource;
+
+import java.net.URI;
+
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.linuxtools.binutils.link2source.STLink2SourceSupport;
+import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.AbstractSTAnnotatedSourceEditorInput;
+import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.actions.AbstractOpenSourceFileAction;
+import org.eclipse.linuxtools.gcov.Activator;
+import org.eclipse.linuxtools.internal.gcov.parser.SourceFile;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IURIEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+
+public class OpenSourceFileAction {
+
+ /**
+ * Shared instance of this class
+ */
+ public static final OpenSourceFileAction sharedInstance = new OpenSourceFileAction();
+
+ private OpenSourceFileAction() {
+ }
+
+
+ // FIXME: move this method in binutils plugin.
+ private IFileStore getFileStore(IProject project, IPath path) {
+ IEditorInput input = STLink2SourceSupport.sharedInstance.getEditorInput(path, project);
+ if (input instanceof IURIEditorInput) {
+ IURIEditorInput editorInput = (IURIEditorInput) input;
+ URI uri = editorInput.getURI();
+ try {
+ IFileStore fs = EFS.getStore(uri);
+ return fs;
+ } catch (CoreException _) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+
+ private AbstractSTAnnotatedSourceEditorInput getInput(SourceFile sourceFile,
+ IFileStore fs) {
+ AbstractSTAnnotatedSourceEditorInput input = new STAnnotatedSourceEditorInput(
+ fs, sourceFile);
+ IWorkbenchPage p = CUIPlugin.getActivePage();
+ IEditorPart editorPart = p.findEditor(input);
+ if (editorPart != null)
+ p.closeEditor(editorPart, false);
+ return input;
+ }
+
+ public void openAnnotatedSourceFile(IProject project, IFile binary, SourceFile sourceFile, int lineNumber) {
+ if (sourceFile == null) return;
+ String pathName = sourceFile.getName();
+ if (pathName == null) return;
+ IPath path = new Path(pathName);
+ openAnnotatedSourceFile(project, binary, sourceFile, path, lineNumber);
+ }
+
+ public void openAnnotatedSourceFile(IProject project, IFile binary, SourceFile sourceFile, IPath realLocation, int lineNumber) {
+ IWorkbenchPage page = CUIPlugin.getActivePage();
+ if (page != null) {
+ IFileStore fs = getFileStore(project, realLocation);
+ if (fs == null && !realLocation.isAbsolute() && binary != null) {
+ IPath p = binary.getProjectRelativePath().removeLastSegments(1);
+ fs = getFileStore(project, p.append(realLocation));
+ }
+ if (fs == null) {
+ try {
+ page.openEditor(new STAnnotatedSourceNotFoundEditorInput(project,sourceFile,
+ realLocation, lineNumber),
+ STAnnotatedSourceNotFoundEditor.ID, true);
+ } catch (PartInitException e) {
+ Status s = new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ IStatus.ERROR, "Error when opening annotated source view",
+ e);
+ Activator.getDefault().getLog().log(s);
+ }
+ } else {
+ IEditorInput input = getInput(sourceFile, fs);
+ try {
+ IEditorPart editor = page.openEditor(input,
+ AbstractOpenSourceFileAction.EDITOR_ID, true);
+ if (lineNumber > 0 && editor instanceof ITextEditor) {
+ IDocumentProvider provider = ((ITextEditor) editor).getDocumentProvider();
+ IDocument document = provider.getDocument(editor.getEditorInput());
+ try {
+ int start = document.getLineOffset(lineNumber - 1);
+ ((ITextEditor) editor).selectAndReveal(start, 0);
+ } catch (BadLocationException _) {
+ // ignore
+ }
+ IWorkbenchPage p = editor.getSite().getPage();
+ p.activate(editor);
+ }
+ } catch (PartInitException e) {
+ Status s = new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ IStatus.ERROR, "Error when opening annotated source view",
+ e);
+ Activator.getDefault().getLog().log(s);
+ }
+ }
+ }
+ }
+
+
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/annotatedsource/STAnnotatedSourceEditorInput.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/STAnnotatedSourceEditorInput.java
index a74bc69ef8..0cac89efed 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/annotatedsource/STAnnotatedSourceEditorInput.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/STAnnotatedSourceEditorInput.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.gcov.view.annotatedsource;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.AbstractSTAnnotatedSourceEditorInput;
-import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.ISTAnnotationColumn;
-import org.eclipse.linuxtools.gcov.parser.Line;
-import org.eclipse.linuxtools.gcov.parser.SourceFile;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-
-
-
-public class STAnnotatedSourceEditorInput extends
-AbstractSTAnnotatedSourceEditorInput {
-
- private final SourceFile sourceFile;
- private final int lineCount;
- private final ArrayList<ISTAnnotationColumn> columns = new ArrayList<ISTAnnotationColumn>();
-
- public static final Color GREEN = new Color(PlatformUI.getWorkbench().getDisplay(), 0 ,128, 0);
-
- // FIXME: dispose colors ?
- private static final Color[] greenColors = new Color[129];
-
-
- public STAnnotatedSourceEditorInput(IFileStore fileStore, SourceFile sourceFile){
- super(fileStore);
- this.sourceFile = sourceFile;
- lineCount = sourceFile.getLines().size();
- this.columns.add(new CoverageAnnotationColumn(sourceFile));
- }
-
- @Override
- public Color getColor(int ln) {
- final int index = ln + 1;
- Display display = PlatformUI.getWorkbench().getDisplay();
- if (index < lineCount){
- ArrayList<Line> lines = sourceFile.getLines();
- Line line = lines.get(index);
- if (line.isExists()) {
- long count = line.getCount();
- if (count == 0) return display.getSystemColor(SWT.COLOR_RED);;
- if (count == sourceFile.getmaxLineCount()) return GREEN;
- int colorIndex = 128 - (int) ((128*count)/sourceFile.getmaxLineCount());
- if (greenColors[colorIndex] == null) {
- greenColors[colorIndex] = new Color(display, colorIndex,127+colorIndex,colorIndex);
- }
- return greenColors[colorIndex];
- }
- }
- return display.getSystemColor(SWT.COLOR_WHITE);
- }
-
- @Override
- public ArrayList<ISTAnnotationColumn> getColumns() {
- return columns;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.gcov.view.annotatedsource;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.AbstractSTAnnotatedSourceEditorInput;
+import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.ISTAnnotationColumn;
+import org.eclipse.linuxtools.internal.gcov.parser.Line;
+import org.eclipse.linuxtools.internal.gcov.parser.SourceFile;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+
+
+
+public class STAnnotatedSourceEditorInput extends
+AbstractSTAnnotatedSourceEditorInput {
+
+ private final SourceFile sourceFile;
+ private final int lineCount;
+ private final ArrayList<ISTAnnotationColumn> columns = new ArrayList<ISTAnnotationColumn>();
+
+ public static final Color GREEN = new Color(PlatformUI.getWorkbench().getDisplay(), 0 ,128, 0);
+
+ // FIXME: dispose colors ?
+ private static final Color[] greenColors = new Color[129];
+
+
+ public STAnnotatedSourceEditorInput(IFileStore fileStore, SourceFile sourceFile){
+ super(fileStore);
+ this.sourceFile = sourceFile;
+ lineCount = sourceFile.getLines().size();
+ this.columns.add(new CoverageAnnotationColumn(sourceFile));
+ }
+
+ @Override
+ public Color getColor(int ln) {
+ final int index = ln + 1;
+ Display display = PlatformUI.getWorkbench().getDisplay();
+ if (index < lineCount){
+ ArrayList<Line> lines = sourceFile.getLines();
+ Line line = lines.get(index);
+ if (line.isExists()) {
+ long count = line.getCount();
+ if (count == 0) return display.getSystemColor(SWT.COLOR_RED);;
+ if (count == sourceFile.getmaxLineCount()) return GREEN;
+ int colorIndex = 128 - (int) ((128*count)/sourceFile.getmaxLineCount());
+ if (greenColors[colorIndex] == null) {
+ greenColors[colorIndex] = new Color(display, colorIndex,127+colorIndex,colorIndex);
+ }
+ return greenColors[colorIndex];
+ }
+ }
+ return display.getSystemColor(SWT.COLOR_WHITE);
+ }
+
+ @Override
+ public ArrayList<ISTAnnotationColumn> getColumns() {
+ return columns;
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditor.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditor.java
index b73a617390..4b1e49428a 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditor.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditor.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2009 STMicroelectronics.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.gcov.view.annotatedsource;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.linuxtools.binutils.link2source.STCSourceNotFoundEditor;
-import org.eclipse.linuxtools.gcov.parser.SourceFile;
-import org.eclipse.ui.IEditorInput;
-
-
-/**
- * @author Xavier Raynaud <xavier.raynaud@st.com>
- *
- */
-public class STAnnotatedSourceNotFoundEditor extends
- STCSourceNotFoundEditor {
-
- public static final String ID = "org.eclipse.linuxtools.gcov.view.annotatedsource.STAnnotatedSourceNotFoundEditor";
-
- public STAnnotatedSourceNotFoundEditor() {
-
- }
-
-
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.binutils.link2source.STCSourceNotFoundEditor#openSourceFileAtLocation(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, int)
- */
- protected void openSourceFileAtLocation(IProject project, IPath sourceLoc,
- int lineNumber) {
- IEditorInput input = this.getEditorInput();
- if (input instanceof STAnnotatedSourceNotFoundEditorInput) {
- STAnnotatedSourceNotFoundEditorInput editorInput = (STAnnotatedSourceNotFoundEditorInput) input;
- SourceFile sf = editorInput.getSourceFile();
- OpenSourceFileAction.sharedInstance.openAnnotatedSourceFile(project, null, sf, sourceLoc, lineNumber);
- } else {
- super.openSourceFileAtLocation(project, sourceLoc, lineNumber);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.gcov.view.annotatedsource;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.linuxtools.binutils.link2source.STCSourceNotFoundEditor;
+import org.eclipse.linuxtools.internal.gcov.parser.SourceFile;
+import org.eclipse.ui.IEditorInput;
+
+
+/**
+ * @author Xavier Raynaud <xavier.raynaud@st.com>
+ *
+ */
+public class STAnnotatedSourceNotFoundEditor extends
+ STCSourceNotFoundEditor {
+
+ public static final String ID = "org.eclipse.linuxtools.internal.gcov.view.annotatedsource.STAnnotatedSourceNotFoundEditor";
+
+ public STAnnotatedSourceNotFoundEditor() {
+
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.binutils.link2source.STCSourceNotFoundEditor#openSourceFileAtLocation(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, int)
+ */
+ protected void openSourceFileAtLocation(IProject project, IPath sourceLoc,
+ int lineNumber) {
+ IEditorInput input = this.getEditorInput();
+ if (input instanceof STAnnotatedSourceNotFoundEditorInput) {
+ STAnnotatedSourceNotFoundEditorInput editorInput = (STAnnotatedSourceNotFoundEditorInput) input;
+ SourceFile sf = editorInput.getSourceFile();
+ OpenSourceFileAction.sharedInstance.openAnnotatedSourceFile(project, null, sf, sourceLoc, lineNumber);
+ } else {
+ super.openSourceFileAtLocation(project, sourceLoc, lineNumber);
+ }
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditorInput.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditorInput.java
index fb34914975..2015f605a2 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditorInput.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditorInput.java
@@ -8,12 +8,12 @@
* Contributors:
* Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
*******************************************************************************/
-package org.eclipse.linuxtools.gcov.view.annotatedsource;
+package org.eclipse.linuxtools.internal.gcov.view.annotatedsource;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.linuxtools.binutils.link2source.STCSourceNotFoundEditorInput;
-import org.eclipse.linuxtools.gcov.parser.SourceFile;
+import org.eclipse.linuxtools.internal.gcov.parser.SourceFile;
public class STAnnotatedSourceNotFoundEditorInput extends STCSourceNotFoundEditorInput {

Back to the top