mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
Bug 324101 - [launch] Have the JTag launch extend FinalLaunchSequence
instead of copying it Change-Id: Ia65064a38cff1aa1a0ccff3dbb33c4baa92bccac Reviewed-on: https://git.eclipse.org/r/10202 Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> IP-Clean: Marc Khouzam <marc.khouzam@ericsson.com> Tested-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
parent
1cf6ff2974
commit
4d656b2273
7 changed files with 652 additions and 705 deletions
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,76 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2013 Ericsson and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Marc Khouzam (Ericsson) - initial API and implementation this class is based on
|
||||||
|
\******************************************************************************/
|
||||||
|
package org.eclipse.cdt.debug.gdbjtag.core;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
|
||||||
|
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||||
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version for GDB 7.2 and higher.
|
||||||
|
* @since 8.2
|
||||||
|
*/
|
||||||
|
public class GDBJtagDSFFinalLaunchSequence_7_2 extends GDBJtagDSFFinalLaunchSequence {
|
||||||
|
|
||||||
|
private DsfSession fSession;
|
||||||
|
|
||||||
|
public GDBJtagDSFFinalLaunchSequence_7_2(DsfSession session, Map<String, Object> attributes, RequestMonitorWithProgress rm) {
|
||||||
|
super(session, attributes, rm);
|
||||||
|
fSession = session;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String[] getExecutionOrder(String group) {
|
||||||
|
if (GROUP_JTAG.equals(group)) {
|
||||||
|
// Initialize the list with the base class' steps
|
||||||
|
// We need to create a list that we can modify, which is why we create our own ArrayList.
|
||||||
|
List<String> orderList = new ArrayList<String>(Arrays.asList(super.getExecutionOrder(GROUP_JTAG)));
|
||||||
|
|
||||||
|
// Now insert our steps right after the initialization of the base class.
|
||||||
|
orderList.add(orderList.indexOf("stepInitializeJTAGFinalLaunchSequence") + 1, "stepInitializeJTAGSequence_7_2"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
|
return orderList.toArray(new String[orderList.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.getExecutionOrder(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the members of the DebugNewProcessSequence_7_2 class.
|
||||||
|
* This step is mandatory for the rest of the sequence to complete.
|
||||||
|
*/
|
||||||
|
@Execute
|
||||||
|
public void stepInitializeJTAGSequence_7_2(RequestMonitor rm) {
|
||||||
|
DsfServicesTracker tracker = new DsfServicesTracker(Activator.getBundleContext(), fSession.getId());
|
||||||
|
IGDBControl gdbControl = tracker.getService(IGDBControl.class);
|
||||||
|
IGDBProcesses procService = tracker.getService(IGDBProcesses.class);
|
||||||
|
tracker.dispose();
|
||||||
|
|
||||||
|
if (gdbControl == null || procService == null) {
|
||||||
|
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot obtain service", null)); //$NON-NLS-1$
|
||||||
|
rm.done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setContainerContext(procService.createContainerContextFromGroupId(gdbControl.getContext(), "i1")); //$NON-NLS-1$
|
||||||
|
rm.done();
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,12 +15,9 @@ import java.util.Map;
|
||||||
import org.eclipse.cdt.debug.gdbjtag.core.GDBJtagDSFFinalLaunchSequence;
|
import org.eclipse.cdt.debug.gdbjtag.core.GDBJtagDSFFinalLaunchSequence;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
|
||||||
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
||||||
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.service.command.GDBControl;
|
import org.eclipse.cdt.dsf.gdb.service.command.GDBControl;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
import org.eclipse.debug.core.ILaunch;
|
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,8 +33,6 @@ public class GDBJtagControl extends GDBControl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Sequence getCompleteInitializationSequence(Map<String,Object> attributes, RequestMonitorWithProgress rm) {
|
protected Sequence getCompleteInitializationSequence(Map<String,Object> attributes, RequestMonitorWithProgress rm) {
|
||||||
GdbLaunch launch = (GdbLaunch)getSession().getModelAdapter(ILaunch.class);
|
return new GDBJtagDSFFinalLaunchSequence(getSession(), attributes, rm);
|
||||||
IGDBBackend backend = getServicesTracker().getService(IGDBBackend.class);
|
|
||||||
return new GDBJtagDSFFinalLaunchSequence(getExecutor(), launch, backend.getSessionType(), backend.getIsAttachSession(), rm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,12 +15,9 @@ import java.util.Map;
|
||||||
import org.eclipse.cdt.debug.gdbjtag.core.GDBJtagDSFFinalLaunchSequence;
|
import org.eclipse.cdt.debug.gdbjtag.core.GDBJtagDSFFinalLaunchSequence;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
|
||||||
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
||||||
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_0;
|
import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_0;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
import org.eclipse.debug.core.ILaunch;
|
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,8 +33,6 @@ public class GDBJtagControl_7_0 extends GDBControl_7_0 {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Sequence getCompleteInitializationSequence(Map<String,Object> attributes, RequestMonitorWithProgress rm) {
|
protected Sequence getCompleteInitializationSequence(Map<String,Object> attributes, RequestMonitorWithProgress rm) {
|
||||||
GdbLaunch launch = (GdbLaunch)getSession().getModelAdapter(ILaunch.class);
|
return new GDBJtagDSFFinalLaunchSequence(getSession(), attributes, rm);
|
||||||
IGDBBackend backend = getServicesTracker().getService(IGDBBackend.class);
|
|
||||||
return new GDBJtagDSFFinalLaunchSequence(getExecutor(), launch, backend.getSessionType(), backend.getIsAttachSession(), rm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,15 +12,12 @@ package org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.gdbjtag.core.GDBJtagDSFFinalLaunchSequence;
|
import org.eclipse.cdt.debug.gdbjtag.core.GDBJtagDSFFinalLaunchSequence_7_2;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
|
||||||
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
||||||
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_2;
|
import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_2;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
import org.eclipse.debug.core.ILaunch;
|
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,8 +33,6 @@ public class GDBJtagControl_7_2 extends GDBControl_7_2 {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Sequence getCompleteInitializationSequence(Map<String,Object> attributes, RequestMonitorWithProgress rm) {
|
protected Sequence getCompleteInitializationSequence(Map<String,Object> attributes, RequestMonitorWithProgress rm) {
|
||||||
GdbLaunch launch = (GdbLaunch)getSession().getModelAdapter(ILaunch.class);
|
return new GDBJtagDSFFinalLaunchSequence_7_2(getSession(), attributes, rm);
|
||||||
IGDBBackend backend = getServicesTracker().getService(IGDBBackend.class);
|
|
||||||
return new GDBJtagDSFFinalLaunchSequence(getExecutor(), launch, backend.getSessionType(), backend.getIsAttachSession(), rm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2013 Ericsson and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Marc Khouzam (Ericsson) - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.gdbjtag.core.GDBJtagDSFFinalLaunchSequence_7_2;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_4;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
||||||
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Jtag control service which selects the Jtag CompleteInitializationSequence.
|
||||||
|
* Use for GDB >= 7.2
|
||||||
|
*/
|
||||||
|
public class GDBJtagControl_7_4 extends GDBControl_7_4 {
|
||||||
|
|
||||||
|
public GDBJtagControl_7_4(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
|
||||||
|
super(session, config, factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Sequence getCompleteInitializationSequence(Map<String,Object> attributes, RequestMonitorWithProgress rm) {
|
||||||
|
return new GDBJtagDSFFinalLaunchSequence_7_2(getSession(), attributes, rm);
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Ericsson - initial API and implementation
|
* Ericsson - initial API and implementation
|
||||||
|
* Marc Khouzam (Ericsson) - Added support for the different GDBControl versions (Bug 324101)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service;
|
package org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service;
|
||||||
|
|
||||||
|
@ -29,6 +30,9 @@ public class GdbJtagDebugServicesFactory extends GdbDebugServicesFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) {
|
protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) {
|
||||||
|
if (GDB_7_4_VERSION.compareTo(getVersion()) <= 0) {
|
||||||
|
return new GDBJtagControl_7_4(session, config, new CommandFactory_6_8());
|
||||||
|
}
|
||||||
if (GDB_7_2_VERSION.compareTo(getVersion()) <= 0) {
|
if (GDB_7_2_VERSION.compareTo(getVersion()) <= 0) {
|
||||||
return new GDBJtagControl_7_2(session, config, new CommandFactory_6_8());
|
return new GDBJtagControl_7_2(session, config, new CommandFactory_6_8());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue