mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 247161 According to a GDB maintainer, GDB will not send an ^error after a ^done. Therefore we can remove this case and cleanup.
This commit is contained in:
parent
1d08e1c884
commit
2552eacead
6 changed files with 15 additions and 81 deletions
|
@ -82,7 +82,6 @@ public class GdbRestartCommand implements IRestart {
|
|||
@Override
|
||||
protected void handleSuccess() {
|
||||
gdbControl.createInferiorProcess();
|
||||
gdbControl.resetInferior(gdbControl.getInferiorProcess());
|
||||
gdbControl.restart(fLaunch, rm);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -418,10 +418,6 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
|||
return fInferiorProcess;
|
||||
}
|
||||
|
||||
public void resetInferior(MIInferiorProcess inferior) {
|
||||
fCLICommandProcessor.resetInferior(inferior);
|
||||
}
|
||||
|
||||
public boolean isGDBExited() {
|
||||
return fMonitorJob != null && fMonitorJob.fExited;
|
||||
}
|
||||
|
@ -709,7 +705,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
|||
|
||||
createInferiorProcess();
|
||||
|
||||
fCLICommandProcessor = new CLIEventProcessor(GDBControl.this, fControlDmc, fInferiorProcess);
|
||||
fCLICommandProcessor = new CLIEventProcessor(GDBControl.this, fControlDmc);
|
||||
fMIEventProcessor = new MIRunControlEventProcessor(GDBControl.this, fControlDmc);
|
||||
|
||||
requestMonitor.done();
|
||||
|
|
|
@ -419,10 +419,6 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
|
|||
return fInferiorProcess;
|
||||
}
|
||||
|
||||
public void resetInferior(MIInferiorProcess inferior) {
|
||||
fCLICommandProcessor.resetInferior(inferior);
|
||||
}
|
||||
|
||||
public boolean isGDBExited() {
|
||||
return fMonitorJob != null && fMonitorJob.fExited;
|
||||
}
|
||||
|
@ -710,7 +706,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
|
|||
|
||||
createInferiorProcess();
|
||||
|
||||
fCLICommandProcessor = new CLIEventProcessor_7_0(GDBControl_7_0.this, fControlDmc, fInferiorProcess);
|
||||
fCLICommandProcessor = new CLIEventProcessor_7_0(GDBControl_7_0.this, fControlDmc);
|
||||
fMIEventProcessor = new MIRunControlEventProcessor_7_0(GDBControl_7_0.this, fControlDmc);
|
||||
|
||||
requestMonitor.done();
|
||||
|
|
|
@ -47,8 +47,6 @@ public interface IGDBControl extends ICommandControlService {
|
|||
|
||||
MIInferiorProcess getInferiorProcess();
|
||||
|
||||
public void resetInferior(MIInferiorProcess inferior);
|
||||
|
||||
boolean isGDBExited();
|
||||
|
||||
int getGDBExitCode();
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.eclipse.dd.mi.service.command.commands.CLICommand;
|
|||
import org.eclipse.dd.mi.service.command.commands.MIInterpreterExecConsole;
|
||||
import org.eclipse.dd.mi.service.command.events.MIBreakpointChangedEvent;
|
||||
import org.eclipse.dd.mi.service.command.events.MIDetachedEvent;
|
||||
import org.eclipse.dd.mi.service.command.events.MIErrorEvent;
|
||||
import org.eclipse.dd.mi.service.command.events.MIEvent;
|
||||
import org.eclipse.dd.mi.service.command.events.MIRunningEvent;
|
||||
import org.eclipse.dd.mi.service.command.events.MISignalChangedEvent;
|
||||
|
@ -44,7 +43,6 @@ import org.eclipse.dd.mi.service.command.events.MIThreadCreatedEvent;
|
|||
import org.eclipse.dd.mi.service.command.output.MIConsoleStreamOutput;
|
||||
import org.eclipse.dd.mi.service.command.output.MIOOBRecord;
|
||||
import org.eclipse.dd.mi.service.command.output.MIOutput;
|
||||
import org.eclipse.dd.mi.service.command.output.MIResultRecord;
|
||||
|
||||
/**
|
||||
* GDB debugger output listener.
|
||||
|
@ -54,18 +52,16 @@ public class CLIEventProcessor
|
|||
implements ICommandListener, IEventListener
|
||||
{
|
||||
private final ICommandControlService fCommandControl;
|
||||
private MIInferiorProcess fInferior;
|
||||
private final ICommandControlDMContext fControlDmc;
|
||||
|
||||
// Last Thread ID created
|
||||
private static int fLastThreadId;
|
||||
|
||||
private final DsfServicesTracker fServicesTracker;
|
||||
|
||||
public CLIEventProcessor(ICommandControlService connection, IContainerDMContext containerDmc, MIInferiorProcess inferior) {
|
||||
|
||||
public CLIEventProcessor(ICommandControlService connection, ICommandControlDMContext controlDmc) {
|
||||
fCommandControl = connection;
|
||||
fInferior = inferior;
|
||||
fControlDmc = DMContexts.getAncestorOfType(containerDmc, ICommandControlDMContext.class);
|
||||
fControlDmc = controlDmc;
|
||||
fServicesTracker = new DsfServicesTracker(MIPlugin.getBundleContext(), fCommandControl.getSession().getId());
|
||||
connection.addCommandListener(this);
|
||||
connection.addEventListener(this);
|
||||
|
@ -73,14 +69,19 @@ public class CLIEventProcessor
|
|||
fLastThreadId = 0;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public CLIEventProcessor(ICommandControlService connection, IContainerDMContext containerDmc, MIInferiorProcess inferior) {
|
||||
this(connection, DMContexts.getAncestorOfType(containerDmc, ICommandControlDMContext.class));
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
fCommandControl.removeCommandListener(this);
|
||||
fCommandControl.removeEventListener(this);
|
||||
fServicesTracker.dispose();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void resetInferior(MIInferiorProcess inferior) {
|
||||
fInferior = inferior;
|
||||
}
|
||||
|
||||
public void commandSent(ICommandToken token) {
|
||||
|
@ -136,27 +137,6 @@ public class CLIEventProcessor
|
|||
// they completely exit the system.
|
||||
}
|
||||
}
|
||||
|
||||
// GDB can send an error result following sending an OK result.
|
||||
// In this case the error is routed as an event.
|
||||
MIResultRecord rr = ((MIOutput)output).getMIResultRecord();
|
||||
if (rr != null) {
|
||||
// Check if the state changed.
|
||||
String state = rr.getResultClass();
|
||||
if (fInferior != null && "error".equals(state)) { //$NON-NLS-1$
|
||||
if (fInferior.getState() == MIInferiorProcess.State.RUNNING) {
|
||||
fInferior.setState(MIInferiorProcess.State.STOPPED);
|
||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||
String groupId = procService.getExecutionGroupIdFromThread(null);
|
||||
|
||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
||||
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, groupId);
|
||||
fCommandControl.getSession().dispatchEvent(
|
||||
MIErrorEvent.parse(processContainerDmc, rr.getToken(), rr.getMIResults(), null),
|
||||
fCommandControl.getProperties());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@ import org.eclipse.dd.dsf.concurrent.ConfinedToDsfExecutor;
|
|||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.ISignals.ISignalsDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandListener;
|
||||
|
@ -29,17 +27,13 @@ import org.eclipse.dd.dsf.debug.service.command.IEventListener;
|
|||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
|
||||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.dd.mi.internal.MIPlugin;
|
||||
import org.eclipse.dd.mi.service.IMIProcesses;
|
||||
import org.eclipse.dd.mi.service.command.commands.CLICommand;
|
||||
import org.eclipse.dd.mi.service.command.commands.MIInterpreterExecConsole;
|
||||
import org.eclipse.dd.mi.service.command.events.MIBreakpointChangedEvent;
|
||||
import org.eclipse.dd.mi.service.command.events.MIDetachedEvent;
|
||||
import org.eclipse.dd.mi.service.command.events.MIErrorEvent;
|
||||
import org.eclipse.dd.mi.service.command.events.MIEvent;
|
||||
import org.eclipse.dd.mi.service.command.events.MIRunningEvent;
|
||||
import org.eclipse.dd.mi.service.command.events.MISignalChangedEvent;
|
||||
import org.eclipse.dd.mi.service.command.output.MIOutput;
|
||||
import org.eclipse.dd.mi.service.command.output.MIResultRecord;
|
||||
|
||||
/**
|
||||
* GDB debugger output listener.
|
||||
|
@ -49,18 +43,16 @@ public class CLIEventProcessor_7_0
|
|||
implements ICommandListener, IEventListener
|
||||
{
|
||||
private final ICommandControlService fCommandControl;
|
||||
private MIInferiorProcess fInferior;
|
||||
private final ICommandControlDMContext fControlDmc;
|
||||
|
||||
private final DsfServicesTracker fServicesTracker;
|
||||
|
||||
public CLIEventProcessor_7_0(ICommandControlService connection, IContainerDMContext containerDmc, MIInferiorProcess inferior) {
|
||||
public CLIEventProcessor_7_0(ICommandControlService connection, ICommandControlDMContext controlDmc) {
|
||||
fCommandControl = connection;
|
||||
fInferior = inferior;
|
||||
fControlDmc = DMContexts.getAncestorOfType(containerDmc, ICommandControlDMContext.class);
|
||||
fControlDmc = controlDmc;
|
||||
fServicesTracker = new DsfServicesTracker(MIPlugin.getBundleContext(), fCommandControl.getSession().getId());
|
||||
connection.addCommandListener(this);
|
||||
connection.addEventListener(this);
|
||||
fCommandControl.addCommandListener(this);
|
||||
fCommandControl.addEventListener(this);
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
|
@ -68,10 +60,6 @@ public class CLIEventProcessor_7_0
|
|||
fCommandControl.removeEventListener(this);
|
||||
fServicesTracker.dispose();
|
||||
}
|
||||
|
||||
public void resetInferior(MIInferiorProcess inferior) {
|
||||
fInferior = inferior;
|
||||
}
|
||||
|
||||
public void commandSent(ICommandToken token) {
|
||||
if (token.getCommand() instanceof CLICommand<?>) {
|
||||
|
@ -100,29 +88,6 @@ public class CLIEventProcessor_7_0
|
|||
}
|
||||
|
||||
public void eventReceived(Object output) {
|
||||
// GDB can send an error result following sending an OK result.
|
||||
// In this case the error is routed as an event.
|
||||
MIResultRecord rr = ((MIOutput)output).getMIResultRecord();
|
||||
if (rr != null) {
|
||||
// Check if the state changed.
|
||||
String state = rr.getResultClass();
|
||||
|
||||
// This is not handled properly yet
|
||||
// see bug 247161
|
||||
if (fInferior != null && "error".equals(state)) { //$NON-NLS-1$
|
||||
if (fInferior.getState() == MIInferiorProcess.State.RUNNING) {
|
||||
fInferior.setState(MIInferiorProcess.State.STOPPED);
|
||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||
String groupId = procService.getExecutionGroupIdFromThread(null);
|
||||
|
||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
||||
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, groupId);
|
||||
fCommandControl.getSession().dispatchEvent(
|
||||
MIErrorEvent.parse(processContainerDmc, rr.getToken(), rr.getMIResults(), null),
|
||||
fCommandControl.getProperties());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue