diff options
28 files changed, 1008 insertions, 26 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF b/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF index 1448df32652..e6f5a2be882 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true -Bundle-Version: 4.7.0.qualifier +Bundle-Version: 4.8.0.qualifier Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime, @@ -35,6 +35,7 @@ Export-Package: org.eclipse.cdt.dsf.gdb, org.eclipse.cdt.dsf.gdb.launching, org.eclipse.cdt.dsf.gdb.service, org.eclipse.cdt.dsf.gdb.service.command, + org.eclipse.cdt.dsf.gdb.service.extensions, org.eclipse.cdt.dsf.gdb.service.macos, org.eclipse.cdt.dsf.mi.service, org.eclipse.cdt.dsf.mi.service.breakpoint.actions, diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/pom.xml b/dsf-gdb/org.eclipse.cdt.dsf.gdb/pom.xml index 6d1e93a3fb3..83e3329685c 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/pom.xml +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/pom.xml @@ -11,7 +11,7 @@ <relativePath>../../pom.xml</relativePath> </parent> - <version>4.7.0-SNAPSHOT</version> + <version>4.8.0-SNAPSHOT</version> <artifactId>org.eclipse.cdt.dsf.gdb</artifactId> <packaging>eclipse-plugin</packaging> </project> diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java index 1ee13e672b7..e9e722edfc0 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java @@ -26,6 +26,7 @@ import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.dsf.debug.service.AbstractDsfDebugServicesFactory; import org.eclipse.cdt.dsf.debug.service.IBreakpoints; import org.eclipse.cdt.dsf.debug.service.IDisassembly; +import org.eclipse.cdt.dsf.debug.service.IDsfDebugServicesFactory; import org.eclipse.cdt.dsf.debug.service.IExpressions; import org.eclipse.cdt.dsf.debug.service.IMemory; import org.eclipse.cdt.dsf.debug.service.IModules; @@ -35,6 +36,8 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl; import org.eclipse.cdt.dsf.debug.service.ISourceLookup; import org.eclipse.cdt.dsf.debug.service.IStack; import org.eclipse.cdt.dsf.debug.service.command.ICommandControl; +import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch; import org.eclipse.cdt.dsf.gdb.service.command.CommandFactory_6_8; import org.eclipse.cdt.dsf.gdb.service.command.GDBControl; import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_0; @@ -53,7 +56,12 @@ import org.eclipse.cdt.dsf.mi.service.MIModules; import org.eclipse.cdt.dsf.mi.service.MIStack; import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.service.DsfSession; +import org.eclipse.cdt.dsf.service.IDsfService; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.osgi.util.NLS; public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory { @@ -77,9 +85,8 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory { public static final String GDB_7_6_VERSION = "7.5.50"; //$NON-NLS-1$ /** @since 4.4 */ public static final String GDB_7_7_VERSION = "7.7"; //$NON-NLS-1$ - /** @since 4.7 */ - // TODO: replace with version 7.10, when released - private static final String GDB_7_10_VERSION = "7.9.50.20150402"; //$NON-NLS-1$ + /** @since 4.8 */ + public static final String GDB_7_10_VERSION = "7.10"; //$NON-NLS-1$ private final String fVersion; @@ -302,4 +309,37 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory { protected MIBreakpointsSynchronizer createBreakpointsSynchronizerService(DsfSession session) { return new MIBreakpointsSynchronizer(session); } + + /** + * A static method that will compare the version of GDB for the specified session and + * the minimum GDB version required by the caller. A warning will be logged if the + * running version is not sufficient. + * + * @param session The debug session running GDB + * @param minVersion The minimum version of GDB required + * @param service The service requesting the check. + * + * @since 4.8 + */ + public static void validateGdbVersion(DsfSession session, String minVersion, IDsfService service) { + ILaunch launch = (ILaunch)session.getModelAdapter(ILaunch.class); + if (launch instanceof GdbLaunch) { + IDsfDebugServicesFactory servicesFactory = ((GdbLaunch)launch).getServiceFactory(); + if (servicesFactory instanceof GdbDebugServicesFactory) { + String version = ((GdbDebugServicesFactory)servicesFactory).getVersion(); + if (minVersion.compareTo(version) > 0) { + assert false; + + GdbPlugin.log( + new Status( + IStatus.WARNING, GdbPlugin.PLUGIN_ID, + NLS.bind( + Messages.GDB_Version_Mismatch, + new Object[] { version, service.getClass().getName(), minVersion }))); + } + return; + } + } + assert false; + } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/Messages.java index cc3da86b098..35d0b5f88bd 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/Messages.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/Messages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2014 Ericsson and others. + * Copyright (c) 2012, 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 @@ -29,6 +29,7 @@ class Messages extends NLS { public static String RegisterGroup_name_reserved; public static String RegisterGroup_name_used; public static String RegisterGroup_invalid_number_of_registers; + public static String GDB_Version_Mismatch; static { // initialize resource bundle diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/Messages.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/Messages.properties index 96bdbce7173..01d2a5156bc 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/Messages.properties +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/Messages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2012, 2014 Ericsson and others. +# Copyright (c) 2012, 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 @@ -21,3 +21,4 @@ ErrorNotSupported=Operation not supported with this GDB version RegisterGroup_name_reserved=The group name "{0}" is reserved RegisterGroup_name_used=The group name "{0}" is already in use RegisterGroup_invalid_number_of_registers=A minimum of one register is needed for a Register Group +GDB_Version_Mismatch=Running older GDB version {0} when service {1} expects version {2} or higher
\ No newline at end of file diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBackend_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBackend_HEAD.java new file mode 100644 index 00000000000..dbf43752405 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBackend_HEAD.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.gdb.service.GDBBackend; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.mi.service.IMIBackend; +import org.eclipse.cdt.dsf.service.DsfSession; +import org.eclipse.debug.core.ILaunchConfiguration; + +/** + * Top-level class in the version hierarchy of implementations of {@link IMIBackend}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBBackend_HEAD extends GDBBackend { + public GDBBackend_HEAD(DsfSession session, ILaunchConfiguration lc) { + super(session, lc); + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_1_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsManager_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsManager_HEAD.java new file mode 100644 index 00000000000..c00b5938186 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsManager_HEAD.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.gdb.service.GDBBreakpointsManager_7_2; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager; +import org.eclipse.cdt.dsf.service.DsfSession; + +/** + * Top-level class in the version hierarchy of implementations of {@link MIBreakpointsManager}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBBreakpointsManager_HEAD extends GDBBreakpointsManager_7_2 { + public GDBBreakpointsManager_HEAD(DsfSession session, String debugModelId) { + super(session, debugModelId); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_2_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsSynchronizer_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsSynchronizer_HEAD.java new file mode 100644 index 00000000000..ffde0f882b9 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsSynchronizer_HEAD.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.mi.service.MIBreakpointsSynchronizer; +import org.eclipse.cdt.dsf.service.DsfSession; + +/** + * Top-level class in the version hierarchy of implementations of {@link MIBreakpointsSynchronizer}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBBreakpointsSynchronizer_HEAD extends MIBreakpointsSynchronizer { + public GDBBreakpointsSynchronizer_HEAD(DsfSession session) { + super(session); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_1_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpoints_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpoints_HEAD.java new file mode 100644 index 00000000000..1604d7fd532 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpoints_HEAD.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.debug.service.IBreakpoints; +import org.eclipse.cdt.dsf.gdb.service.GDBBreakpoints_7_7; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.service.DsfSession; + +/** + * Top-level class in the version hierarchy of implementations of {@link IBreakpoints}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBBreakpoints_HEAD extends GDBBreakpoints_7_7 { + public GDBBreakpoints_HEAD(DsfSession session) { + super(session); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_7_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBControl_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBControl_HEAD.java new file mode 100644 index 00000000000..e4015e55882 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBControl_HEAD.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_7; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; +import org.eclipse.cdt.dsf.service.DsfSession; +import org.eclipse.debug.core.ILaunchConfiguration; + +/** + * Top-level class in the version hierarchy of implementations of {@link ICommandControlService}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBControl_HEAD extends GDBControl_7_7 { + public GDBControl_HEAD(DsfSession session, ILaunchConfiguration lc, CommandFactory factory) { + super(session, lc, factory); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_7_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBDisassembly_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBDisassembly_HEAD.java new file mode 100644 index 00000000000..3db1e1240f2 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBDisassembly_HEAD.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.debug.service.IDisassembly; +import org.eclipse.cdt.dsf.gdb.service.GDBDisassembly_7_3; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.service.DsfSession; + +/** + * Top-level class in the version hierarchy of implementations of {@link IDisassembly}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBDisassembly_HEAD extends GDBDisassembly_7_3 { + public GDBDisassembly_HEAD(DsfSession session) { + super(session); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_3_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBExpressions_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBExpressions_HEAD.java new file mode 100644 index 00000000000..bade2ea26a4 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBExpressions_HEAD.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.debug.service.IExpressions; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.mi.service.MIExpressions; +import org.eclipse.cdt.dsf.service.DsfSession; + +/** + * Top-level class in the version hierarchy of implementations of {@link IExpressions}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBExpressions_HEAD extends MIExpressions { + public GDBExpressions_HEAD(DsfSession session) { + super(session); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_1_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBHardwareAndOS_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBHardwareAndOS_HEAD.java new file mode 100644 index 00000000000..b8acf8742fe --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBHardwareAndOS_HEAD.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.gdb.service.GDBHardwareAndOS_7_10; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS; +import org.eclipse.cdt.dsf.service.DsfSession; + +/** + * Top-level class in the version hierarchy of implementations of {@link IGDBHardwareAndOS}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBHardwareAndOS_HEAD extends GDBHardwareAndOS_7_10 { + public GDBHardwareAndOS_HEAD(DsfSession session) { + super(session); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_10_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBMemory_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBMemory_HEAD.java new file mode 100644 index 00000000000..ff0f1a26f7c --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBMemory_HEAD.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.debug.service.IMemory; +import org.eclipse.cdt.dsf.gdb.service.GDBMemory_7_6; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.service.DsfSession; + +/** + * Top-level class in the version hierarchy of implementations of {@link IMemory}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBMemory_HEAD extends GDBMemory_7_6 { + public GDBMemory_HEAD(DsfSession session) { + super(session); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_6_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBModules_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBModules_HEAD.java new file mode 100644 index 00000000000..7f19ec7d5b9 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBModules_HEAD.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.debug.service.IModules; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.mi.service.MIModules; +import org.eclipse.cdt.dsf.service.DsfSession; + +/** + * Top-level class in the version hierarchy of implementations of {@link IModules}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBModules_HEAD extends MIModules { + public GDBModules_HEAD(DsfSession session) { + super(session); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_1_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBProcesses_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBProcesses_HEAD.java new file mode 100644 index 00000000000..acb9cb30d9a --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBProcesses_HEAD.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.debug.service.IProcesses; +import org.eclipse.cdt.dsf.gdb.service.GDBProcesses_7_4; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.service.DsfSession; + +/** + * Top-level class in the version hierarchy of implementations of {@link IProcesses}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBProcesses_HEAD extends GDBProcesses_7_4 { + public GDBProcesses_HEAD(DsfSession session) { + super(session); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_4_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRegisters_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRegisters_HEAD.java new file mode 100644 index 00000000000..b6b381384cb --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRegisters_HEAD.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.debug.service.IRegisters; +import org.eclipse.cdt.dsf.gdb.service.GDBRegisters; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.service.DsfSession; + +/** + * Top-level class in the version hierarchy of implementations of {@link IRegisters}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBRegisters_HEAD extends GDBRegisters { + public GDBRegisters_HEAD(DsfSession session) { + super(session); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_1_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_HEAD.java new file mode 100644 index 00000000000..d87a04463a3 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_HEAD.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.debug.service.IRunControl; +import org.eclipse.cdt.dsf.gdb.service.GDBRunControl_7_6; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.service.DsfSession; + +/** + * Top-level class in the version hierarchy of implementations of {@link IRunControl} + * in All-Stop. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBRunControl_HEAD extends GDBRunControl_7_6 { + public GDBRunControl_HEAD(DsfSession session) { + super(session); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_6_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_NS_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_NS_HEAD.java new file mode 100644 index 00000000000..60dc669d620 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_NS_HEAD.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.debug.service.IRunControl; +import org.eclipse.cdt.dsf.gdb.service.GDBRunControl_7_2_NS; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.service.DsfSession; + +/** + * Top-level class in the version hierarchy of implementations of {@link IRunControl} + * in Non-Stop. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBRunControl_NS_HEAD extends GDBRunControl_7_2_NS { + public GDBRunControl_NS_HEAD(DsfSession session) { + super(session); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_2_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBSourceLookup_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBSourceLookup_HEAD.java new file mode 100644 index 00000000000..a0acd1dbb39 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBSourceLookup_HEAD.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.debug.service.ISourceLookup; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.mi.service.CSourceLookup; +import org.eclipse.cdt.dsf.service.DsfSession; + +/** + * Top-level class in the version hierarchy of implementations of {@link ISourceLookup}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBSourceLookup_HEAD extends CSourceLookup { + public GDBSourceLookup_HEAD(DsfSession session) { + super(session); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_1_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBStack_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBStack_HEAD.java new file mode 100644 index 00000000000..03050cdec12 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBStack_HEAD.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.debug.service.IStack; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.mi.service.MIStack; +import org.eclipse.cdt.dsf.service.DsfSession; + +/** + * Top-level class in the version hierarchy of implementations of {@link IStack}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBStack_HEAD extends MIStack { + public GDBStack_HEAD(DsfSession session) { + super(session); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_1_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBTraceControl_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBTraceControl_HEAD.java new file mode 100644 index 00000000000..06973f56500 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBTraceControl_HEAD.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.extensions; + +import org.eclipse.cdt.dsf.gdb.service.GDBTraceControl_7_4; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl; +import org.eclipse.cdt.dsf.service.DsfSession; +import org.eclipse.debug.core.ILaunchConfiguration; + +/** + * Top-level class in the version hierarchy of implementations of {@link IGDBTraceControl}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 4.8 + */ +public class GDBTraceControl_HEAD extends GDBTraceControl_7_4 { + public GDBTraceControl_HEAD(DsfSession session, ILaunchConfiguration lc) { + super(session, lc); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_4_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedFinalLaunchSequence_7_7.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedFinalLaunchSequence.java index 8785ffb540e..6093cfe169e 100644 --- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedFinalLaunchSequence_7_7.java +++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedFinalLaunchSequence.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 Ericsson and others. + * 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 @@ -29,12 +29,12 @@ import org.eclipse.cdt.examples.dsf.gdb.service.IGDBExtendedFunctions; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; -public class GdbExtendedFinalLaunchSequence_7_7 extends FinalLaunchSequence_7_7 { +public class GdbExtendedFinalLaunchSequence extends FinalLaunchSequence_7_7 { private IGDBControl fControl; private DsfServicesTracker fTracker; - public GdbExtendedFinalLaunchSequence_7_7(DsfSession session, Map<String, Object> attributes, RequestMonitorWithProgress rm) { + public GdbExtendedFinalLaunchSequence(DsfSession session, Map<String, Object> attributes, RequestMonitorWithProgress rm) { super(session, attributes, rm); } @@ -46,10 +46,10 @@ public class GdbExtendedFinalLaunchSequence_7_7 extends FinalLaunchSequence_7_7 List<String> orderList = new ArrayList<String>(Arrays.asList(super.getExecutionOrder(GROUP_TOP_LEVEL))); // Now insert our init step right after the initialization of the base class. - orderList.add(orderList.indexOf("stepInitializeFinalLaunchSequence_7_7") + 1, "stepInitializeExtendedFinalLaunchSequence_7_7"); //$NON-NLS-1$ //$NON-NLS-2$ + orderList.add(orderList.indexOf("stepInitializeFinalLaunchSequence_7_7") + 1, "stepInitializeExtendedFinalLaunchSequence"); //$NON-NLS-1$ //$NON-NLS-2$ // As the first operation to do, show the user the version of GDB - orderList.add(orderList.indexOf("stepInitializeExtendedFinalLaunchSequence_7_7") + 1, "stepNotifyVersion"); //$NON-NLS-1$ //$NON-NLS-2$ + orderList.add(orderList.indexOf("stepInitializeExtendedFinalLaunchSequence") + 1, "stepNotifyVersion"); //$NON-NLS-1$ //$NON-NLS-2$ // Add the step to set pagination before the .gdbinit file is sourced // that way the user can override this setting using .gdbinit. @@ -62,7 +62,7 @@ public class GdbExtendedFinalLaunchSequence_7_7 extends FinalLaunchSequence_7_7 } @Execute - public void stepInitializeExtendedFinalLaunchSequence_7_7(RequestMonitor rm) { + public void stepInitializeExtendedFinalLaunchSequence(RequestMonitor rm) { fTracker = new DsfServicesTracker(GDBExamplePlugin.getBundleContext(), getSession().getId()); fControl = fTracker.getService(IGDBControl.class); @@ -74,8 +74,8 @@ public class GdbExtendedFinalLaunchSequence_7_7 extends FinalLaunchSequence_7_7 rm.done(); } - @RollBack("stepInitializeExtendedFinalLaunchSequence_7_7") - public void rollBackInitializeExtendedFinalLaunchSequence_7_7(RequestMonitor rm) { + @RollBack("stepInitializeExtendedFinalLaunchSequence") + public void rollBackInitializeExtendedFinalLaunchSequence(RequestMonitor rm) { if (fTracker != null) fTracker.dispose(); fTracker = null; rm.done(); @@ -116,7 +116,7 @@ public class GdbExtendedFinalLaunchSequence_7_7 extends FinalLaunchSequence_7_7 } @Execute - public void stepCleanupExtendedFinalLaunchSequence_7_7(final RequestMonitor rm) { + public void stepCleanupExtendedFinalLaunchSequence(final RequestMonitor rm) { if (fTracker != null) fTracker.dispose(); fTracker = null; rm.done(); diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedControl_7_7.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedControl.java index a59a5fab5fb..ea24c73e96a 100644 --- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedControl_7_7.java +++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedControl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 Ericsson and others. + * 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 @@ -14,19 +14,33 @@ import java.util.Map; import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress; import org.eclipse.cdt.dsf.concurrent.Sequence; -import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_7; +import org.eclipse.cdt.dsf.gdb.service.extensions.GDBControl_HEAD; import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.service.DsfSession; -import org.eclipse.cdt.examples.dsf.gdb.launch.GdbExtendedFinalLaunchSequence_7_7; +import org.eclipse.cdt.examples.dsf.gdb.launch.GdbExtendedFinalLaunchSequence; import org.eclipse.debug.core.ILaunchConfiguration; -public class GDBExtendedControl_7_7 extends GDBControl_7_7 { - public GDBExtendedControl_7_7(DsfSession session, ILaunchConfiguration config, CommandFactory factory) { +/** + * Class that extends GDBControl. + * + * Note that by extending the GDBControl_HEAD class, we will always extend + * the latest version of the GDBControl service. The downside of this is + * that we will automatically bring in the latest version of the service + * even for the older GDB version that originally used GDBExtendedControl. + * This is because of how GDBExtendedControl is instantiated in + * GdbExtendedDebugServicesFactory. + * + * As we want to focus on the latest version of GDB, this is still the simplest + * solution to use. + * + */ +public class GDBExtendedControl extends GDBControl_HEAD { + public GDBExtendedControl(DsfSession session, ILaunchConfiguration config, CommandFactory factory) { super(session, config, factory); } @Override protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes, RequestMonitorWithProgress rm) { - return new GdbExtendedFinalLaunchSequence_7_7(getSession(), attributes, rm); + return new GdbExtendedFinalLaunchSequence(getSession(), attributes, rm); } } diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactory.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactory.java index 2a1065e4a12..1602267523a 100644 --- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactory.java +++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 Ericsson and others. + * 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 @@ -39,7 +39,7 @@ public class GdbExtendedDebugServicesFactory extends GdbDebugServicesFactory { @Override protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) { if (GDB_7_7_VERSION.compareTo(getVersion()) <= 0) { - return new GDBExtendedControl_7_7(session, config, new GdbExtendedCommandFactory_6_8()); + return new GDBExtendedControl(session, config, new GdbExtendedCommandFactory_6_8()); } if (GDB_7_4_VERSION.compareTo(getVersion()) <= 0) { return new GDBControl_7_4(session, config, new GdbExtendedCommandFactory_6_8()); diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF b/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF index 94be6b84e24..d798c7dbcf3 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.cdt.debug.gdbjtag.core;singleton:=true -Bundle-Version: 8.4.0.qualifier +Bundle-Version: 8.5.0.qualifier Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.core.Activator Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime, @@ -17,6 +17,7 @@ Require-Bundle: org.eclipse.core.runtime, Bundle-ActivationPolicy: lazy Export-Package: org.eclipse.cdt.debug.gdbjtag.core, org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service, + org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service.extensions, org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service.macos, org.eclipse.cdt.debug.gdbjtag.core.jtagdevice Bundle-Vendor: %providerName diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/pom.xml b/jtag/org.eclipse.cdt.debug.gdbjtag.core/pom.xml index dcd97ba5689..382c5d9448c 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/pom.xml +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/pom.xml @@ -11,7 +11,7 @@ <relativePath>../../pom.xml</relativePath> </parent> - <version>8.4.0-SNAPSHOT</version> + <version>8.5.0-SNAPSHOT</version> <artifactId>org.eclipse.cdt.debug.gdbjtag.core</artifactId> <packaging>eclipse-plugin</packaging> </project> diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/dsf/gdb/service/extensions/GDBJtagControl_HEAD.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/dsf/gdb/service/extensions/GDBJtagControl_HEAD.java new file mode 100644 index 00000000000..ad7211098f5 --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/dsf/gdb/service/extensions/GDBJtagControl_HEAD.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 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 + *******************************************************************************/ +package org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service.extensions; + +import org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service.GDBJtagControl_7_7; +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; +import org.eclipse.cdt.dsf.service.DsfSession; +import org.eclipse.debug.core.ILaunchConfiguration; + +/** + * Top-level class in the version hierarchy of the JTag implementations of {@link ICommandControlService}. + * <br> + * Extenders should subclass this class for their special needs, which will allow + * them to always extend the most recent version of the service. + * For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class + * will be changed to extend it instead of the previous version, therefore + * automatically allowing extenders to be extending the new class. + * + * NOTE: Older versions of GDB that were already using an extending class, + * will automatically start using the new service version, which may + * not be desirable. Extenders should update how they extend + * GdbDebugServicesFactory to properly choose the version of the + * service that should be used for older GDBs. + * + * On the contrary, not using GDB<Service>_HEAD requires the + * extender to update how they extend GdbDebugServicesFactory + * whenever a new GDB<Service> version is added. + * + * Extenders that prefer to focus on the latest GDB version are + * encouraged to extend GDB<Service>_HEAD. + * + * @since 8.5 + */ +public class GDBJtagControl_HEAD extends GDBJtagControl_7_7 { + public GDBJtagControl_HEAD(DsfSession session, ILaunchConfiguration config, CommandFactory factory) { + super(session, config, factory); + + validateGdbVersion(session); + } + + protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_7_VERSION; } + + protected void validateGdbVersion(DsfSession session) { + GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this); + } +} |