diff options
author | Marc Khouzam | 2015-07-22 14:06:24 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2015-08-10 14:47:49 +0000 |
commit | 0d7432318e8098bf8c50bcfedfccfb36cbce94fd (patch) | |
tree | a8864e01f3bf65bce5c99144d7de9012865a5a30 /dsf-gdb/org.eclipse.cdt.dsf.gdb | |
parent | 7168d36c5810d8ce01f9cf855c6aa6196e9fc010 (diff) | |
download | org.eclipse.cdt-0d7432318e8098bf8c50bcfedfccfb36cbce94fd.tar.gz org.eclipse.cdt-0d7432318e8098bf8c50bcfedfccfb36cbce94fd.tar.xz org.eclipse.cdt-0d7432318e8098bf8c50bcfedfccfb36cbce94fd.zip |
Bug 469763 - DSF-GDB top-level service classes for better extensibility
Change-Id: Ie01af2df69a4c12bc3489ab5ecb76a3f5b6bfa79
Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
Diffstat (limited to 'dsf-gdb/org.eclipse.cdt.dsf.gdb')
22 files changed, 921 insertions, 7 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); + } +} |