mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-30 20:35:38 +02:00
Bug 488909: Unify services factory classes to extend more easily
From org.eclipse.cdt.debug.gdbjtag.core, constructor GdbJtagDebugServicesFactory.GdbJtagDebugServicesFactory(String) has been replaced by GdbJtagDebugServicesFactory.GdbJtagDebugServicesFactory(String, ILaunchConfiguration) From org.eclipse.cdt.dsf.gdb, constructor GdbDebugServicesFactory.GdbDebugServicesFactory(String) has been replaced by GdbDebugServicesFactory.GdbDebugServicesFactory(String, ILaunchConfiguration) From org.eclipse.cdt.dsf.gdb, class GdbDebugServicesFactoryNS has been removed and its logic was merged into class GdbDebugServicesFactory Change-Id: Ifecba752cfc12da62f1447027b11c0bb1f7c0171
This commit is contained in:
parent
6aefe76491
commit
7856453f30
9 changed files with 35 additions and 94 deletions
|
@ -34,7 +34,6 @@ 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.service.GdbDebugServicesFactory;
|
||||
import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactoryNS;
|
||||
import org.eclipse.cdt.dsf.gdb.service.SessionType;
|
||||
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
|
||||
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||
|
@ -465,12 +464,8 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
|
|||
* A subclass can override this method and provide its own ServiceFactory.
|
||||
* @since 4.1
|
||||
*/
|
||||
protected IDsfDebugServicesFactory newServiceFactory(ILaunchConfiguration config, String version) {
|
||||
if (LaunchUtils.getIsNonStopMode(config) && isNonStopSupportedInGdbVersion(version)) {
|
||||
return new GdbDebugServicesFactoryNS(version);
|
||||
}
|
||||
|
||||
return new GdbDebugServicesFactory(version);
|
||||
protected IDsfDebugServicesFactory newServiceFactory(ILaunchConfiguration config, String version) {
|
||||
return new GdbDebugServicesFactory(version, config);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2015 Ericsson and others.
|
||||
* Copyright (c) 2008, 2016 Ericsson and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -90,11 +90,19 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
|||
public static final String GDB_7_10_VERSION = "7.10"; //$NON-NLS-1$
|
||||
|
||||
private final String fVersion;
|
||||
|
||||
public GdbDebugServicesFactory(String version) {
|
||||
private final ILaunchConfiguration fConfiguration;
|
||||
|
||||
/** @since 5.0 */
|
||||
public GdbDebugServicesFactory(String version, ILaunchConfiguration config) {
|
||||
fVersion = version;
|
||||
fConfiguration = config;
|
||||
}
|
||||
|
||||
/** @since 5.0 */
|
||||
protected ILaunchConfiguration getConfiguration() {
|
||||
return fConfiguration;
|
||||
}
|
||||
|
||||
public String getVersion() { return fVersion; }
|
||||
|
||||
@Override
|
||||
|
@ -260,6 +268,15 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
|||
|
||||
@Override
|
||||
protected IRunControl createRunControlService(DsfSession session) {
|
||||
// First check for the non-stop case
|
||||
if (LaunchUtils.getIsNonStopMode(getConfiguration())) {
|
||||
if (compareVersionWith(GDB_7_2_VERSION) >= 0) {
|
||||
return new GDBRunControl_7_2_NS(session);
|
||||
}
|
||||
return new GDBRunControl_7_0_NS(session);
|
||||
}
|
||||
|
||||
// Else, handle all-stop mode
|
||||
if (compareVersionWith(GDB_7_10_VERSION) >= 0) {
|
||||
return new GDBRunControl_7_10(session);
|
||||
}
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2015 Ericsson and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Ericsson - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.service;
|
||||
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||
|
||||
/**
|
||||
* This variant is for non-stop (NS) multi-threaded debugging, a gdb capability
|
||||
* introduced in version 7.0. We provide a specialized NS implementation of
|
||||
* the run control service; that's the only specialization.
|
||||
*/
|
||||
public class GdbDebugServicesFactoryNS extends GdbDebugServicesFactory {
|
||||
|
||||
public GdbDebugServicesFactoryNS(String version) {
|
||||
super(version);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IRunControl createRunControlService(DsfSession session) {
|
||||
if (compareVersionWith(GDB_7_2_VERSION) >= 0) {
|
||||
return new GDBRunControl_7_2_NS(session);
|
||||
}
|
||||
return new GDBRunControl_7_0_NS(session);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2014 Ericsson and others.
|
||||
* Copyright (c) 2014, 2016 Ericsson and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -14,11 +14,9 @@ import org.eclipse.cdt.dsf.concurrent.Sequence;
|
|||
import org.eclipse.cdt.dsf.debug.service.IDsfDebugServicesFactory;
|
||||
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
|
||||
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate;
|
||||
import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils;
|
||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||
import org.eclipse.cdt.examples.dsf.gdb.GDBExamplePlugin;
|
||||
import org.eclipse.cdt.examples.dsf.gdb.service.GdbExtendedDebugServicesFactory;
|
||||
import org.eclipse.cdt.examples.dsf.gdb.service.GdbExtendedDebugServicesFactoryNS;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
|
@ -42,11 +40,7 @@ public class GdbExtendedLaunchDelegate extends GdbLaunchDelegate {
|
|||
|
||||
@Override
|
||||
protected IDsfDebugServicesFactory newServiceFactory(ILaunchConfiguration config, String version) {
|
||||
boolean nonStop = LaunchUtils.getIsNonStopMode(config);
|
||||
if (nonStop && isNonStopSupportedInGdbVersion(version)) {
|
||||
return new GdbExtendedDebugServicesFactoryNS(version);
|
||||
}
|
||||
return new GdbExtendedDebugServicesFactory(version);
|
||||
return new GdbExtendedDebugServicesFactory(version, config);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2014, 2015 Ericsson and others.
|
||||
* Copyright (c) 2014, 2016 Ericsson and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -23,8 +23,8 @@ import org.eclipse.debug.core.ILaunchConfiguration;
|
|||
|
||||
public class GdbExtendedDebugServicesFactory extends GdbDebugServicesFactory {
|
||||
|
||||
public GdbExtendedDebugServicesFactory(String version) {
|
||||
super(version);
|
||||
public GdbExtendedDebugServicesFactory(String version, ILaunchConfiguration config) {
|
||||
super(version, config);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2014, 2015 Ericsson and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Marc Khouzam (Ericsson) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.examples.dsf.gdb.service;
|
||||
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.cdt.dsf.gdb.service.GDBRunControl_7_0_NS;
|
||||
import org.eclipse.cdt.dsf.gdb.service.GDBRunControl_7_2_NS;
|
||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||
|
||||
public class GdbExtendedDebugServicesFactoryNS extends GdbExtendedDebugServicesFactory {
|
||||
|
||||
public GdbExtendedDebugServicesFactoryNS(String version) {
|
||||
super(version);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IRunControl createRunControlService(DsfSession session) {
|
||||
if (compareVersionWith(GDB_7_2_VERSION) >= 0) {
|
||||
return new GDBRunControl_7_2_NS(session);
|
||||
}
|
||||
return new GDBRunControl_7_0_NS(session);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 - 2016 QNX Software Systems and others.
|
||||
* Copyright (c) 2007, 2016 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -45,7 +45,7 @@ public class GDBJtagDSFLaunchConfigurationDelegate extends GdbLaunchDelegate {
|
|||
|
||||
@Override
|
||||
protected IDsfDebugServicesFactory newServiceFactory(ILaunchConfiguration config, String version) {
|
||||
return new GdbJtagDebugServicesFactory(version);
|
||||
return new GdbJtagDebugServicesFactory(version, config);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011,2015 Ericsson and others.
|
||||
* Copyright (c) 2011, 2016 Ericsson and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -23,10 +23,10 @@ import org.eclipse.debug.core.ILaunchConfiguration;
|
|||
*/
|
||||
public class GdbJtagDebugServicesFactory extends GdbDebugServicesFactory {
|
||||
|
||||
|
||||
public GdbJtagDebugServicesFactory(String version) {
|
||||
super(version);
|
||||
}
|
||||
/** @since 9.0 */
|
||||
public GdbJtagDebugServicesFactory(String version, ILaunchConfiguration config) {
|
||||
super(version, config);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) {
|
||||
|
|
|
@ -69,7 +69,7 @@ public class QtLocalDebugLaunchConfigDelegate extends QtLaunchConfigurationDeleg
|
|||
Path exeFile = qtBuildConfig.getProgramPath();
|
||||
gdbLaunch.setProgramPath(exeFile.toString());
|
||||
|
||||
gdbLaunch.setServiceFactory(new GdbDebugServicesFactory(gdbVersion));
|
||||
gdbLaunch.setServiceFactory(new GdbDebugServicesFactory(gdbVersion, configuration));
|
||||
|
||||
Sequence servicesLaunchSequence = new ServicesLaunchSequence(gdbLaunch.getSession(), gdbLaunch, monitor);
|
||||
gdbLaunch.getSession().getExecutor().execute(servicesLaunchSequence);
|
||||
|
|
Loading…
Add table
Reference in a new issue