mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 304096: restore interrupt behavior for remote debugging case.
This commit is contained in:
parent
e82f7e1313
commit
9e8cd5b29b
4 changed files with 61 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,19 @@ public class MIProcessAdapter implements MIProcess {
|
|||
if (fGDBProcess instanceof Spawner) {
|
||||
if (inferior.isRunning()) {
|
||||
Spawner gdbSpawner = (Spawner) fGDBProcess;
|
||||
|
||||
// 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
|
||||
|
|
|
@ -378,9 +378,20 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
|
|||
public void interrupt() {
|
||||
if (fProcess instanceof Spawner) {
|
||||
Spawner gdbSpawner = (Spawner) fProcess;
|
||||
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 3.0
|
||||
|
@ -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;
|
||||
|
||||
// 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$
|
||||
|
|
Loading…
Add table
Reference in a new issue