mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +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
|
@ -12,6 +12,7 @@
|
||||||
* - API generalization to become transport-independent (allow
|
* - API generalization to become transport-independent (allow
|
||||||
* connections via serial ports and pipes).
|
* connections via serial ports and pipes).
|
||||||
* John Dallaway - Wrong groupId during initialization (Bug 349736)
|
* John Dallaway - Wrong groupId during initialization (Bug 349736)
|
||||||
|
* Marc Khouzam (Ericsson) - Updated to extend FinalLaunchSequence instead of copying it (bug 324101)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.gdbjtag.core;
|
package org.eclipse.cdt.debug.gdbjtag.core;
|
||||||
|
|
||||||
|
@ -23,28 +24,29 @@ package org.eclipse.cdt.debug.gdbjtag.core;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||||
|
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||||
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContribution;
|
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContribution;
|
||||||
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContributionFactory;
|
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContributionFactory;
|
||||||
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice;
|
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice;
|
||||||
import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
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.datamodel.DMContexts;
|
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
import org.eclipse.cdt.dsf.datamodel.DataModelInitializedEvent;
|
|
||||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
||||||
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
|
import org.eclipse.cdt.dsf.gdb.launching.FinalLaunchSequence;
|
||||||
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
|
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
|
||||||
import org.eclipse.cdt.dsf.gdb.launching.LaunchMessages;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.SessionType;
|
import org.eclipse.cdt.dsf.gdb.service.SessionType;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
|
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
|
||||||
|
@ -52,16 +54,16 @@ import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
|
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
|
import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
|
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.commands.CLICommand;
|
import org.eclipse.cdt.dsf.mi.service.command.commands.CLICommand;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||||
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||||
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
|
import org.eclipse.cdt.utils.CommandLineUtil;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.variables.VariablesPlugin;
|
import org.eclipse.core.variables.VariablesPlugin;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The final launch sequence for the Jtag hardware debugging using the
|
* The final launch sequence for the Jtag hardware debugging using the
|
||||||
|
@ -75,7 +77,7 @@ import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
* <p>
|
* <p>
|
||||||
* @since 7.0
|
* @since 7.0
|
||||||
*/
|
*/
|
||||||
public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
|
||||||
|
|
||||||
/** utility method; cuts down on clutter */
|
/** utility method; cuts down on clutter */
|
||||||
private void queueCommands(List<String> commands, RequestMonitor rm) {
|
private void queueCommands(List<String> commands, RequestMonitor rm) {
|
||||||
|
@ -89,321 +91,187 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Step[] fSteps = new Step[] {
|
// The launchConfiguration attributes
|
||||||
/*
|
private Map<String, Object> fAttributes;
|
||||||
* Create the service tracker for later use
|
|
||||||
|
private DsfSession fSession;
|
||||||
|
|
||||||
|
private IGDBControl fCommandControl;
|
||||||
|
private IGDBBackend fGDBBackend;
|
||||||
|
private IMIProcesses fProcService;
|
||||||
|
private IGDBJtagDevice fGdbJtagDevice;
|
||||||
|
|
||||||
|
private DsfServicesTracker fTracker;
|
||||||
|
private IMIContainerDMContext fContainerCtx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 8.2
|
||||||
*/
|
*/
|
||||||
new Step() {
|
public GDBJtagDSFFinalLaunchSequence(DsfSession session, Map<String, Object> attributes, RequestMonitorWithProgress rm) {
|
||||||
@Override
|
super(session, attributes, rm);
|
||||||
public void execute(RequestMonitor requestMonitor) {
|
fSession = session;
|
||||||
fTracker = new DsfServicesTracker(Activator.getBundleContext(), fLaunch.getSession().getId());
|
fAttributes = attributes;
|
||||||
requestMonitor.done();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GDBJtagDSFFinalLaunchSequence(DsfExecutor executor, GdbLaunch launch, SessionType sessionType, boolean attach, RequestMonitorWithProgress rm) {
|
||||||
|
this(launch.getSession(), getAttributes(launch), rm);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private static Map<String, Object> getAttributes(GdbLaunch launch) {
|
||||||
|
try {
|
||||||
|
return launch.getLaunchConfiguration().getAttributes();
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
|
return new HashMap<String, Object>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since 8.2 */
|
||||||
|
protected IMIContainerDMContext getContainerContext() {
|
||||||
|
return fContainerCtx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since 8.2 */
|
||||||
|
protected void setContainerContext(IMIContainerDMContext ctx) {
|
||||||
|
fContainerCtx = ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since 8.2 */
|
||||||
|
protected static final String GROUP_JTAG = "GROUP_JTAG";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rollBack(RequestMonitor requestMonitor) {
|
protected String[] getExecutionOrder(String group) {
|
||||||
if (fTracker != null) fTracker.dispose();
|
if (GROUP_TOP_LEVEL.equals(group)) {
|
||||||
fTracker = null;
|
// Initialize the list with the base class' steps
|
||||||
requestMonitor.done();
|
// 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_TOP_LEVEL)));
|
||||||
/*
|
|
||||||
* Fetch the GDBBackend service for later use
|
// First, remove all steps of the base class that we don't want to use.
|
||||||
|
orderList.removeAll(Arrays.asList(new String[] {
|
||||||
|
"stepNewProcess", //$NON-NLS-1$
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Now insert our steps before the data model initialized event is sent
|
||||||
|
orderList.add(orderList.indexOf("stepDataModelInitializationComplete"), GROUP_JTAG);
|
||||||
|
|
||||||
|
return orderList.toArray(new String[orderList.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finally, deal with our groups and their steps.
|
||||||
|
if (GROUP_JTAG.equals(group)) {
|
||||||
|
return new String[] {
|
||||||
|
"stepInitializeJTAGFinalLaunchSequence",
|
||||||
|
"stepRetrieveJTAGDevice", //$NON-NLS-1$
|
||||||
|
"stepLoadSymbols", //$NON-NLS-1$
|
||||||
|
"stepConnectToTarget", //$NON-NLS-1$
|
||||||
|
"stepResetBoard", //$NON-NLS-1$
|
||||||
|
"stepDelayStartup", //$NON-NLS-1$
|
||||||
|
"stepHaltBoard", //$NON-NLS-1$
|
||||||
|
"stepUserInitCommands", //$NON-NLS-1$
|
||||||
|
"stepLoadImage", //$NON-NLS-1$
|
||||||
|
|
||||||
|
"stepUpdateContainer", //$NON-NLS-1$
|
||||||
|
|
||||||
|
"stepSetArguments", //$NON-NLS-1$
|
||||||
|
"stepSetEnvironmentVariables", //$NON-NLS-1$
|
||||||
|
"stepStartTrackingBreakpoints", //$NON-NLS-1$
|
||||||
|
|
||||||
|
"stepSetProgramCounter", //$NON-NLS-1$
|
||||||
|
"stepStopScript", //$NON-NLS-1$
|
||||||
|
"stepResumeScript", //$NON-NLS-1$
|
||||||
|
"stepUserDebugCommands", //$NON-NLS-1$
|
||||||
|
"stepJTAGCleanup", //$NON-NLS-1$
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// For any subgroups of the base class
|
||||||
|
return super.getExecutionOrder(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the members of the class.
|
||||||
|
* This step is mandatory for the rest of the sequence to complete.
|
||||||
|
* @since 8.2
|
||||||
*/
|
*/
|
||||||
new Step() {
|
@Execute
|
||||||
@Override
|
public void stepInitializeJTAGFinalLaunchSequence(RequestMonitor rm) {
|
||||||
public void execute(RequestMonitor requestMonitor) {
|
fTracker = new DsfServicesTracker(Activator.getBundleContext(), fSession.getId());
|
||||||
fGDBBackend = fTracker.getService(IGDBBackend.class);
|
fGDBBackend = fTracker.getService(IGDBBackend.class);
|
||||||
if (fGDBBackend == null) {
|
if (fGDBBackend == null) {
|
||||||
requestMonitor.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot obtain GDBBackend service", null)); //$NON-NLS-1$
|
rm.done(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot obtain GDBBackend service", null)); //$NON-NLS-1$
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
requestMonitor.done();
|
|
||||||
}},
|
|
||||||
/*
|
|
||||||
* Fetch the control service for later use
|
|
||||||
*/
|
|
||||||
new Step() {
|
|
||||||
@Override
|
|
||||||
public void execute(RequestMonitor requestMonitor) {
|
|
||||||
fCommandControl = fTracker.getService(IGDBControl.class);
|
fCommandControl = fTracker.getService(IGDBControl.class);
|
||||||
if (fCommandControl == null) {
|
if (fCommandControl == null) {
|
||||||
requestMonitor.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot obtain control service", null)); //$NON-NLS-1$
|
rm.done(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot obtain control service", null)); //$NON-NLS-1$
|
||||||
}
|
return;
|
||||||
else {
|
|
||||||
fCommandFactory = fCommandControl.getCommandFactory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
requestMonitor.done();
|
|
||||||
}},
|
|
||||||
/*
|
|
||||||
* Fetch the process service for later use
|
|
||||||
*/
|
|
||||||
new Step() {
|
|
||||||
@Override
|
|
||||||
public void execute(RequestMonitor requestMonitor) {
|
|
||||||
fProcService = fTracker.getService(IMIProcesses.class);
|
fProcService = fTracker.getService(IMIProcesses.class);
|
||||||
if (fProcService == null) {
|
if (fProcService == null) {
|
||||||
requestMonitor.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot obtain process service", null)); //$NON-NLS-1$
|
rm.done(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot obtain process service", null)); //$NON-NLS-1$
|
||||||
}
|
|
||||||
|
|
||||||
requestMonitor.done();
|
|
||||||
}},
|
|
||||||
/*
|
|
||||||
* Specify GDB's working directory
|
|
||||||
*/
|
|
||||||
new Step() {
|
|
||||||
@Override
|
|
||||||
public void execute(final RequestMonitor requestMonitor) {
|
|
||||||
IPath dir = null;
|
|
||||||
try {
|
|
||||||
dir = fGDBBackend.getGDBWorkingDirectory();
|
|
||||||
} catch (CoreException e) {
|
|
||||||
requestMonitor.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot get working directory", e)); //$NON-NLS-1$
|
|
||||||
requestMonitor.done();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dir != null) {
|
// When we are starting to debug a new process, the container is the default process used by GDB.
|
||||||
fCommandControl.queueCommand(
|
// We don't have a pid yet, so we can simply create the container with the UNIQUE_GROUP_ID
|
||||||
fCommandFactory.createMIEnvironmentCD(fCommandControl.getContext(), dir.toPortableString()),
|
setContainerContext(fProcService.createContainerContextFromGroupId(fCommandControl.getContext(), MIProcesses.UNIQUE_GROUP_ID));
|
||||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
|
||||||
} else {
|
rm.done();
|
||||||
requestMonitor.done();
|
|
||||||
}
|
}
|
||||||
}},
|
|
||||||
/*
|
/**
|
||||||
* Source the gdbinit file specified in the launch
|
* Rollback method for {@link #stepInitializeJTAGFinalLaunchSequence()}
|
||||||
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
new Step() {
|
@RollBack("stepInitializeJTAGFinalLaunchSequence")
|
||||||
@Override
|
public void rollBackInitializeFinalLaunchSequence(RequestMonitor rm) {
|
||||||
public void execute(final RequestMonitor requestMonitor) {
|
if (fTracker != null) fTracker.dispose();
|
||||||
try {
|
fTracker = null;
|
||||||
final String gdbinitFile = fGDBBackend.getGDBInitFile();
|
rm.done();
|
||||||
|
|
||||||
if (gdbinitFile != null && gdbinitFile.length() > 0) {
|
|
||||||
fCommandControl.queueCommand(
|
|
||||||
fCommandFactory.createCLISource(fCommandControl.getContext(), gdbinitFile),
|
|
||||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
|
|
||||||
@Override
|
|
||||||
protected void handleCompleted() {
|
|
||||||
// If the gdbinitFile is the default, then it may not exist and we
|
|
||||||
// should not consider this an error.
|
|
||||||
// If it is not the default, then the user must have specified it and
|
|
||||||
// we want to warn the user if we can't find it.
|
|
||||||
if (!gdbinitFile.equals(IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT )) {
|
|
||||||
requestMonitor.setStatus(getStatus());
|
|
||||||
}
|
}
|
||||||
requestMonitor.done();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
requestMonitor.done();
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
requestMonitor.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot get gdbinit option", e)); //$NON-NLS-1$
|
|
||||||
requestMonitor.done();
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
/*
|
|
||||||
* Specify the arguments to the executable file
|
|
||||||
*/
|
|
||||||
new Step() {
|
|
||||||
@Override
|
|
||||||
public void execute(final RequestMonitor requestMonitor) {
|
|
||||||
try {
|
|
||||||
String args = fGDBBackend.getProgramArguments();
|
|
||||||
|
|
||||||
if (args != null) {
|
|
||||||
String[] argArray = args.replaceAll("\n", " ").split(" "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
||||||
IMIContainerDMContext containerDmc = fProcService.createContainerContextFromGroupId(fCommandControl.getContext(), MIProcesses.UNIQUE_GROUP_ID);
|
|
||||||
fCommandControl.queueCommand(
|
|
||||||
fCommandFactory.createMIGDBSetArgs(containerDmc, argArray),
|
|
||||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
|
||||||
} else {
|
|
||||||
requestMonitor.done();
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
requestMonitor.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot get inferior arguments", e)); //$NON-NLS-1$
|
|
||||||
requestMonitor.done();
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
/*
|
|
||||||
* Specify environment variables if needed
|
|
||||||
*/
|
|
||||||
new Step() {
|
|
||||||
@Override
|
|
||||||
public void execute(final RequestMonitor requestMonitor) {
|
|
||||||
boolean clear = false;
|
|
||||||
Properties properties = new Properties();
|
|
||||||
try {
|
|
||||||
clear = fGDBBackend.getClearEnvironment();
|
|
||||||
properties = fGDBBackend.getEnvironmentVariables();
|
|
||||||
} catch (CoreException e) {
|
|
||||||
requestMonitor.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot get environment information", e)); //$NON-NLS-1$
|
|
||||||
requestMonitor.done();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (clear == true || properties.size() > 0) {
|
|
||||||
fCommandControl.setEnvironment(properties, clear, requestMonitor);
|
|
||||||
} else {
|
|
||||||
requestMonitor.done();
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
/*
|
|
||||||
* Enable non-stop mode if necessary
|
|
||||||
*/
|
|
||||||
new Step() {
|
|
||||||
@Override
|
|
||||||
public void execute(final RequestMonitor requestMonitor) {
|
|
||||||
boolean isNonStop = false;
|
|
||||||
try {
|
|
||||||
isNonStop = fLaunch.getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
|
|
||||||
LaunchUtils.getIsNonStopModeDefault());
|
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
// GDBs that don't support non-stop don't allow you to set it to false.
|
|
||||||
// We really should set it to false when GDB supports it though.
|
|
||||||
// Something to fix later.
|
|
||||||
if (isNonStop) {
|
|
||||||
// The raw commands should not be necessary in the official GDB release
|
|
||||||
fCommandControl.queueCommand(
|
|
||||||
fCommandFactory.createMIGDBSetTargetAsync(fCommandControl.getContext(), true),
|
|
||||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
|
|
||||||
@Override
|
|
||||||
protected void handleSuccess() {
|
|
||||||
fCommandControl.queueCommand(
|
|
||||||
fCommandFactory.createMIGDBSetPagination(fCommandControl.getContext(), false),
|
|
||||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
|
|
||||||
@Override
|
|
||||||
protected void handleSuccess() {
|
|
||||||
fCommandControl.queueCommand(
|
|
||||||
fCommandFactory.createMIGDBSetNonStop(fCommandControl.getContext(), true),
|
|
||||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
requestMonitor.done();
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
/*
|
|
||||||
* Tell GDB to automatically load or not the shared library symbols
|
|
||||||
*/
|
|
||||||
new Step() {
|
|
||||||
@Override
|
|
||||||
public void execute(RequestMonitor requestMonitor) {
|
|
||||||
try {
|
|
||||||
boolean autolib = fLaunch.getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB,
|
|
||||||
IGDBLaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT);
|
|
||||||
fCommandControl.queueCommand(
|
|
||||||
fCommandFactory.createMIGDBSetAutoSolib(fCommandControl.getContext(), autolib),
|
|
||||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
|
||||||
} catch (CoreException e) {
|
|
||||||
requestMonitor.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot set shared library option", e)); //$NON-NLS-1$
|
|
||||||
requestMonitor.done();
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
/*
|
|
||||||
* Set the shared library paths
|
|
||||||
*/
|
|
||||||
new Step() {
|
|
||||||
@Override
|
|
||||||
public void execute(final RequestMonitor requestMonitor) {
|
|
||||||
try {
|
|
||||||
List<String> p = fGDBBackend.getSharedLibraryPaths();
|
|
||||||
|
|
||||||
if (p.size() > 0) {
|
|
||||||
String[] paths = p.toArray(new String[p.size()]);
|
|
||||||
fCommandControl.queueCommand(
|
|
||||||
fCommandFactory.createMIGDBSetSolibSearchPath(fCommandControl.getContext(), paths),
|
|
||||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
|
|
||||||
@Override
|
|
||||||
protected void handleSuccess() {
|
|
||||||
// Sysroot is not available in GDB6.6 and will make the launch fail in that case.
|
|
||||||
// Let's remove it for now
|
|
||||||
requestMonitor.done();
|
|
||||||
// // If we are able to set the solib-search-path,
|
|
||||||
// // we should disable the sysroot variable, as indicated
|
|
||||||
// // in the GDB documentation. This is to avoid the sysroot
|
|
||||||
// // variable finding libraries that were not meant to be found.
|
|
||||||
// fCommandControl.queueCommand(
|
|
||||||
// new MIGDBSetSysroot(fCommandControl.getContext()),
|
|
||||||
// new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
requestMonitor.done();
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
requestMonitor.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot set share library paths", e)); //$NON-NLS-1$
|
|
||||||
requestMonitor.done();
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
|
|
||||||
// -environment-directory with a lot of paths could
|
|
||||||
// make setting breakpoint incredibly slow, which makes
|
|
||||||
// the debug session un-workable. We simply stop
|
|
||||||
// using it because it's usefulness is unclear.
|
|
||||||
// Bug 225805
|
|
||||||
// /*
|
|
||||||
// * Setup the source paths
|
|
||||||
// */
|
|
||||||
// new Step() {
|
|
||||||
// @Override
|
|
||||||
// public void execute(RequestMonitor requestMonitor) {
|
|
||||||
// CSourceLookup sourceLookup = fTracker.getService(CSourceLookup.class);
|
|
||||||
// CSourceLookupDirector locator = (CSourceLookupDirector)fLaunch.getSourceLocator();
|
|
||||||
// ISourceLookupDMContext sourceLookupDmc = (ISourceLookupDMContext)fCommandControl.getContext();
|
|
||||||
//
|
|
||||||
// sourceLookup.setSourceLookupPath(sourceLookupDmc, locator.getSourceContainers(), requestMonitor);
|
|
||||||
// }},
|
|
||||||
|
|
||||||
// Below steps are specific to JTag hardware debugging
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve the IGDBJtagDevice instance
|
* Retrieve the IGDBJtagDevice instance
|
||||||
*/
|
*/
|
||||||
new Step() {
|
/** @since 8.2 */
|
||||||
@Override
|
@Execute
|
||||||
public void execute(RequestMonitor rm) {
|
public void stepRetrieveJTAGDevice(final RequestMonitor rm) {
|
||||||
Exception exception = null;
|
Exception exception = null;
|
||||||
try {
|
try {
|
||||||
fGdbJtagDevice = getGDBJtagDevice(fLaunch.getLaunchConfiguration());
|
fGdbJtagDevice = getGDBJtagDevice();
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
exception = e;
|
exception = e;
|
||||||
} catch (CoreException e) {
|
|
||||||
exception = e;
|
|
||||||
}
|
}
|
||||||
if (fGdbJtagDevice == null) {
|
if (fGdbJtagDevice == null) {
|
||||||
// Abort the launch
|
// Abort the launch
|
||||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot get Jtag device", exception)); //$NON-NLS-1$
|
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot get Jtag device", exception)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
rm.done();
|
rm.done();
|
||||||
}},
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Execute symbol loading
|
* Execute symbol loading
|
||||||
*/
|
*/
|
||||||
new Step() {
|
/** @since 8.2 */
|
||||||
@Override
|
@Execute
|
||||||
public void execute(RequestMonitor rm) {
|
public void stepLoadSymbols(final RequestMonitor rm) {
|
||||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
|
||||||
try {
|
try {
|
||||||
if (config.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS)) {
|
if (CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS)) {
|
||||||
String symbolsFileName = null;
|
String symbolsFileName = null;
|
||||||
|
|
||||||
// New setting in Helios. Default is true. Check for existence
|
// New setting in Helios. Default is true. Check for existence
|
||||||
// in order to support older launch configs
|
// in order to support older launch configs
|
||||||
if (config.hasAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS) &&
|
if (fAttributes.containsKey(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS) &&
|
||||||
config.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_SYMBOLS)) {
|
CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_SYMBOLS)) {
|
||||||
IPath programFile = CDebugUtils.verifyProgramPath(config);
|
IPath programFile = fGDBBackend.getProgramPath();
|
||||||
if (programFile != null) {
|
if (programFile != null) {
|
||||||
symbolsFileName = programFile.toOSString();
|
symbolsFileName = programFile.toOSString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
symbolsFileName = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, IGDBJtagConstants.DEFAULT_SYMBOLS_FILE_NAME);
|
symbolsFileName = CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, IGDBJtagConstants.DEFAULT_SYMBOLS_FILE_NAME);
|
||||||
if (symbolsFileName.length() > 0) {
|
if (symbolsFileName.length() > 0) {
|
||||||
symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName);
|
symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName);
|
||||||
} else {
|
} else {
|
||||||
|
@ -420,7 +288,7 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
||||||
// Escape windows path separator characters TWICE, once for Java and once for GDB.
|
// Escape windows path separator characters TWICE, once for Java and once for GDB.
|
||||||
symbolsFileName = symbolsFileName.replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
|
symbolsFileName = symbolsFileName.replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
String symbolsOffset = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, IGDBJtagConstants.DEFAULT_SYMBOLS_OFFSET);
|
String symbolsOffset = CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, IGDBJtagConstants.DEFAULT_SYMBOLS_OFFSET);
|
||||||
if (symbolsOffset.length() > 0) {
|
if (symbolsOffset.length() > 0) {
|
||||||
symbolsOffset = "0x" + symbolsOffset;
|
symbolsOffset = "0x" + symbolsOffset;
|
||||||
}
|
}
|
||||||
|
@ -435,107 +303,88 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
||||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot load symbol", e)); //$NON-NLS-1$
|
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot load symbol", e)); //$NON-NLS-1$
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
}},
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hook up to remote target
|
* Hook up to remote target
|
||||||
*/
|
*/
|
||||||
new Step() {
|
/** @since 8.2 */
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Execute
|
||||||
public void execute(RequestMonitor rm) {
|
public void stepConnectToTarget(final RequestMonitor rm) {
|
||||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
|
||||||
try {
|
try {
|
||||||
if (config.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET)) {
|
if (CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET)) {
|
||||||
List<String> commands = new ArrayList<String>();
|
List<String> commands = new ArrayList<String>();
|
||||||
if (fGdbJtagDevice instanceof IGDBJtagConnection) {
|
if (fGdbJtagDevice instanceof IGDBJtagConnection) {
|
||||||
URI uri = new URI(config.getAttribute(IGDBJtagConstants.ATTR_CONNECTION, IGDBJtagConstants.DEFAULT_CONNECTION));
|
URI uri = new URI(CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_CONNECTION, IGDBJtagConstants.DEFAULT_CONNECTION));
|
||||||
IGDBJtagConnection device = (IGDBJtagConnection)fGdbJtagDevice;
|
IGDBJtagConnection device = (IGDBJtagConnection)fGdbJtagDevice;
|
||||||
device.doRemote(uri.getSchemeSpecificPart(), commands);
|
device.doRemote(uri.getSchemeSpecificPart(), commands);
|
||||||
} else {
|
} else {
|
||||||
// Handle legacy network device contributions that don't understand URIs
|
// Handle legacy network device contributions that don't understand URIs
|
||||||
String ipAddress = config.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, IGDBJtagConstants.DEFAULT_IP_ADDRESS);
|
String ipAddress = CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_IP_ADDRESS, IGDBJtagConstants.DEFAULT_IP_ADDRESS);
|
||||||
int portNumber = config.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER);
|
int portNumber = CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER);
|
||||||
fGdbJtagDevice.doRemote(ipAddress, portNumber, commands);
|
fGdbJtagDevice.doRemote(ipAddress, portNumber, commands);
|
||||||
}
|
}
|
||||||
queueCommands(commands, rm);
|
queueCommands(commands, rm);
|
||||||
} else {
|
} else {
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot connect to remote target", e)); //$NON-NLS-1$
|
|
||||||
rm.done();
|
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Invalid remote target connection syntax", e)); //$NON-NLS-1$
|
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Invalid remote target connection syntax", e)); //$NON-NLS-1$
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
}},
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Run device-specific code to reset the board
|
* Run device-specific code to reset the board
|
||||||
*/
|
*/
|
||||||
new Step() {
|
/** @since 8.2 */
|
||||||
@Override
|
@Execute
|
||||||
public void execute(RequestMonitor rm) {
|
public void stepResetBoard(final RequestMonitor rm) {
|
||||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
if (CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET)) {
|
||||||
try {
|
|
||||||
if (config.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET)) {
|
|
||||||
List<String> commands = new ArrayList<String>();
|
List<String> commands = new ArrayList<String>();
|
||||||
fGdbJtagDevice.doReset(commands);
|
fGdbJtagDevice.doReset(commands);
|
||||||
queueCommands(commands, rm);
|
queueCommands(commands, rm);
|
||||||
} else {
|
} else {
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot reset the remote target", e)); //$NON-NLS-1$
|
|
||||||
rm.done();
|
|
||||||
}
|
}
|
||||||
}},
|
|
||||||
/*
|
/*
|
||||||
* Run device-specific code to delay the startup
|
* Run device-specific code to delay the startup
|
||||||
*/
|
*/
|
||||||
new Step() {
|
/** @since 8.2 */
|
||||||
@Override
|
@Execute
|
||||||
public void execute(RequestMonitor rm) {
|
public void stepDelayStartup(final RequestMonitor rm) {
|
||||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
|
||||||
int defaultDelay = fGdbJtagDevice.getDefaultDelay();
|
int defaultDelay = fGdbJtagDevice.getDefaultDelay();
|
||||||
try {
|
|
||||||
List<String> commands = new ArrayList<String>();
|
List<String> commands = new ArrayList<String>();
|
||||||
fGdbJtagDevice.doDelay(config.getAttribute(IGDBJtagConstants.ATTR_DELAY, defaultDelay), commands);
|
fGdbJtagDevice.doDelay(CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_DELAY, defaultDelay), commands);
|
||||||
queueCommands(commands, rm);
|
queueCommands(commands, rm);
|
||||||
} catch (CoreException e) {
|
|
||||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot delay the remote target", e)); //$NON-NLS-1$
|
|
||||||
rm.done();
|
|
||||||
}
|
}
|
||||||
}},
|
|
||||||
/*
|
/*
|
||||||
* Run device-specific code to halt the board
|
* Run device-specific code to halt the board
|
||||||
*/
|
*/
|
||||||
new Step() {
|
/** @since 8.2 */
|
||||||
@Override
|
@Execute
|
||||||
public void execute(RequestMonitor rm) {
|
public void stepHaltBoard(final RequestMonitor rm) {
|
||||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
if (CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_DO_HALT, IGDBJtagConstants.DEFAULT_DO_HALT)) {
|
||||||
try {
|
|
||||||
if (config.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, IGDBJtagConstants.DEFAULT_DO_HALT)) {
|
|
||||||
List<String> commands = new ArrayList<String>();
|
List<String> commands = new ArrayList<String>();
|
||||||
fGdbJtagDevice.doHalt(commands);
|
fGdbJtagDevice.doHalt(commands);
|
||||||
queueCommands(commands, rm);
|
queueCommands(commands, rm);
|
||||||
} else {
|
} else {
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot halt the remote target", e)); //$NON-NLS-1$
|
|
||||||
rm.done();
|
|
||||||
}
|
}
|
||||||
}},
|
|
||||||
/*
|
/*
|
||||||
* Execute any user defined init commands
|
* Execute any user defined init commands
|
||||||
*/
|
*/
|
||||||
new Step() {
|
/** @since 8.2 */
|
||||||
@Override
|
@Execute
|
||||||
public void execute(RequestMonitor rm) {
|
public void stepUserInitCommands(final RequestMonitor rm) {
|
||||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
|
||||||
try {
|
try {
|
||||||
String userCmd = config.getAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, IGDBJtagConstants.DEFAULT_INIT_COMMANDS);
|
String userCmd = CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_INIT_COMMANDS, IGDBJtagConstants.DEFAULT_INIT_COMMANDS);
|
||||||
userCmd = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(userCmd);
|
userCmd = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(userCmd);
|
||||||
if (userCmd.length() > 0) {
|
if (userCmd.length() > 0) {
|
||||||
String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
|
String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
|
||||||
|
@ -555,28 +404,28 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
||||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot run user defined init commands", e)); //$NON-NLS-1$
|
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot run user defined init commands", e)); //$NON-NLS-1$
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
}},
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Execute image loading
|
* Execute image loading
|
||||||
*/
|
*/
|
||||||
new Step() {
|
/** @since 8.2 */
|
||||||
@Override
|
@Execute
|
||||||
public void execute(RequestMonitor rm) {
|
public void stepLoadImage(final RequestMonitor rm) {
|
||||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
|
||||||
try {
|
try {
|
||||||
String imageFileName = null;
|
String imageFileName = null;
|
||||||
if (config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE)) {
|
if (CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE)) {
|
||||||
// New setting in Helios. Default is true. Check for existence
|
// New setting in Helios. Default is true. Check for existence
|
||||||
// in order to support older launch configs
|
// in order to support older launch configs
|
||||||
if (config.hasAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE) &&
|
if (fAttributes.containsKey(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE) &&
|
||||||
config.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_IMAGE)) {
|
CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_IMAGE)) {
|
||||||
IPath programFile = CDebugUtils.verifyProgramPath(config);
|
IPath programFile = fGDBBackend.getProgramPath();
|
||||||
if (programFile != null) {
|
if (programFile != null) {
|
||||||
imageFileName = programFile.toOSString();
|
imageFileName = programFile.toOSString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
imageFileName = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, IGDBJtagConstants.DEFAULT_IMAGE_FILE_NAME);
|
imageFileName = CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, IGDBJtagConstants.DEFAULT_IMAGE_FILE_NAME);
|
||||||
if (imageFileName.length() > 0) {
|
if (imageFileName.length() > 0) {
|
||||||
imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName);
|
imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName);
|
||||||
} else {
|
} else {
|
||||||
|
@ -593,9 +442,9 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
||||||
// Escape windows path separator characters TWICE, once for Java and once for GDB.
|
// Escape windows path separator characters TWICE, once for Java and once for GDB.
|
||||||
imageFileName = imageFileName.replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
|
imageFileName = imageFileName.replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
String imageOffset = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET);
|
String imageOffset = CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET);
|
||||||
if (imageOffset.length() > 0) {
|
if (imageOffset.length() > 0) {
|
||||||
imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET); //$NON-NLS-2$
|
imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET); //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
List<String> commands = new ArrayList<String>();
|
List<String> commands = new ArrayList<String>();
|
||||||
fGdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
|
fGdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
|
||||||
|
@ -608,95 +457,138 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
||||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot load image", e)); //$NON-NLS-1$
|
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot load image", e)); //$NON-NLS-1$
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
}},
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now that we are connected to the target, we should update
|
||||||
|
* our container to properly fill in its pid.
|
||||||
|
* @since 8.2
|
||||||
|
*/
|
||||||
|
@Execute
|
||||||
|
public void stepUpdateContainer(RequestMonitor rm) {
|
||||||
|
String groupId = getContainerContext().getGroupId();
|
||||||
|
setContainerContext(fProcService.createContainerContextFromGroupId(fCommandControl.getContext(), groupId));
|
||||||
|
rm.done();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the arguments to the program that will be run.
|
||||||
|
* @since 8.2
|
||||||
|
*/
|
||||||
|
@Execute
|
||||||
|
public void stepSetArguments(RequestMonitor rm) {
|
||||||
|
try {
|
||||||
|
String args = CDebugUtils.getAttribute(
|
||||||
|
fAttributes,
|
||||||
|
ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
|
||||||
|
""); //$NON-NLS-1$
|
||||||
|
|
||||||
|
if (args.length() != 0) {
|
||||||
|
args = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(args);
|
||||||
|
String[] argArray = CommandLineUtil.argumentsToArray(args);
|
||||||
|
fCommandControl.queueCommand(
|
||||||
|
fCommandControl.getCommandFactory().createMIGDBSetArgs(getContainerContext(), argArray),
|
||||||
|
new ImmediateDataRequestMonitor<MIInfo>(rm));
|
||||||
|
} else {
|
||||||
|
rm.done();
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot get inferior arguments", e)); //$NON-NLS-1$
|
||||||
|
rm.done();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify environment variables if needed
|
||||||
|
* @since 8.2
|
||||||
|
*/
|
||||||
|
@Execute
|
||||||
|
public void stepSetEnvironmentVariables(RequestMonitor rm) {
|
||||||
|
boolean clear = false;
|
||||||
|
Properties properties = new Properties();
|
||||||
|
try {
|
||||||
|
// here we need to pass the proper container context
|
||||||
|
clear = fGDBBackend.getClearEnvironment();
|
||||||
|
properties = fGDBBackend.getEnvironmentVariables();
|
||||||
|
} catch (CoreException e) {
|
||||||
|
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot get environment information", e)); //$NON-NLS-1$
|
||||||
|
rm.done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clear == true || properties.size() > 0) {
|
||||||
|
fCommandControl.setEnvironment(properties, clear, rm);
|
||||||
|
} else {
|
||||||
|
rm.done();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start tracking the breakpoints once we know we are connected to the target (necessary for remote debugging)
|
* Start tracking the breakpoints once we know we are connected to the target (necessary for remote debugging)
|
||||||
*/
|
*/
|
||||||
new Step() {
|
/** @since 8.2 */
|
||||||
@Override
|
@Execute
|
||||||
public void execute(final RequestMonitor requestMonitor) {
|
public void stepStartTrackingBreakpoints(final RequestMonitor rm) {
|
||||||
if (fSessionType != SessionType.CORE) {
|
|
||||||
MIBreakpointsManager bpmService = fTracker.getService(MIBreakpointsManager.class);
|
MIBreakpointsManager bpmService = fTracker.getService(MIBreakpointsManager.class);
|
||||||
IMIContainerDMContext containerDmc = fProcService.createContainerContextFromGroupId(fCommandControl.getContext(), MIProcesses.UNIQUE_GROUP_ID);
|
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(getContainerContext(), IBreakpointsTargetDMContext.class);
|
||||||
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
|
bpmService.startTrackingBreakpoints(bpTargetDmc, rm);
|
||||||
|
|
||||||
bpmService.startTrackingBreakpoints(bpTargetDmc, requestMonitor);
|
|
||||||
} else {
|
|
||||||
requestMonitor.done();
|
|
||||||
}
|
}
|
||||||
}},
|
|
||||||
/*
|
/*
|
||||||
* Set the program counter
|
* Set the program counter
|
||||||
*/
|
*/
|
||||||
new Step() {
|
/** @since 8.2 */
|
||||||
@Override
|
@Execute
|
||||||
public void execute(RequestMonitor rm) {
|
public void stepSetProgramCounter(final RequestMonitor rm) {
|
||||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
if (CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER)) {
|
||||||
try {
|
String pcRegister = CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_PC_REGISTER, CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_PC_REGISTER));
|
||||||
if (config.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER)) {
|
|
||||||
String pcRegister = config.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_PC_REGISTER));
|
|
||||||
List<String> commands = new ArrayList<String>();
|
List<String> commands = new ArrayList<String>();
|
||||||
fGdbJtagDevice.doSetPC(pcRegister, commands);
|
fGdbJtagDevice.doSetPC(pcRegister, commands);
|
||||||
queueCommands(commands, rm);
|
queueCommands(commands, rm);
|
||||||
} else {
|
} else {
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot set program counter", e)); //$NON-NLS-1$
|
|
||||||
rm.done();
|
|
||||||
}
|
}
|
||||||
}},
|
|
||||||
/*
|
/*
|
||||||
* Execute the stop script
|
* Execute the stop script
|
||||||
*/
|
*/
|
||||||
new Step() {
|
/** @since 8.2 */
|
||||||
@Override
|
@Execute
|
||||||
public void execute(RequestMonitor rm) {
|
public void stepStopScript(final RequestMonitor rm) {
|
||||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
if (CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT)) {
|
||||||
try {
|
String stopAt = CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_STOP_AT, IGDBJtagConstants.DEFAULT_STOP_AT);
|
||||||
if (config.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT)) {
|
|
||||||
String stopAt = config.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, IGDBJtagConstants.DEFAULT_STOP_AT);
|
|
||||||
List<String> commands = new ArrayList<String>();
|
List<String> commands = new ArrayList<String>();
|
||||||
fGdbJtagDevice.doStopAt(stopAt, commands);
|
fGdbJtagDevice.doStopAt(stopAt, commands);
|
||||||
queueCommands(commands, rm);
|
queueCommands(commands, rm);
|
||||||
} else {
|
} else {
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot run the stop script", e)); //$NON-NLS-1$
|
|
||||||
rm.done();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
/*
|
/*
|
||||||
* Execute the resume script
|
* Execute the resume script
|
||||||
*/
|
*/
|
||||||
new Step() {
|
/** @since 8.2 */
|
||||||
@Override
|
@Execute
|
||||||
public void execute(RequestMonitor rm) {
|
public void stepResumeScript(final RequestMonitor rm) {
|
||||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
if (CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_SET_RESUME, IGDBJtagConstants.DEFAULT_SET_RESUME)) {
|
||||||
try {
|
|
||||||
if (config.getAttribute(IGDBJtagConstants.ATTR_SET_RESUME, IGDBJtagConstants.DEFAULT_SET_RESUME)) {
|
|
||||||
List<String> commands = new ArrayList<String>();
|
List<String> commands = new ArrayList<String>();
|
||||||
fGdbJtagDevice.doContinue(commands);
|
fGdbJtagDevice.doContinue(commands);
|
||||||
queueCommands(commands, rm);
|
queueCommands(commands, rm);
|
||||||
} else {
|
} else {
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot resume the remote target", e)); //$NON-NLS-1$
|
|
||||||
rm.done();
|
|
||||||
}
|
}
|
||||||
}},
|
|
||||||
/*
|
/*
|
||||||
* Run any user defined commands to start debugging
|
* Run any user defined commands to start debugging
|
||||||
*/
|
*/
|
||||||
new Step() {
|
/** @since 8.2 */
|
||||||
@Override
|
@Execute
|
||||||
public void execute(RequestMonitor rm) {
|
public void stepUserDebugCommands(final RequestMonitor rm) {
|
||||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
|
||||||
try {
|
try {
|
||||||
String userCmd = config.getAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, IGDBJtagConstants.DEFAULT_RUN_COMMANDS);
|
String userCmd = CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_RUN_COMMANDS, IGDBJtagConstants.DEFAULT_RUN_COMMANDS);
|
||||||
if (userCmd.length() > 0) {
|
if (userCmd.length() > 0) {
|
||||||
userCmd = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(userCmd);
|
userCmd = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(userCmd);
|
||||||
String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
|
String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
|
||||||
|
@ -716,70 +608,11 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
||||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot run user defined run commands", e)); //$NON-NLS-1$
|
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot run user defined run commands", e)); //$NON-NLS-1$
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
}},
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Indicate that the Data Model has been filled. This will trigger the Debug view to expand.
|
|
||||||
*/
|
|
||||||
new Step() {
|
|
||||||
@Override
|
|
||||||
public void execute(final RequestMonitor requestMonitor) {
|
|
||||||
fLaunch.getSession().dispatchEvent(new DataModelInitializedEvent(fCommandControl.getContext()),
|
|
||||||
fCommandControl.getProperties());
|
|
||||||
requestMonitor.done();
|
|
||||||
}},
|
|
||||||
/*
|
|
||||||
* Cleanup
|
|
||||||
*/
|
|
||||||
new Step() {
|
|
||||||
@Override
|
|
||||||
public void execute(final RequestMonitor requestMonitor) {
|
|
||||||
fTracker.dispose();
|
|
||||||
fTracker = null;
|
|
||||||
requestMonitor.done();
|
|
||||||
}},
|
|
||||||
};
|
|
||||||
|
|
||||||
GdbLaunch fLaunch;
|
|
||||||
SessionType fSessionType;
|
|
||||||
boolean fAttach;
|
|
||||||
|
|
||||||
private IGDBControl fCommandControl;
|
|
||||||
private IGDBBackend fGDBBackend;
|
|
||||||
private IMIProcesses fProcService;
|
|
||||||
private CommandFactory fCommandFactory;
|
|
||||||
private IGDBJtagDevice fGdbJtagDevice;
|
|
||||||
|
|
||||||
DsfServicesTracker fTracker;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @since 8.0
|
|
||||||
*/
|
|
||||||
public GDBJtagDSFFinalLaunchSequence(DsfExecutor executor, GdbLaunch launch, SessionType sessionType, boolean attach, RequestMonitorWithProgress rm) {
|
|
||||||
super(executor, rm, LaunchMessages.getString("FinalLaunchSequence.0"), LaunchMessages.getString("FinalLaunchSequence.1")); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
fLaunch = launch;
|
|
||||||
fSessionType = sessionType;
|
|
||||||
fAttach = attach;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
private IGDBJtagDevice getGDBJtagDevice () {
|
||||||
* @see org.eclipse.cdt.dsf.gdb.launching.FinalLaunchSequence#getSteps()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Step[] getSteps() {
|
|
||||||
return fSteps;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param config
|
|
||||||
* @return IGDBJtagDevice the selected Jtag device
|
|
||||||
* @throws CoreException
|
|
||||||
* @throws NullPointerException
|
|
||||||
*/
|
|
||||||
private IGDBJtagDevice getGDBJtagDevice (ILaunchConfiguration config)
|
|
||||||
throws CoreException, NullPointerException {
|
|
||||||
IGDBJtagDevice gdbJtagDevice = null;
|
IGDBJtagDevice gdbJtagDevice = null;
|
||||||
String jtagDeviceName = config.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, IGDBJtagConstants.DEFAULT_JTAG_DEVICE);
|
String jtagDeviceName = CDebugUtils.getAttribute(fAttributes, IGDBJtagConstants.ATTR_JTAG_DEVICE, IGDBJtagConstants.DEFAULT_JTAG_DEVICE);
|
||||||
GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance().getGDBJtagDeviceContribution();
|
GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance().getGDBJtagDeviceContribution();
|
||||||
for (GDBJtagDeviceContribution availableDevice : availableDevices) {
|
for (GDBJtagDeviceContribution availableDevice : availableDevices) {
|
||||||
if (jtagDeviceName.equals(availableDevice.getDeviceName())) {
|
if (jtagDeviceName.equals(availableDevice.getDeviceName())) {
|
||||||
|
@ -804,4 +637,15 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleanup now that the sequence has been run.
|
||||||
|
* @since 8.2
|
||||||
|
*/
|
||||||
|
@Execute
|
||||||
|
public void stepJTAGCleanup(final RequestMonitor requestMonitor) {
|
||||||
|
fTracker.dispose();
|
||||||
|
fTracker = null;
|
||||||
|
requestMonitor.done();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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