aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Ashford2012-06-07 11:43:25 (EDT)
committerOtavio Pontes2012-06-21 10:44:15 (EDT)
commitef94e264aff532516aa8a9874ec8cbea27d4c3bb (patch)
tree9e1ffc56380bfa7939c5b5c6364d742900bd3b12
parent34261b6fa2feef3f91c35df503521eabf1317982 (diff)
downloadorg.eclipse.linuxtools-ef94e264aff532516aa8a9874ec8cbea27d4c3bb.zip
org.eclipse.linuxtools-ef94e264aff532516aa8a9874ec8cbea27d4c3bb.tar.gz
org.eclipse.linuxtools-ef94e264aff532516aa8a9874ec8cbea27d4c3bb.tar.bz2
Add Valgrind Remote Tab Group that uses RemoteProxyCMainTab
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ConfigUtils.java206
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.launch.remote/plugin.xml4
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.launch/META-INF/MANIFEST.MF2
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindRemoteProxyLaunchConfigurationTabGroup.java26
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindRemoteProxyLaunchDelegate.java320
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/messages.properties1
6 files changed, 557 insertions, 2 deletions
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ConfigUtils.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ConfigUtils.java
new file mode 100644
index 0000000..4f60751
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ConfigUtils.java
@@ -0,0 +1,206 @@
+package org.eclipse.linuxtools.profiling.launch;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.linuxtools.internal.profiling.launch.ProfileLaunchPlugin;
+import org.eclipse.linuxtools.profiling.launch.RemoteConnection;
+import org.eclipse.linuxtools.profiling.launch.RemoteProxyCMainTab;
+
+public class ConfigUtils {
+
+ private final static String EMPTY_STRING = "";
+
+ private ILaunchConfiguration config;
+
+ public ConfigUtils(ILaunchConfiguration config) {
+ this.config = config;
+ }
+
+ /**
+ * Check if the copy local file is enabled.
+ *
+ * @throws CoreException
+ * if the copy fails or is cancelled
+ */
+ public boolean getCopyExecutable(IProgressMonitor monitor) throws CoreException {
+ return getCopyExecutable();
+ }
+
+ /**
+ * Get if the executable shall be copied to remote target before launch.
+ *
+ * @return
+ * @throws CoreException
+ */
+ public boolean getCopyExecutable()
+ throws CoreException {
+ boolean copyExecutable = config.getAttribute(
+ RemoteProxyCMainTab.ATTR_ENABLE_COPY_FROM_EXE, false);
+ return copyExecutable;
+ }
+
+ /**
+ * Get the absolute path of the executable to copy from. If the executable is
+ * on a remote machine, this is the path to the executable on that machine.
+ *
+ * @throws CoreException
+ */
+ public String getCopyFromExecutablePath()
+ throws CoreException {
+ String executablePath = config.getAttribute(
+ RemoteProxyCMainTab.ATTR_COPY_FROM_EXE_NAME, EMPTY_STRING);
+ return executablePath;
+ }
+
+ /**
+ * Get the absolute path of the executable to launch. If the executable is
+ * on a remote machine, this is the path to the executable on that machine.
+ *
+ * @throws CoreException
+ */
+ public String getExecutablePath()
+ throws CoreException {
+ String executablePath = config.getAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EMPTY_STRING);
+ return executablePath;
+ }
+
+ /**
+ * @param path
+ * @oaram monitor
+ * @return IPath of resource at the specified path
+ * @throws CoreException
+ * @since 5.0
+ */
+ protected IPath verifyResource(String path,
+ IProgressMonitor monitor)
+ throws CoreException {
+ return Path.fromOSString(path);
+ }
+
+ /**
+ * Verify the validity of executable path. If the executable is to be
+ * copied, then no additional verification is required. Otherwise, the path
+ * must point to an existing file.
+ *
+ * @param monitor
+ * progress monitor
+ * @return IPath representing path to the executable (either local or
+ * remote)
+ * @throws CoreException
+ * if the resource can't be found or the monitor was canceled.
+ * @since 5.0
+ */
+ public IPath verifyExecutablePath(
+ IProgressMonitor monitor) throws CoreException {
+ String executablePath = getExecutablePath();
+ URI executableURI;
+
+ try {
+ executableURI = new URI(executablePath);
+ } catch (URISyntaxException e) {
+ return null;
+ }
+ RemoteConnection rc = new RemoteConnection(executableURI);
+ IFileStore fs = rc.getRmtFileProxy().getResource(executableURI.getPath());
+ IFileInfo fi = fs.fetchInfo();
+
+ if (fi.exists())
+ return Path.fromOSString(executableURI.getPath());
+ else
+ return null;
+ }
+
+ /**
+ * Get the working directory path for the application launch
+ *
+ * @return
+ * @throws CoreException
+ * @since 5.0
+ */
+ public String getWorkingDirectory()
+ throws CoreException {
+ String workingDirectory = config.getAttribute(
+ RemoteProxyCMainTab.ATTR_REMOTE_WORKING_DIRECTORY_NAME, EMPTY_STRING);
+ if (workingDirectory.length() == 0)
+ return null;
+ URI workingDirectoryURI;
+ try {
+ workingDirectoryURI = new URI(workingDirectory);
+ } catch (URISyntaxException e) {
+ // Just treat it as unusable.
+ return null;
+ }
+ return workingDirectoryURI.getPath();
+ }
+
+ /**
+ * Verify that the project exists prior to the launch.
+ *
+ * @return
+ * @throws CoreException
+ */
+ protected IProject verifyProject(ILaunchConfiguration configuration) throws CoreException {
+ String proName = getProjectName(configuration);
+ if (proName == null) {
+ throw new CoreException(new Status(IStatus.ERROR, ProfileLaunchPlugin.PLUGIN_ID,
+ "Messages.AbstractParallelLaunchConfigurationDelegate_Project_not_specified"));
+ }
+
+ IProject project = getProject(proName);
+ if (project == null || !project.exists() || !project.isOpen()) {
+ throw new CoreException(new Status(IStatus.ERROR, ProfileLaunchPlugin.PLUGIN_ID,
+ "Messages.AbstractParallelLaunchConfigurationDelegate_Project_does_not_exist_or_is_not_a_project"));
+ }
+
+ return project;
+ }
+
+
+ protected static IWorkspaceRoot getWorkspaceRoot() {
+ return ResourcesPlugin.getWorkspace().getRoot();
+ }
+
+ /**
+ * Get the IProject object from the project name.
+ *
+ * @param project
+ * name of the project
+ * @return IProject resource
+ */
+ public static IProject getProject(String project) {
+ return getWorkspaceRoot().getProject(project);
+ }
+
+ /**
+ * Get the name of the project
+ *
+ * @return
+ * @throws CoreException
+ */
+ public String getProjectName()
+ throws CoreException {
+ return getProjectName(config);
+ }
+
+ public static String getProjectName(ILaunchConfiguration configuration)
+ throws CoreException {
+ return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String) null);
+ }
+
+
+}
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch.remote/plugin.xml b/valgrind/org.eclipse.linuxtools.valgrind.launch.remote/plugin.xml
index e59981c..3b652c2 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.launch.remote/plugin.xml
+++ b/valgrind/org.eclipse.linuxtools.valgrind.launch.remote/plugin.xml
@@ -4,7 +4,7 @@
<extension
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
- delegate="org.eclipse.linuxtools.internal.valgrind.launch.remote.ValgrindRemoteLaunchDelegate"
+ delegate="org.eclipse.linuxtools.internal.valgrind.launch.ValgrindRemoteProxyLaunchDelegate"
id="org.eclipse.linuxtools.valgrind.launch.remote.launchConfigurationType"
modes="profile"
name="%launchConfigurationType.name"
@@ -16,7 +16,7 @@
<extension
point="org.eclipse.debug.ui.launchConfigurationTabGroups">
<launchConfigurationTabGroup
- class="org.eclipse.linuxtools.internal.valgrind.launch.remote.ValgrindRemoteLaunchTabGroup"
+ class="org.eclipse.linuxtools.internal.valgrind.launch.ValgrindRemoteProxyLaunchConfigurationTabGroup"
description="%launchConfigurationTabGroup.description"
id="org.eclipse.linuxtools.valgrind.launch.remote.tabGroup"
type="org.eclipse.linuxtools.valgrind.launch.remote.launchConfigurationType">
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/META-INF/MANIFEST.MF b/valgrind/org.eclipse.linuxtools.valgrind.launch/META-INF/MANIFEST.MF
index 7304cbe..014cc23 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.launch/META-INF/MANIFEST.MF
+++ b/valgrind/org.eclipse.linuxtools.valgrind.launch/META-INF/MANIFEST.MF
@@ -28,6 +28,8 @@ Import-Package: org.eclipse.cdt.core,
org.eclipse.linuxtools.internal.valgrind.core,
org.eclipse.linuxtools.internal.valgrind.ui,
org.eclipse.linuxtools.profiling.launch,
+ org.eclipse.linuxtools.tools.launch.core.factory,
+ org.eclipse.linuxtools.tools.launch.core.properties,
org.eclipse.linuxtools.valgrind.core,
org.eclipse.linuxtools.valgrind.ui,
org.eclipse.ui.console,
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindRemoteProxyLaunchConfigurationTabGroup.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindRemoteProxyLaunchConfigurationTabGroup.java
new file mode 100644
index 0000000..9753e0b
--- /dev/null
+++ b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindRemoteProxyLaunchConfigurationTabGroup.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * 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:
+ * Elliott Baron <ebaron@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.valgrind.launch;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.linuxtools.profiling.launch.RemoteProxyProfileLaunchConfigurationTabGroup;
+
+public class ValgrindRemoteProxyLaunchConfigurationTabGroup extends
+ RemoteProxyProfileLaunchConfigurationTabGroup {
+
+ @Override
+ public AbstractLaunchConfigurationTab[] getProfileTabs() {
+ return new AbstractLaunchConfigurationTab[] {
+ new ValgrindOptionsTab()
+ };
+ }
+
+}
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindRemoteProxyLaunchDelegate.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindRemoteProxyLaunchDelegate.java
new file mode 100644
index 0000000..c03aae4
--- /dev/null
+++ b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindRemoteProxyLaunchDelegate.java
@@ -0,0 +1,320 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Elliott Baron
+ * 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:
+ * Elliott Baron <ebaron@fedoraproject.org> - initial API and implementation
+ * Red Hat Inc. - rewrite to use RemoteConnection class
+ * Corey Ashford <cjashfor@us.ibm.com> - Modified for use with an RDT-based
+ * RemoteConnection class.
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.valgrind.launch;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.linuxtools.internal.valgrind.ui.ValgrindUIPlugin;
+import org.eclipse.linuxtools.internal.valgrind.ui.ValgrindViewPart;
+import org.eclipse.linuxtools.profiling.launch.ConfigUtils;
+import org.eclipse.linuxtools.profiling.launch.IRemoteCommandLauncher;
+import org.eclipse.linuxtools.profiling.launch.IRemoteFileProxy;
+import org.eclipse.linuxtools.profiling.launch.RemoteConnection;
+import org.eclipse.linuxtools.profiling.launch.RemoteConnectionException;
+import org.eclipse.linuxtools.tools.launch.core.factory.RuntimeProcessFactory;
+import org.eclipse.linuxtools.valgrind.core.IValgrindMessage;
+import org.eclipse.linuxtools.valgrind.launch.IValgrindOutputDirectoryProvider;
+import org.eclipse.osgi.util.NLS;
+import org.osgi.framework.Version;
+
+
+public class ValgrindRemoteProxyLaunchDelegate extends ValgrindLaunchConfigurationDelegate {
+
+ private static final String VALGRIND_CMD = "valgrind"; //$NON-NLS-1$
+
+ private ConfigUtils configUtils;
+
+ public ValgrindRemoteProxyLaunchDelegate() {
+ super();
+ }
+
+ private final static String VERSION_OPT = "--version";
+
+ private String whichVersion(IProject project) {
+ String cmdArray[] = new String[2];
+ cmdArray[0] = VALGRIND_CMD;
+ cmdArray[1] = VERSION_OPT;
+
+ try {
+
+ Process p = RuntimeProcessFactory.getFactory().exec(cmdArray, project);
+
+ BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String commandOutput = stdout.readLine();
+ stdout.close();
+
+ return commandOutput;
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ private static final String VERSION_PREFIX = "valgrind-";
+ private static final char VERSION_DELIMITER = '-';
+ private static final Version MIN_VER = ValgrindLaunchPlugin.VER_3_3_0;
+
+ private Version getValgrindVersion(IProject project) throws CoreException {
+ Version valgrindVersion;
+ String verString = whichVersion(project);
+
+ if (verString == null || verString.equals(EMPTY_STRING)){
+ throw new CoreException(new Status(IStatus.ERROR, ValgrindLaunchPlugin.PLUGIN_ID, Messages.getString("ValgrindLaunchPlugin.Couldn't_determine_version"))); //$NON-NLS-1$
+ }
+
+ verString = verString.replace(VERSION_PREFIX, ""); //$NON-NLS-1$
+
+ if (verString.indexOf(VERSION_DELIMITER) > 0) {
+ verString = verString.substring(0, verString.indexOf(VERSION_DELIMITER));
+ }
+ if (verString.length() > 0) {
+ valgrindVersion = Version.parseVersion(verString);
+ }
+ else {
+ throw new CoreException(new Status(IStatus.ERROR, ValgrindLaunchPlugin.PLUGIN_ID, Messages.getString("ValgrindLaunchPlugin.Couldn't_determine_version"))); //$NON-NLS-1$
+ }
+
+ // check for minimum supported version
+ if (valgrindVersion.compareTo(MIN_VER) < 0) {
+ throw new CoreException(new Status(IStatus.ERROR, ValgrindLaunchPlugin.PLUGIN_ID, NLS.bind(Messages.getString("ValgrindLaunchPlugin.Error_min_version"), valgrindVersion.toString(), MIN_VER.toString()))); //$NON-NLS-1$
+ }
+ return valgrindVersion;
+ }
+
+
+ @Override
+ public void launch(final ILaunchConfiguration config, String mode,
+ final ILaunch launch, IProgressMonitor m) throws CoreException {
+ if (m == null) {
+ m = new NullProgressMonitor();
+ }
+
+ // Clear process as we wait on it to be instantiated
+ process = null;
+
+ SubMonitor monitor = SubMonitor.convert(m,
+ Messages.getString("ValgrindRemoteLaunchDelegate.task_name"), 10);
+ // check for cancellation
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ this.config = config;
+ this.launch = launch;
+ try {
+ // remove any output from previous run
+ ValgrindUIPlugin.getDefault().resetView();
+ // reset stored launch data
+ getPlugin().setCurrentLaunchConfiguration(null);
+ getPlugin().setCurrentLaunch(null);
+
+ this.configUtils = new ConfigUtils(config);
+ IProject project = ConfigUtils.getProject(configUtils.getProjectName());
+ URI exeURI = new URI(configUtils.getExecutablePath());
+ RemoteConnection exeRC = new RemoteConnection(exeURI);
+ monitor.worked(1);
+ String valgrindPathString = RuntimeProcessFactory.getFactory().whichCommand(VALGRIND_CMD, project);
+ IPath valgrindFullPath = Path.fromOSString(valgrindPathString);
+ boolean copyExecutable = configUtils.getCopyExecutable();
+ if (copyExecutable) {
+ URI copyExeURI = new URI(configUtils.getCopyFromExecutablePath());
+ RemoteConnection copyExeRC = new RemoteConnection(copyExeURI);
+ IRemoteFileProxy copyExeRFP = copyExeRC.getRmtFileProxy();
+ IFileStore copyExeFS = copyExeRFP.getResource(copyExeURI.getPath());
+ IRemoteFileProxy exeRFP = exeRC.getRmtFileProxy();
+ IFileStore exeFS = exeRFP.getResource(exeURI.getPath());
+ IFileInfo exeFI = exeFS.fetchInfo();
+ if (exeFI.isDirectory()) {
+ // Assume the user wants to copy the file to the given directory, using
+ // the same filename as the "copy from" executable.
+ IPath copyExePath = Path.fromOSString(copyExeURI.getPath());
+ IPath newExePath = Path.fromOSString(exeURI.getPath()).append(copyExePath.lastSegment());
+ // update the exeURI with the new path.
+ exeURI = new URI(exeURI.getScheme(), exeURI.getAuthority(), newExePath.toString(), exeURI.getQuery(), exeURI.getFragment());
+ exeFS = exeRFP.getResource(exeURI.getPath());
+ }
+ copyExeFS.copy(exeFS, EFS.OVERWRITE | EFS.SHALLOW, new SubProgressMonitor(monitor, 1));
+ // Note: assume that we don't need to create a new exeRC since the
+ // scheme and authority remain the same between the original exeURI and the new one.
+ }
+ valgrindVersion = getValgrindVersion(project);
+ IPath remoteBinFile = Path.fromOSString(exeURI.getPath());
+ String configWorkingDir = configUtils.getWorkingDirectory();
+ IFileStore workingDir;
+ if(configWorkingDir == null){
+ // If no working directory was provided, use the directory containing the
+ // the executable as the working directory.
+ IPath workingDirPath = remoteBinFile.removeLastSegments(1);
+ IRemoteFileProxy workingDirRFP = exeRC.getRmtFileProxy();
+ workingDir = workingDirRFP.getResource(workingDirPath.toOSString());
+ } else {
+ URI workingDirURI = new URI(configUtils.getWorkingDirectory());
+ RemoteConnection workingDirRC = new RemoteConnection(workingDirURI);
+ IRemoteFileProxy workingDirRFP = workingDirRC.getRmtFileProxy();
+ workingDir = workingDirRFP.getResource(workingDirURI.getPath());
+ }
+
+ IPath remoteLogDir = Path.fromOSString("/tmp/");
+ outputPath = remoteLogDir.append("eclipse-valgrind-" + System.currentTimeMillis()); //$NON-NLS-1$
+
+ exeRC.createFolder(outputPath, new SubProgressMonitor(monitor, 1));
+
+ // create/empty local output directory
+ IValgrindOutputDirectoryProvider provider = getPlugin().getOutputDirectoryProvider();
+ IPath localOutputDir = null;
+ try {
+ localOutputDir = provider.getOutputPath();
+ createDirectory(localOutputDir);
+ } catch (IOException e2) {
+ throw new CoreException(new Status(IStatus.ERROR, ValgrindLaunchPlugin.PLUGIN_ID, IStatus.OK,
+ Messages.getString(""), e2));
+ }
+
+ // tool that was launched
+ toolID = getTool(config);
+ // ask tool extension for arguments
+ dynamicDelegate = getDynamicDelegate(toolID);
+
+ String[] valgrindArgs = getValgrindArgumentsArray(config);
+ String[] executableArgs = getProgramArgumentsArray(config);
+ String[] allArgs = new String[executableArgs.length + valgrindArgs.length + 2];
+
+ int idx = 0;
+ allArgs[idx++] = VALGRIND_CMD;
+ for (String valgrindArg : valgrindArgs) {
+ allArgs[idx++] = valgrindArg;
+ }
+ allArgs[idx++] = remoteBinFile.toOSString();
+ for (String executableArg : executableArgs) {
+ allArgs[idx++] = executableArg;
+ }
+
+ Process p = RuntimeProcessFactory.getFactory().exec(allArgs, new String[0], workingDir, project);
+
+ int state = p.waitFor();
+
+ if (state != IRemoteCommandLauncher.OK) {
+ abort("valgrind launcher exited with status " + state + ". See IRemoteCommandLauncher for details.\n",
+ null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ }
+
+
+ if (p.exitValue() != 0) {
+ String line = null;
+
+ StringBuilder valgrindOutSB = new StringBuilder();
+ BufferedReader valgrindOut = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ while((line = valgrindOut.readLine()) != null ){
+ valgrindOutSB.append(line);
+ }
+
+ StringBuilder valgrindErrSB = new StringBuilder();
+ BufferedReader valgrindErr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+ while((line = valgrindErr.readLine()) != null ){
+ valgrindErrSB.append(line);
+ }
+
+ abort("Standard ouput: " + valgrindOutSB.toString() +
+ "\nStandard error: " + valgrindErrSB.toString(),
+ null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ }
+
+ // move remote log files to local directory
+ exeRC.download(outputPath, localOutputDir, new SubProgressMonitor(monitor, 1));
+
+ // remove remote log dir and all files under it
+ exeRC.delete(outputPath, new SubProgressMonitor(monitor, 1));
+
+ // store these for use by other classes
+ getPlugin().setCurrentLaunchConfiguration(config);
+ getPlugin().setCurrentLaunch(launch);
+
+ // parse Valgrind logs
+ IValgrindMessage[] messages = parseLogs(localOutputDir);
+
+ // create launch summary string to distinguish this launch
+ launchStr = createLaunchStr(valgrindFullPath);
+
+ // create view
+ ValgrindUIPlugin.getDefault().createView(launchStr, toolID);
+ // set log messages
+ ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView();
+ view.setMessages(messages);
+ monitor.worked(1);
+
+ // pass off control to extender
+ dynamicDelegate.handleLaunch(config, launch, localOutputDir, monitor.newChild(2));
+
+ // initialize tool-specific part of view
+ dynamicDelegate.initializeView(view.getDynamicView(), launchStr, monitor.newChild(1));
+
+ // refresh view
+ ValgrindUIPlugin.getDefault().refreshView();
+
+ // show view
+ ValgrindUIPlugin.getDefault().showView();
+ monitor.worked(1);
+
+ } catch (URISyntaxException e) {
+ abort(e.getLocalizedMessage(), null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ } catch (IOException e) {
+ abort(e.getLocalizedMessage(), null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ } catch (RemoteConnectionException e) {
+ abort(e.getLocalizedMessage(), null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ } catch (InterruptedException e) {
+ abort(e.getLocalizedMessage(), null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ } finally {
+ monitor.done();
+ m.done();
+ }
+ }
+
+ protected String createLaunchStr(IPath valgrindPath) throws CoreException {
+ String projectName = configUtils.getProjectName();
+ IProject project = ConfigUtils.getProject(projectName);
+ URI projectURI = project.getLocationURI();
+ String Location = projectURI.getScheme() + "://" + projectURI.getHost();
+
+ return config.getName()
+ + " [" + valgrindPath.toString() + " " + getPlugin().getToolName(toolID) + " on " + Location + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+
+ @Override
+ protected String getPluginID() {
+ return ValgrindLaunchPlugin.PLUGIN_ID;
+ }
+
+ public void onError(Throwable t) {
+ // for now do nothing
+ }
+}
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/messages.properties b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/messages.properties
index 56c9599..835bdf0 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/messages.properties
+++ b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/messages.properties
@@ -56,3 +56,4 @@ ValgrindOptionsTab.Workspace=&Workspace...
ValgrindOutputDirectory.Couldnt_create=Couldn't create {0}
ValgrindOutputDirectory.Couldnt_delete=Couldn't delete {0}
ValgrindOutputView.No_output=Valgrind found no problems to report
+ValgrindRemoteProxyLaunchDelegate.task_name=Profiling Remote C/C++ Application