mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
[248593] Added missing requestMonitor completions
This commit is contained in:
parent
286e04711a
commit
985195bc3c
1 changed files with 44 additions and 28 deletions
|
@ -7,10 +7,15 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Ericsson - initial API and implementation this class is based on
|
||||
* QNX Software Systems (Andy Jin) - Initial implementation for Jtag debugging
|
||||
* QNX Software Systems - Initial implementation for Jtag debugging
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.gdbjtag.core;
|
||||
|
||||
/**
|
||||
* @author Andy Jin
|
||||
*
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
@ -21,6 +26,7 @@ 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.IGDBJtagDevice;
|
||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector;
|
||||
import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||
|
@ -323,12 +329,17 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
*/
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
Exception exception = null;
|
||||
try {
|
||||
fGdbJtagDevice = getGDBJtagDevice(fLaunch.getLaunchConfiguration());
|
||||
} catch (NullPointerException e) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot get Jtag device", e)); //$NON-NLS-1$
|
||||
exception = e;
|
||||
} catch (CoreException e) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot get Jtag device", e)); //$NON-NLS-1$
|
||||
exception = e;
|
||||
}
|
||||
if (fGdbJtagDevice == null) {
|
||||
// Abort the launch
|
||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot get Jtag device", exception)); //$NON-NLS-1$
|
||||
}
|
||||
rm.done();
|
||||
}
|
||||
|
@ -342,8 +353,6 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
*/
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
if (fGdbJtagDevice != null) {
|
||||
|
||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
||||
try {
|
||||
if (config.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET)) {
|
||||
|
@ -354,13 +363,14 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
fCommandControl.queueCommand(
|
||||
new CLICommand<MIInfo>(fCommandControl.getContext(), composeCommand(commands)),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||
} else {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
/*
|
||||
* Run device-specific code to reset the board
|
||||
|
@ -371,7 +381,6 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
*/
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
if (fGdbJtagDevice != null) {
|
||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
||||
try {
|
||||
if (config.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, true)) {
|
||||
|
@ -380,13 +389,14 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
fCommandControl.queueCommand(
|
||||
new CLICommand<MIInfo>(fCommandControl.getContext(), composeCommand(commands)),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||
} else {
|
||||
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
|
||||
|
@ -397,7 +407,6 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
*/
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
if (fGdbJtagDevice != null) {
|
||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
||||
int defaultDelay = fGdbJtagDevice.getDefaultDelay();
|
||||
try {
|
||||
|
@ -411,7 +420,6 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
rm.done();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
/*
|
||||
* Run device-specific code to halt the board
|
||||
|
@ -422,7 +430,6 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
*/
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
if (fGdbJtagDevice != null) {
|
||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
||||
try {
|
||||
if (config.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, true)) {
|
||||
|
@ -431,13 +438,14 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
fCommandControl.queueCommand(
|
||||
new CLICommand<MIInfo>(fCommandControl.getContext(), composeCommand(commands)),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||
} else {
|
||||
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
|
||||
|
@ -448,23 +456,24 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
*/
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
if (fGdbJtagDevice != null) {
|
||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
||||
try {
|
||||
String userCmd = config.getAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, ""); //$NON-NLS-1$
|
||||
userCmd = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(userCmd);
|
||||
String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
|
||||
|
||||
CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
|
||||
crm.setDoneCount(commands.length);
|
||||
for (int i = 0; i < commands.length; ++i) {
|
||||
fCommandControl.queueCommand(
|
||||
new CLICommand<MIInfo>(fCommandControl.getContext(), commands[i]),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), crm));
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot run user defined init commands", e)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
/*
|
||||
* Execute image loading
|
||||
|
@ -475,7 +484,6 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
*/
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
if (fGdbJtagDevice != null) {
|
||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
||||
try {
|
||||
if (config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE)) {
|
||||
|
@ -489,14 +497,18 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
fCommandControl.queueCommand(
|
||||
new CLICommand<MIInfo>(fCommandControl.getContext(), composeCommand(commands)),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||
} else {
|
||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Image name cannot be empty", null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
} else {
|
||||
rm.done();
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot load image", e)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
/*
|
||||
* Execute symbol loading
|
||||
|
@ -507,7 +519,6 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
*/
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
if (fGdbJtagDevice != null) {
|
||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
||||
try {
|
||||
if (config.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS)) {
|
||||
|
@ -521,14 +532,18 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
fCommandControl.queueCommand(
|
||||
new CLICommand<MIInfo>(fCommandControl.getContext(), composeCommand(commands)),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||
} else {
|
||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Symbol name cannot be empty", null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
} else {
|
||||
rm.done();
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot load symbol", e)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
/*
|
||||
* Start tracking the breakpoints once we know we are connected to the target (necessary for remote debugging)
|
||||
|
@ -553,7 +568,6 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
*/
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
if (fGdbJtagDevice != null) {
|
||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
||||
try {
|
||||
if (config.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER)) {
|
||||
|
@ -563,13 +577,14 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
fCommandControl.queueCommand(
|
||||
new CLICommand<MIInfo>(fCommandControl.getContext(), composeCommand(commands)),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||
} else {
|
||||
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
|
||||
|
@ -580,7 +595,6 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
*/
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
if (fGdbJtagDevice != null) {
|
||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
||||
try {
|
||||
if (config.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT)) {
|
||||
|
@ -590,13 +604,14 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
fCommandControl.queueCommand(
|
||||
new CLICommand<MIInfo>(fCommandControl.getContext(), composeCommand(commands)),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||
} else {
|
||||
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
|
||||
|
@ -607,7 +622,6 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
*/
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
if (fGdbJtagDevice != null) {
|
||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
||||
try {
|
||||
if (config.getAttribute(IGDBJtagConstants.ATTR_SET_RESUME, IGDBJtagConstants.DEFAULT_SET_RESUME)) {
|
||||
|
@ -616,13 +630,14 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
fCommandControl.queueCommand(
|
||||
new CLICommand<MIInfo>(fCommandControl.getContext(), composeCommand(commands)),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||
} else {
|
||||
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
|
||||
|
@ -633,23 +648,24 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
|
|||
*/
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
if (fGdbJtagDevice != null) {
|
||||
ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
|
||||
try {
|
||||
String userCmd = config.getAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, ""); //$NON-NLS-1$
|
||||
userCmd = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(userCmd);
|
||||
String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
|
||||
|
||||
CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
|
||||
crm.setDoneCount(commands.length);
|
||||
for (int i = 0; i < commands.length; ++i) {
|
||||
fCommandControl.queueCommand(
|
||||
new CLICommand<MIInfo>(fCommandControl.getContext(), commands[i]),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), crm));
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot run user defined run commands", e)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue