aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-08-02 19:02:53 -0400
committerJeff Johnston2018-08-02 19:56:37 -0400
commit47b688acdd54039d3a0c057739312d7d719d1d22 (patch)
tree0f9ab25083472ab6e07ee5091e6f67c9bf1d335a
parent3dccb18f4f821bfd15b26a7d31358cc42a4ad570 (diff)
downloadorg.eclipse.linuxtools-47b688acdd54039d3a0c057739312d7d719d1d22.tar.gz
org.eclipse.linuxtools-47b688acdd54039d3a0c057739312d7d719d1d22.tar.xz
org.eclipse.linuxtools-47b688acdd54039d3a0c057739312d7d719d1d22.zip
Bug 537634 - IOException in CovManager.getGCDALocations
- fix CovManager to issue an error dialog if the strings command execution comes back as null and we are on Windows - make sure the error dialog indicates that the "strings" command is missing and they should consider installing minGW or Cygwin which have this command Change-Id: I0301728caa84b72a3ffb58f4867daee8f406bc16 Reviewed-on: https://git.eclipse.org/r/127003 Tested-by: CI Bot Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java15
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Messages.java4
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/messages.properties2
3 files changed, 17 insertions, 4 deletions
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java
index 5549f61fa8..9513f27ec3 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java
@@ -39,6 +39,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.linuxtools.binutils.utils.STStrings;
import org.eclipse.linuxtools.binutils.utils.STSymbolManager;
import org.eclipse.linuxtools.internal.gcov.Activator;
@@ -48,6 +49,7 @@ import org.eclipse.linuxtools.internal.gcov.model.CovFunctionTreeElement;
import org.eclipse.linuxtools.internal.gcov.model.CovRootTreeElement;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
@@ -393,9 +395,16 @@ public class CovManager implements Serializable {
List<String> l = new LinkedList<>();
Process p = getStringsProcess(strings.getName(), strings.getArgs(), binaryPath);
if (p == null) {
- Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR,
- Messages.CovManager_Retrieval_Error, new IOException());
- Activator.getDefault().getLog().log(status);
+ if (Platform.getOS().equals(Platform.OS_WIN32)) {
+ Display.getDefault().syncExec(() -> {
+ MessageDialog.openError(new Shell(), Messages.CovManager_Retrieval_Error_title,
+ Messages.CovManager_No_Strings_Windows_Error);
+ });
+ } else {
+ Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR,
+ Messages.CovManager_Retrieval_Error, new IOException());
+ Activator.getDefault().getLog().log(status);
+ }
return l;
}
ThreadConsumer t = new ThreadConsumer(p, l);
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Messages.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Messages.java
index f34ae75273..c1ef82f1b3 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Messages.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Messages.java
@@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2013, 2018 Red Hat Inc.
- *
+ *
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@@ -18,10 +18,12 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.gcov.parser.messages"; //$NON-NLS-1$
public static String CovManager_Parsing_Done;
public static String CovManager_Retrieval_Error;
+ public static String CovManager_Retrieval_Error_title;
public static String CovManager_Strings;
public static String CovManager_Summary;
public static String CovManager_No_Funcs_Error;
public static String CovManager_No_FilePath_Error;
+ public static String CovManager_No_Strings_Windows_Error;
public static String GcdaRecordsParser_content_inconsistent;
public static String GcdaRecordsParser_func_block_empty;
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/messages.properties b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/messages.properties
index a71315215f..35f2b963e9 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/messages.properties
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/messages.properties
@@ -12,10 +12,12 @@
###############################################################################
CovManager_Parsing_Done=Parse gcda and gcno files done, resolve graph algorithm executed, now display results
CovManager_Retrieval_Error=An error occured during analysis: unable to retrieve gcov data
+CovManager_Retrieval_Error_title=Unable to retrieve gcov data
CovManager_Strings=strings
CovManager_Summary=Summary
CovManager_No_Funcs_Error={0} doesn't contain any function:\n
CovManager_No_FilePath_Error={0} not found. Please enter location of {1}
+CovManager_No_Strings_Windows_Error=The 'strings' command is required and was not found. Please install a package such as minGW or Cygwin which contains the command and update your default path.
GcdaRecordsParser_content_inconsistent=GCDA content is inconsistent\n
GcdaRecordsParser_func_block_empty=Function block list is empty\n
GcdaRecordsParser_func_counter_error=Missing function or duplicate counter tag\n