1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Bug 304096: restore interrupt behavior for remote debugging case.

This commit is contained in:
John Cortell 2010-04-26 22:58:22 +00:00
parent e82f7e1313
commit 9e8cd5b29b
4 changed files with 61 additions and 3 deletions

View file

@ -56,6 +56,10 @@ public class MIInferior extends Process {
int inferiorPID;
/** See {@link #getIsRemoteInferior()} */
private boolean fIsRemoteInferior;
public MIInferior(MISession mi, IMITTY p) {
session = mi;
tty = p;
@ -378,4 +382,23 @@ public class MIInferior extends Process {
public int getInferiorPID() {
return inferiorPID;
}
/**
* Called early on in the debug session to mark the inferior process as being
* under the control of a gdbserver.
*
* @since 7.0
*/
public void setIsRemoteInferior(boolean value) {
fIsRemoteInferior = value;
}
/**
* Is the inferior process being debugged remotely through gdbserver?
*
* @since 7.0
*/
public boolean getIsRemoteInferior() {
return fIsRemoteInferior;
}
}

View file

@ -109,6 +109,7 @@ public class GDBServerCDIDebugger2 extends GDBCDIDebugger2 {
// @@@ We have to set the suspended state manually
miSession.getMIInferior().setSuspended();
miSession.getMIInferior().update();
miSession.getMIInferior().setIsRemoteInferior(true);
}
}

View file

@ -123,7 +123,19 @@ public class MIProcessAdapter implements MIProcess {
if (fGDBProcess instanceof Spawner) {
if (inferior.isRunning()) {
Spawner gdbSpawner = (Spawner) fGDBProcess;
gdbSpawner.interruptCTRLC();
// Cygwin gdb 6.8 is capricious when it comes to interrupting the
// target. The same logic here will work with MinGW, though. And on
// linux it's irrelevant since interruptCTRLC()==interrupt(). So,
// one odd size fits all.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c54
if (inferior.getIsRemoteInferior()) {
gdbSpawner.interrupt();
}
else {
gdbSpawner.interruptCTRLC();
}
waitForInterrupt(inferior);
}
// If we are still running try to drop the sig to the PID

View file

@ -378,7 +378,18 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
public void interrupt() {
if (fProcess instanceof Spawner) {
Spawner gdbSpawner = (Spawner) fProcess;
gdbSpawner.interruptCTRLC();
// Cygwin gdb 6.8 is capricious when it comes to interrupting the
// target. The same logic here will work with MinGW, though. And on
// linux it's irrelevant since interruptCTRLC()==interrupt(). So,
// one odd size fits all.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c54
if (getSessionType() == SessionType.REMOTE) {
gdbSpawner.interrupt();
}
else {
gdbSpawner.interruptCTRLC();
}
}
}
@ -388,7 +399,18 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
public void interruptAndWait(int timeout, RequestMonitor rm) {
if (fProcess instanceof Spawner) {
Spawner gdbSpawner = (Spawner) fProcess;
gdbSpawner.interruptCTRLC();
// Cygwin gdb 6.8 is capricious when it comes to interrupting the
// target. The same logic here will work with MinGW, though. And on
// linux it's irrelevant since interruptCTRLC()==interrupt(). So,
// one odd size fits all.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c54
if (getSessionType() == SessionType.REMOTE) {
gdbSpawner.interrupt();
}
else {
gdbSpawner.interruptCTRLC();
}
fInterruptFailedJob = new MonitorInterruptJob(timeout, rm);
} else {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Cannot interrupt.", null)); //$NON-NLS-1$