summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorOtavio Pontes2011-09-06 13:21:32 (EDT)
committer Roland Grunberg2011-09-06 13:21:32 (EDT)
commitf67202d9f6817dc7dd16e46c02d110708167254f (patch)
treec9949dad56f46cfd10debbee4d2d751a4b3fe948
parent69768934373be362c47ac77435ab8e4c8ef6b5b6 (diff)
downloadorg.eclipse.linuxtools-f67202d9f6817dc7dd16e46c02d110708167254f.zip
org.eclipse.linuxtools-f67202d9f6817dc7dd16e46c02d110708167254f.tar.gz
org.eclipse.linuxtools-f67202d9f6817dc7dd16e46c02d110708167254f.tar.bz2
Fill the default callgraph launch configuration with new attributes
The default attributes from callgraph launch configuration are now the same attributes used by LaunchStapGraph to run systemtap.
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/ChangeLog14
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/META-INF/MANIFEST.MF4
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/CallgraphLaunchPlugin.java5
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/LaunchStapGraph.java8
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/SystemTapOptionsTab.java97
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/messages.properties4
6 files changed, 125 insertions, 7 deletions
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/ChangeLog b/systemtap/org.eclipse.linuxtools.callgraph.launch/ChangeLog
index 4bdb9ed..e935538 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/ChangeLog
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/ChangeLog
@@ -1,3 +1,15 @@
+2011-08-11 Otavio Pontes <obusatto@br.ibm.com>
+
+ * src/org/eclipse/linuxtools/callgraph/launch/CallgraphLaunchPlugin.java:
+ Adding function to get the active Workbench Window.
+ * src/org/eclipse/linuxtools/callgraph/launch/LaunchStapGraph.java:
+ Launch StapGraph with custom Launch Configuration.
+ * src/org/eclipse/linuxtools/callgraph/launch/SystemTapOptionsTab.java:
+ Fill default configuration with the same attributes that are used by
+ LaunchStapGraph.
+ * src/org/eclipse/linuxtools/callgraph/launch/messages.properties:
+ Adding messages for choose binary window.
+
2011-08-11 Roland Grunberg <rgrunber@redhat.com>
* src/org/eclipse/linuxtools/callgraph/launch/SystemTapOptionsTab.java:
@@ -178,4 +190,4 @@
* src/org/eclipse/linuxtools/callgraph/launch/ConfigurationOptionsSetter.java: Remove unused Options setting function
* src/org/eclipse/linuxtools/callgraph/launch/: Removed the ASTTranslationVisitor, which is never used.
- * src/org/eclipse/linuxtools/callgraph/launch/SystemTapLaunchConfigurationDelegate.java: Delete unused functions, add javadoc comments to other functions. \ No newline at end of file
+ * src/org/eclipse/linuxtools/callgraph/launch/SystemTapLaunchConfigurationDelegate.java: Delete unused functions, add javadoc comments to other functions.
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/META-INF/MANIFEST.MF b/systemtap/org.eclipse.linuxtools.callgraph.launch/META-INF/MANIFEST.MF
index 814d8c8..2b50328 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/META-INF/MANIFEST.MF
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/META-INF/MANIFEST.MF
@@ -8,12 +8,14 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.debug.ui,
org.eclipse.draw2d,
- org.eclipse.cdt.core
+ org.eclipse.cdt.core,
+ org.eclipse.cdt.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.eclipse.cdt.core.model,
org.eclipse.cdt.debug.core,
org.eclipse.cdt.launch,
+ org.eclipse.cdt.launch.ui,
org.eclipse.core.resources,
org.eclipse.debug.core,
org.eclipse.debug.ui,
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/CallgraphLaunchPlugin.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/CallgraphLaunchPlugin.java
index fc59d3c..bb5a205 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/CallgraphLaunchPlugin.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/CallgraphLaunchPlugin.java
@@ -13,6 +13,7 @@ package org.eclipse.linuxtools.callgraph.launch;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.linuxtools.callgraph.core.LaunchConfigurationConstants;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -73,8 +74,10 @@ public class CallgraphLaunchPlugin extends AbstractUIPlugin {
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(LaunchConfigurationConstants.PLUGIN_ID, path);
}
-
+ public static Shell getActiveWorkbenchShell() {
+ return getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/LaunchStapGraph.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/LaunchStapGraph.java
index 24a24f1..45078a3 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/LaunchStapGraph.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/LaunchStapGraph.java
@@ -55,6 +55,10 @@ public class LaunchStapGraph extends SystemTapLaunchShortcut {
}
public void launch(IBinary bin, String mode) {
+ launch(bin, mode, null);
+ }
+
+ public void launch(IBinary bin, String mode, ILaunchConfigurationWorkingCopy wc) {
super.initialize();
this.bin = bin;
name = "SystemTapGraph"; //$NON-NLS-1$
@@ -69,8 +73,8 @@ public class LaunchStapGraph extends SystemTapLaunchShortcut {
projectName = bin.getCProject().getElementName();
try {
-
- ILaunchConfigurationWorkingCopy wc = createConfiguration(bin, name);
+ if (wc == null)
+ wc = createConfiguration(bin, name);
binaryPath = bin.getResource().getLocation().toString();
arguments = binaryPath;
outputPath = PluginConstants.getDefaultIOPath();
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/SystemTapOptionsTab.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/SystemTapOptionsTab.java
index 535634e..c3d51b0 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/SystemTapOptionsTab.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/SystemTapOptionsTab.java
@@ -14,6 +14,13 @@ package org.eclipse.linuxtools.callgraph.launch;
import java.io.File;
import java.util.ArrayList;
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.debug.core.CDebugUtils;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.launch.ui.CLaunchConfigurationTab;
+import org.eclipse.cdt.ui.CElementLabelProvider;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
@@ -26,11 +33,11 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.window.Window;
import org.eclipse.linuxtools.callgraph.core.LaunchConfigurationConstants;
import org.eclipse.linuxtools.callgraph.core.PluginConstants;
import org.eclipse.linuxtools.callgraph.core.SystemTapView;
@@ -58,6 +65,7 @@ import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.TwoPaneElementSelector;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.views.navigator.ResourceComparator;
@@ -66,7 +74,7 @@ import org.eclipse.ui.views.navigator.ResourceComparator;
* Options tab for SystemTap. Currently does NOT contain all possible options
*
*/
-public class SystemTapOptionsTab extends AbstractLaunchConfigurationTab{
+public class SystemTapOptionsTab extends CLaunchConfigurationTab{
//Control creation objects
protected Composite top;
@@ -822,6 +830,70 @@ public class SystemTapOptionsTab extends AbstractLaunchConfigurationTab{
return Messages.getString("SystemTapOptionsTab.MainTabName"); //$NON-NLS-1$
}
+ protected Shell getActiveWorkbenchShell() {
+ return CallgraphLaunchPlugin.getActiveWorkbenchShell();
+ }
+
+
+ private IBinary chooseBinary(IBinary[] binaries) {
+ ILabelProvider programLabelProvider = new CElementLabelProvider() {
+ public String getText(Object element) {
+ if (element instanceof IBinary) {
+ IBinary bin = (IBinary)element;
+ StringBuffer name = new StringBuffer();
+ name.append(bin.getPath().lastSegment());
+ return name.toString();
+ }
+ return super.getText(element);
+ }
+ };
+
+ ILabelProvider qualifierLabelProvider = new CElementLabelProvider() {
+ public String getText(Object element) {
+ if (element instanceof IBinary) {
+ IBinary bin = (IBinary)element;
+ StringBuffer name = new StringBuffer();
+ name.append(bin.getCPU() + (bin.isLittleEndian() ? "le" : "be")); //$NON-NLS-1$ //$NON-NLS-2$
+ name.append(" - "); //$NON-NLS-1$
+ name.append(bin.getPath().toString());
+ return name.toString();
+ }
+ return super.getText(element);
+ }
+ };
+
+ TwoPaneElementSelector dialog = new TwoPaneElementSelector(getActiveWorkbenchShell(), programLabelProvider, qualifierLabelProvider);
+ dialog.setElements(binaries);
+ dialog.setTitle(Messages.getString("SystemtTapOptionsTab.Callgraph")); //$NON-NLS-1$
+ dialog.setMessage(Messages.getString("SystemtTapOptionsTab.Choose_a_local_application")); //$NON-NLS-1$
+ dialog.setUpperListLabel(Messages.getString("SystemtTapOptionsTab.Binaries")); //$NON-NLS-1$
+ dialog.setLowerListLabel(Messages.getString("SystemtTapOptionsTab.Qualifier")); //$NON-NLS-1$
+ dialog.setMultipleSelection(false);
+ if (dialog.open() == Window.OK) {
+ return (IBinary) dialog.getFirstResult();
+ }
+
+ return null;
+ }
+
+ private IBinary getBinary(ILaunchConfiguration config) {
+ try {
+ ICProject project = CDebugUtils.verifyCProject(config);
+ IBinary[] binaries = project.getBinaryContainer().getBinaries();
+ if (binaries != null && binaries.length > 0) {
+ if (binaries.length == 1 && binaries[0] instanceof IBinary) {
+ return (IBinary) binaries[0];
+ } else
+ return chooseBinary(binaries);
+ }
+ return null;
+ } catch (CoreException e) {
+ return null;
+ }
+ }
+
+
+
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
@@ -972,6 +1044,27 @@ public class SystemTapOptionsTab extends AbstractLaunchConfigurationTab{
configuration.setAttribute(LaunchConfigurationConstants.COMMAND_LIST, ConfigurationOptionsSetter.setOptions(configuration));
+
+ ICElement cElement = null;
+ cElement = getContext(configuration, getPlatform(configuration));
+ if (cElement != null) {
+ initializeCProject(cElement, configuration);
+ } else {
+ // don't want to remember the interim value from before
+ configuration.setMappedResources(null);
+ }
+
+ IBinary bin = null;
+ bin = getBinary(configuration);
+ if (bin != null) {
+ String programName = bin.getResource().getProjectRelativePath().toString();
+ configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programName);
+ configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
+
+ LaunchStapGraph launch = new LaunchStapGraph();
+ launch.setTestMode(true); //Do not run callgraph
+ launch.launch(bin, "", configuration); //$NON-NLS-1$
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/messages.properties b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/messages.properties
index c0c9a3c..b862a50 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/messages.properties
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/callgraph/launch/messages.properties
@@ -125,3 +125,7 @@ SystemTapOptionsTab.SuppresionsFile=Select a Suppressions File
SystemTapOptionsTab.TargetPID=Target process pid:
SystemTapOptionsTab.WorkspaceButton=Browse Workspace
SystemTapOptionsTab.WorkspaceButton2=Browse Workspace
+SystemtTapOptionsTab.Callgraph=Callgraph
+SystemtTapOptionsTab.Choose_a_local_application=Choose a local application to profile
+SystemtTapOptionsTab.Binaries=Binaries:
+SystemtTapOptionsTab.Qualifier=Qualifier: