From 4c605d68c5e8af4a1e948956f6be118a86a4c865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20SVENSSON?= Date: Wed, 5 Dec 2018 13:43:21 +0100 Subject: [PATCH] Bug 542436 - Added method to override whitch IGDBBackend instance to control MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In some situations, it makes sense to have more than one GDB instance. Allow to reuse the GDB controling layer to avoid more code duplication than neccessary to have a second GDB session. Change-Id: I641919157c5b86c14ff768c8cd3fcddc9dcdbeb2 Signed-off-by: Torbjörn SVENSSON --- .../cdt/dsf/gdb/service/command/GDBControl.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java index 0424ae5ad77..c456c372d1d 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java @@ -20,6 +20,7 @@ * if it is still running (bug 373845) * Marc Khouzam (Ericsson) - Terminate the session if we lose the connection to the remote target (bug 422586) * Marc Khouzam (Ericsson) - Allow to override the creation of the ControlDMC (Bug 389945) + * STMicroelectronics - Allow to override the IGDBBackend instance to use (Bug 542436) *******************************************************************************/ package org.eclipse.cdt.dsf.gdb.service.command; @@ -241,6 +242,15 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { return GdbPlugin.getBundleContext(); } + /** + * Return the GDB back end this GDB control shall manage. + * @return The IGDBBackend instance + * @since 5.6 + */ + protected IGDBBackend getGDBBackend() { + return getServicesTracker().getService(IGDBBackend.class); + } + @Override public void initialize(final RequestMonitor requestMonitor) { super.initialize(new ImmediateRequestMonitor(requestMonitor) { @@ -253,7 +263,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { private void doInitialize(final RequestMonitor requestMonitor) { - fMIBackend = getServicesTracker().getService(IGDBBackend.class); + fMIBackend = getGDBBackend(); // getId, called to create this context, uses the MIBackend service, // which is why we must wait until we have MIBackend, before we can create the below context.