From aac8edc5d7ce1d11ea9f5eee95f2258cbe50f7d8 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Sun, 27 Jul 2008 18:22:56 +0000 Subject: [PATCH] Bug 237556 The public GDB now supports non-stop for linux. This patch fixes the version number we were using and allows the user to click the non-stop checkbox in the launch. --- .../ui/launching/GdbDebuggerPage.java | 1 - .../launching/GdbLaunchDelegate.java | 22 +++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/GdbDebuggerPage.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/GdbDebuggerPage.java index fb30978055d..16a7bc83e79 100644 --- a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/GdbDebuggerPage.java +++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/launching/GdbDebuggerPage.java @@ -264,7 +264,6 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer { // TODO: Find a way to determine if non-stop is supported (i.e. find the GDB version) then grey out the check box if necessary // Button fNonStopButton = ControlFactory.createCheckBox(subComp, LaunchUIMessages.getString( "GDBDebuggerPage.15") ); //$NON-NLS-1$ fNonStopCheckBox = ControlFactory.createCheckBox(subComp, LaunchUIMessages.getString("GDBDebuggerPage.13")); //$NON-NLS-1$ - fNonStopCheckBox.setEnabled(false); fNonStopCheckBox.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { diff --git a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GdbLaunchDelegate.java b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GdbLaunchDelegate.java index 33373c2adcc..2e83ff83d97 100644 --- a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GdbLaunchDelegate.java +++ b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GdbLaunchDelegate.java @@ -56,7 +56,8 @@ public class GdbLaunchDelegate extends LaunchConfigurationDelegate implements ILaunchConfigurationDelegate2 { public final static String GDB_DEBUG_MODEL_ID = "org.eclipse.dd.gdb"; //$NON-NLS-1$ - + + private final static String NON_STOP_FIRST_VERSION = "6.8.50"; //$NON-NLS-1$ private boolean isNonStopSession = false; public void launch( ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor ) throws CoreException { @@ -107,8 +108,15 @@ public class GdbLaunchDelegate extends LaunchConfigurationDelegate monitor.worked( 1 ); - launch.setServiceFactory(newServiceFactory(LaunchUtils.getGDBVersion(config))); + String gdbVersion = LaunchUtils.getGDBVersion(config); + // First make sure non-stop is supported, if the user want to use this mode + if (isNonStopSession && !isNonStopSupported(gdbVersion)) { + throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Non-stop mode is only supported starting with GDB " + NON_STOP_FIRST_VERSION, null)); //$NON-NLS-1$ + } + + launch.setServiceFactory(newServiceFactory(gdbVersion)); + // Create and invoke the launch sequence to create the debug control and services final ServicesLaunchSequence servicesLaunchSequence = new ServicesLaunchSequence(launch.getSession(), launch, exePath, sessionType, attach); @@ -328,10 +336,16 @@ public class GdbLaunchDelegate extends LaunchConfigurationDelegate return false; } + private boolean isNonStopSupported(String version) { + if (NON_STOP_FIRST_VERSION.compareTo(version) <= 0) { + return true; + } + return false; + } + private IDsfDebugServicesFactory newServiceFactory(String version) { - // TODO: Fix version number once non-stop GDB is delivered - if (isNonStopSession && version.startsWith("6.8.50.20080327")) { //$NON-NLS-1$ + if (isNonStopSession && isNonStopSupported(version)) { return new GdbDebugServicesFactoryNS(version); }