Skip to main content
summaryrefslogtreecommitdiffstats
blob: 29e39b201a9d304a73e4be908fa6ecca2fa29e4c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*******************************************************************************
 * Copyright (c) 2007, 2016 QNX Software Systems and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     QNX Software Systems - Initial implementation
 *     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;

/**
 * @author Andy Jin
 *
 */

import org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service.GdbJtagDebugServicesFactory;
import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
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.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 DSF/GDB debugger framework.
 * <p>
 * This delegate only supports the org.eclipse.cdt.debug.gdbjtag.launchConfigurationType
 * launch configuration types.
 * <p>
 * It extends the standard DSF/GDB launch delegate <code>GdbLaunchDelegate</code>
 * but overrides the <code>newServiceFactory</code> method to return the Jtag
 * hardware debugging factory.
 * @since 7.0
 */
@ThreadSafe
public class GDBJtagDSFLaunchConfigurationDelegate extends GdbLaunchDelegate {

	@Override
	protected IDsfDebugServicesFactory newServiceFactory(ILaunchConfiguration config, String version) {
		return new GdbJtagDebugServicesFactory(version, config);
	}
	
	@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);
	}
}

Back to the top