Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWainer S. Moschetta2014-08-20 14:06:18 +0000
committerWainer dos Santos Moschetta2014-08-21 19:56:13 +0000
commit524ff9d3eddda6445669fbc998428b31f5d283ed (patch)
tree46cedd407baeb9117faff8dda445dcbc9804050d
parent27d73691d3386926db147302225cc5057d52ab5a (diff)
downloadorg.eclipse.linuxtools-524ff9d3eddda6445669fbc998428b31f5d283ed.tar.gz
org.eclipse.linuxtools-524ff9d3eddda6445669fbc998428b31f5d283ed.tar.xz
org.eclipse.linuxtools-524ff9d3eddda6445669fbc998428b31f5d283ed.zip
oprofile: fix error to execute operf in synchronized projects
operf execution were not working in synchronized project because it was passing local folder in --session-dir parameter. Changed to use remote proxy manager to determine the folder properly. Change-Id: Id465a386999855a49806344fa6fe78508cd9aafa Signed-off-by: Wainer S. Moschetta <wainersm@linux.vnet.ibm.com> Reviewed-on: https://git.eclipse.org/r/31998 Reviewed-by: Roberto Oliveira <rdutra@linux.vnet.ibm.com> Tested-by: Hudson CI (cherry picked from commit df42392dd27d0d3e3fc18321d22e9828fc8d7b5d) Reviewed-on: https://git.eclipse.org/r/32101
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/linux/OpxmlRunner.java20
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java12
2 files changed, 26 insertions, 6 deletions
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/linux/OpxmlRunner.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/linux/OpxmlRunner.java
index d36f6bedf3..752aac35f8 100644
--- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/linux/OpxmlRunner.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/linux/OpxmlRunner.java
@@ -29,6 +29,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.linuxtools.internal.oprofile.core.Oprofile;
@@ -41,6 +42,8 @@ import org.eclipse.linuxtools.internal.oprofile.core.opxml.checkevent.CheckEvent
import org.eclipse.linuxtools.internal.oprofile.core.opxml.info.InfoAdapter;
import org.eclipse.linuxtools.internal.oprofile.core.opxml.modeldata.ModelDataAdapter;
import org.eclipse.linuxtools.internal.oprofile.core.opxml.sessions.SessionManager;
+import org.eclipse.linuxtools.profiling.launch.IRemoteFileProxy;
+import org.eclipse.linuxtools.profiling.launch.RemoteProxyManager;
import org.eclipse.linuxtools.tools.launch.core.factory.RuntimeProcessFactory;
import org.eclipse.osgi.util.NLS;
import org.w3c.dom.Document;
@@ -267,8 +270,21 @@ public class OpxmlRunner {
ArrayList<String> cmd = new ArrayList<>();
cmd.add("opreport"); //$NON-NLS-1$
- if (OprofileProject.getProfilingBinary().equals(OprofileProject.OPERF_BINARY))
- cmd.add(1,"--session-dir=" + Oprofile.OprofileProject.getProject().getLocationURI().getPath() + IPath.SEPARATOR + "oprofile_data"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (OprofileProject.getProfilingBinary().equals(OprofileProject.OPERF_BINARY)) {
+ /* The session-dir parameter is relative to project's working dir, which might be
+ * local or remote. So it should use the proxy manager to determine working dir.
+ */
+ String workingDir=""; //$NON-NLS-1$
+ RemoteProxyManager proxy = RemoteProxyManager.getInstance();
+ try {
+ IRemoteFileProxy rfile = proxy.getFileProxy(Oprofile.OprofileProject.getProject());
+ workingDir = rfile.getWorkingDir().getPath();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ return null;
+ }
+ cmd.add(1,"--session-dir=" + workingDir + IPath.SEPARATOR + "oprofile_data"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
Collections.addAll(cmd, args);
Process p = null;
try {
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java
index 3a3a2b0c6a..b8e109c210 100644
--- a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java
@@ -23,7 +23,8 @@ import java.util.Arrays;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
-import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -47,6 +48,7 @@ import org.eclipse.linuxtools.internal.oprofile.launch.configuration.OprofileCou
import org.eclipse.linuxtools.internal.oprofile.ui.OprofileUiPlugin;
import org.eclipse.linuxtools.internal.oprofile.ui.view.OprofileView;
import org.eclipse.linuxtools.profiling.launch.IRemoteCommandLauncher;
+import org.eclipse.linuxtools.profiling.launch.IRemoteFileProxy;
import org.eclipse.linuxtools.profiling.launch.RemoteProxyManager;
import org.eclipse.linuxtools.tools.launch.core.factory.RuntimeProcessFactory;
import org.eclipse.ui.PartInitException;
@@ -145,9 +147,11 @@ public abstract class AbstractOprofileLaunchConfigurationDelegate extends Abstra
eventsString = spec.toString();
ArrayList<String> argArray = new ArrayList<>(Arrays.asList(getProgramArgumentsArray( config )));
- IFolder dataFolder = Oprofile.OprofileProject.getProject().getFolder(OPROFILE_DATA);
- if(!dataFolder.exists()) {
- dataFolder.create(false, true, null);
+ // Use remote file proxy to determine data folder since the project may be either local or remote
+ IRemoteFileProxy proxy = RemoteProxyManager.getInstance().getFileProxy(OprofileProject.getProject());
+ IFileStore dataFolder = proxy.getResource(oprofileWorkingDirURI(config).getPath() + IPath.SEPARATOR + OPROFILE_DATA);
+ if(! dataFolder.fetchInfo().exists()) {
+ dataFolder.mkdir(EFS.SHALLOW, null);
}
argArray.add(0, exePath.toOSString());
if (events.size()>0) {

Back to the top