diff options
author | Alena Laskavaia | 2015-11-24 18:24:24 +0000 |
---|---|---|
committer | Roland Grunberg | 2015-11-25 20:29:54 +0000 |
commit | a59e6e60491e097bc422ca26232c20f5c787cb17 (patch) | |
tree | 14cbd24107273c71825665a1544f5e6295ae1fd3 | |
parent | 619bd7c341a7da2e138af68182b46a91d2296d0f (diff) | |
download | org.eclipse.linuxtools-a59e6e60491e097bc422ca26232c20f5c787cb17.tar.gz org.eclipse.linuxtools-a59e6e60491e097bc422ca26232c20f5c787cb17.tar.xz org.eclipse.linuxtools-a59e6e60491e097bc422ca26232c20f5c787cb17.zip |
Bug 482936 - Provide a generic field for extra valgrind options
Signed-off-by: Alena Laskavaia <elaskavaia.cdt@gmail.com>
Change-Id: I78b2fea9f1cbf951f6322fd5f893b0225e866491
Reviewed-on: https://git.eclipse.org/r/61176
Tested-by: Hudson CI
Reviewed-by: Roland Grunberg <rgrunber@redhat.com>
5 files changed, 49 insertions, 6 deletions
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/LaunchConfigurationConstants.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/LaunchConfigurationConstants.java index 5583141f25..c3f2019b24 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/LaunchConfigurationConstants.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/LaunchConfigurationConstants.java @@ -31,6 +31,7 @@ public final class LaunchConfigurationConstants { public static final String ATTR_GENERAL_BELOWMAIN = PLUGIN_ID + ".GENERAL_BELOWMAIN"; //$NON-NLS-1$ public static final String ATTR_GENERAL_MAXFRAME = PLUGIN_ID + ".GENERAL_MAXFRAME"; //$NON-NLS-1$ public static final String ATTR_GENERAL_SUPPFILES = PLUGIN_ID + ".GENERAL_SUPPFILES"; //$NON-NLS-1$ + public static final String ATTR_GENERAL_EXTRA_OPTIONS = PLUGIN_ID + ".GENERAL_OTHER_OPTIONS"; //$NON-NLS-1$ // 3.4.0 specific public static final String ATTR_GENERAL_MAINSTACK_BOOL = PLUGIN_ID + ".GENERAL_MAINSTACK_BOOL"; //$NON-NLS-1$ diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindLaunchConfigurationDelegate.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindLaunchConfigurationDelegate.java index 7f0366e534..44097da235 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindLaunchConfigurationDelegate.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindLaunchConfigurationDelegate.java @@ -368,7 +368,10 @@ public class ValgrindLaunchConfigurationDelegate extends AbstractCLaunchDelegate } } opts.addAll(Arrays.asList(dynamicDelegate.getCommandArray(config, valgrindVersion, outputPath))); - + String otherOptions = config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_EXTRA_OPTIONS,"").trim(); //$NON-NLS-1$ + if (!otherOptions.isEmpty()) { + opts.addAll(Arrays.asList(otherOptions.split("\\s+"))); //$NON-NLS-1$ + } String[] ret = new String[opts.size()]; return opts.toArray(ret); } diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindOptionsTab.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindOptionsTab.java index c83c9c0551..855c6d7176 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindOptionsTab.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindOptionsTab.java @@ -25,6 +25,7 @@ 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.layout.GridDataFactory; import org.eclipse.linuxtools.profiling.launch.ConfigUtils; import org.eclipse.linuxtools.valgrind.launch.IValgrindToolPage; import org.eclipse.osgi.util.NLS; @@ -50,6 +51,7 @@ import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Spinner; import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabItem; +import org.eclipse.swt.widgets.Text; import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; import org.eclipse.ui.model.WorkbenchContentProvider; import org.eclipse.ui.model.WorkbenchLabelProvider; @@ -64,6 +66,7 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { protected Button traceChildrenButton; protected Button childSilentButton; protected Button runFreeresButton; + protected Text otherOptionsText; protected Button demangleButton; protected Spinner numCallersSpinner; @@ -125,6 +128,8 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { } }; + + @Override public void createControl(Composite parent) { // Check for exception @@ -163,9 +168,11 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { createBasicOptions(generalTop); createVerticalSpacer(generalTop, 1); - createErrorOptions(generalTop); + createVerticalSpacer(generalTop, 1); + createOtherOptions(generalTop); + generalTab.setControl(generalTop); TabItem suppTab = new TabItem(optionsFolder, SWT.NONE); @@ -267,6 +274,21 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { runFreeresButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); } + private void createOtherOptions(Composite basicTop) { + Composite otherOptionsGroup = new Composite(basicTop, SWT.NONE); + otherOptionsGroup.setLayout(new GridLayout()); + otherOptionsGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); + Label label = new Label(otherOptionsGroup, SWT.WRAP); + label.setText(Messages.getString("ValgrindOptionsTab.ExtraOptionsLabel")); //$NON-NLS-1$ + // Tooltip: Specify any other valgrind options, separated by space. Escaping of spaces is not supported. + label.setToolTipText(Messages.getString("ValgrindOptionsTab.ExtraOptionsTooltip")); //$NON-NLS-1$ + + otherOptionsText = new Text(otherOptionsGroup, SWT.BORDER); + otherOptionsText.setToolTipText(Messages.getString("ValgrindOptionsTab.ExtraOptionsTooltip")); //$NON-NLS-1$ + otherOptionsText.addModifyListener(modifyListener); + otherOptionsText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); + } + private void createErrorOptions(Composite top) { Group errorGroup = new Group(top, SWT.NONE); errorGroup.setLayout(new GridLayout()); @@ -524,6 +546,7 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { } handleToolChanged(); + otherOptionsText.setText(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_EXTRA_OPTIONS, "")); //$NON-NLS-1$ traceChildrenButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, LaunchConfigurationConstants.DEFAULT_GENERAL_TRACECHILD)); runFreeresButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_FREERES, LaunchConfigurationConstants.DEFAULT_GENERAL_FREERES)); demangleButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_DEMANGLE, LaunchConfigurationConstants.DEFAULT_GENERAL_DEMANGLE)); @@ -599,6 +622,7 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN, showBelowMainButton.getSelection()); configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME, maxStackFrameSpinner.getSelection()); configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILES, Arrays.asList(suppFileList.getItems())); + configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_EXTRA_OPTIONS, otherOptionsText.getText()); // 3.4.0 specific if (valgrindVersion == null || valgrindVersion.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { @@ -723,4 +747,8 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { public String[] getTools() { return tools; } + + public Text getExtraOptionsText() { + return otherOptionsText; + } } 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 78809eb196..94760e91f9 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 @@ -41,6 +41,8 @@ ValgrindOptionsTab.max_size_of_stack_frame=Max stack frame size (B): ValgrindOptionsTab.dsymutil=Run dsymutil (Mac OS X) ValgrindOptionsTab.No_options_tab_found=No options tab found for tool ValgrindOptionsTab.num_callers=Callers in stack trace: +ValgrindOptionsTab.ExtraOptionsLabel=Extra Options: +ValgrindOptionsTab.ExtraOptionsTooltip=Specify any other valgrind options, separated by space. Escaping of spaces is not supported. ValgrindOptionsTab.run_freeres=Run __libc_freeres on exit ValgrindOptionsTab.Select_a_Resource=Select a Resource: ValgrindOptionsTab.Select_a_Suppressions_File=Select a Suppressions File: diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LaunchConfigTabTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LaunchConfigTabTest.java index 4e402f017f..268e09a628 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LaunchConfigTabTest.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LaunchConfigTabTest.java @@ -10,10 +10,7 @@ *******************************************************************************/ package org.eclipse.linuxtools.internal.valgrind.memcheck.tests; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import java.util.Arrays; @@ -504,4 +501,16 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { String text = messages[0].getText(); assertTrue(text.contains(notExistentFile)); } + + @Test + public void testExtraOptions() throws Exception { + ILaunchConfigurationWorkingCopy wc = initConfig(); + tab.getExtraOptionsText().setText(" -v -v"); + ILaunch launch = saveAndLaunch(wc, "testExtraOptions"); //$NON-NLS-1$ + IProcess[] p = launch.getProcesses(); + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("-v -v")); //$NON-NLS-1$ + } } |