1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 348091: Cannot launch hardware or post-mortem debugging for older GDBs when preference for non-stop is enabled

This commit is contained in:
Marc Khouzam 2011-08-05 15:29:14 -04:00
parent c9d1bba00b
commit e1505b8899
2 changed files with 44 additions and 8 deletions

View file

@ -25,6 +25,7 @@ import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
import org.eclipse.cdt.dsf.concurrent.ThreadSafe; import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
import org.eclipse.cdt.dsf.debug.service.IDsfDebugServicesFactory; import org.eclipse.cdt.dsf.debug.service.IDsfDebugServicesFactory;
import org.eclipse.cdt.dsf.debug.sourcelookup.DsfSourceLookupDirector; import org.eclipse.cdt.dsf.debug.sourcelookup.DsfSourceLookupDirector;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory;
import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactoryNS; import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactoryNS;
@ -44,6 +45,7 @@ import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.ISourceLocator; import org.eclipse.debug.core.model.ISourceLocator;
@ -135,6 +137,9 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
String gdbVersion = getGDBVersion(config); String gdbVersion = getGDBVersion(config);
fIsNonStopSession = LaunchUtils.getIsNonStopMode(config);
fIsPostMortemTracingSession = LaunchUtils.getIsPostMortemTracing(config);
// First make sure non-stop is supported, if the user want to use this mode // First make sure non-stop is supported, if the user want to use this mode
if (fIsNonStopSession && !isNonStopSupportedInGdbVersion(gdbVersion)) { if (fIsNonStopSession && !isNonStopSupportedInGdbVersion(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$ 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$
@ -267,8 +272,21 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
@Override @Override
public boolean preLaunchCheck(ILaunchConfiguration config, String mode, IProgressMonitor monitor) throws CoreException { public boolean preLaunchCheck(ILaunchConfiguration config, String mode, IProgressMonitor monitor) throws CoreException {
// no pre launch check for core file // Forcibly turn off non-stop for post-mortem sessions.
if (mode.equals(ILaunchManager.DEBUG_MODE) && LaunchUtils.getSessionType(config) == SessionType.CORE) return true; // Non-stop does not apply to post-mortem sessions.
// Now that we can have non-stop defaulting to enabled, it will prevent
// post-mortem sessions from starting for GDBs <= 6.8 and there is no way to turn if off
// Bug 348091
if (LaunchUtils.getSessionType(config) == SessionType.CORE) {
if (LaunchUtils.getIsNonStopMode(config)) {
ILaunchConfigurationWorkingCopy wcConfig = config.getWorkingCopy();
wcConfig.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, false);
wcConfig.doSave();
}
// no further prelaunch check for core files
return true;
}
return super.preLaunchCheck(config, mode, monitor); return super.preLaunchCheck(config, mode, monitor);
} }
@ -279,10 +297,6 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
// because once the launch is created and added to launch manager, // because once the launch is created and added to launch manager,
// the adapters will be created for the whole session, including // the adapters will be created for the whole session, including
// the source lookup adapter. // the source lookup adapter.
fIsNonStopSession = LaunchUtils.getIsNonStopMode(configuration);
fIsPostMortemTracingSession = LaunchUtils.getIsPostMortemTracing(configuration);
GdbLaunch launch = new GdbLaunch(configuration, mode, null); GdbLaunch launch = new GdbLaunch(configuration, mode, null);
launch.initialize(); launch.initialize();
launch.setSourceLocator(getSourceLocator(configuration, launch.getSession())); launch.setSourceLocator(getSourceLocator(configuration, launch.getSession()));

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 - 2010 QNX Software Systems and others. * Copyright (c) 2007 - 2011 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors: * Contributors:
* QNX Software Systems - Initial implementation * QNX Software Systems - Initial implementation
* Ericsson - Updated for changes in base DSF-GDB launching (Bug 338769) * Ericsson - Updated for changes in base DSF-GDB launching (Bug 338769)
* Marc Khouzam (Ericsson) - Make sure non-stop is disabled (bug 348091)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core; package org.eclipse.cdt.debug.gdbjtag.core;
@ -20,8 +21,13 @@ import org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service.GdbJtagDebugServicesFa
import org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service.macos.MacOSGdbJtagDebugServicesFactory; import org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service.macos.MacOSGdbJtagDebugServicesFactory;
import org.eclipse.cdt.dsf.concurrent.ThreadSafe; import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
import org.eclipse.cdt.dsf.debug.service.IDsfDebugServicesFactory; import org.eclipse.cdt.dsf.debug.service.IDsfDebugServicesFactory;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate; import org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate;
import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils; import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
/** /**
* The launch configuration delegate for the Jtag hardware debugging using * The launch configuration delegate for the Jtag hardware debugging using
@ -50,4 +56,20 @@ public class GDBJtagDSFLaunchConfigurationDelegate extends GdbLaunchDelegate {
return new GdbJtagDebugServicesFactory(version); return new GdbJtagDebugServicesFactory(version);
} }
@Override
public boolean preLaunchCheck(ILaunchConfiguration config, String mode, IProgressMonitor monitor) throws CoreException {
// Forcibly turn off non-stop for hardware sessions.
// Non-stop is not an option we offer for hardware launches.
// Now that we can have non-stop defaulting to enabled, it will prevent
// hardware sessions from starting for GDBs <= 6.8 and there is no way to turn if off
// Bug 348091
if (LaunchUtils.getIsNonStopMode(config)) {
ILaunchConfigurationWorkingCopy wcConfig = config.getWorkingCopy();
wcConfig.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, false);
wcConfig.doSave();
}
return super.preLaunchCheck(config, mode, monitor);
}
} }