mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Remove check that became unnecessary when I moved the logic back into this class.
This commit is contained in:
parent
bec406f7dd
commit
1dd75f85e0
1 changed files with 53 additions and 59 deletions
|
@ -15,7 +15,6 @@ import java.io.IOException;
|
||||||
|
|
||||||
import org.eclipse.cdt.utils.spawner.Spawner;
|
import org.eclipse.cdt.utils.spawner.Spawner;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
|
@ -45,66 +44,61 @@ public class CygwinMIProcessAdapter extends MIProcessAdapter {
|
||||||
// Once we drop support for gdb 6.8, we should be able to ditch
|
// Once we drop support for gdb 6.8, we should be able to ditch
|
||||||
// this method and rely on the base implementation
|
// this method and rely on the base implementation
|
||||||
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c56
|
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c56
|
||||||
if (Platform.getOS().equals(Platform.OS_WIN32)) {
|
if (inferior.isRemoteInferior()) {
|
||||||
if (inferior.isRemoteInferior()) {
|
// Interrupt gdb with a 'kill -SIGINT'. The reason we
|
||||||
// Interrupt gdb with a 'kill -SIGINT'. The reason we
|
// need to send a simulated Cygwin/POSIX SIGINT to
|
||||||
// need to send a simulated Cygwin/POSIX SIGINT to
|
// Cygwin gdb is that it has special handling in the case
|
||||||
// Cygwin gdb is that it has special handling in the case
|
// of remote debugging, as explained in the bugzilla
|
||||||
// of remote debugging, as explained in the bugzilla
|
// comment above. That special handling will forward the
|
||||||
// comment above. That special handling will forward the
|
// interrupt request through gdbserver to the remote
|
||||||
// interrupt request through gdbserver to the remote
|
// inferior, but the interrupt to gdb *must* be a
|
||||||
// inferior, but the interrupt to gdb *must* be a
|
// simulated Cygwin/POSIX SIGINT; a CTRL-C won't do.
|
||||||
// simulated Cygwin/POSIX SIGINT; a CTRL-C won't do.
|
gdbSpawner.interrupt();
|
||||||
gdbSpawner.interrupt();
|
}
|
||||||
}
|
else if (inferior.isAttachedInferior()) {
|
||||||
else if (inferior.isAttachedInferior()) {
|
// Cygwin gdb 6.8 has no support for forwarding an
|
||||||
// Cygwin gdb 6.8 has no support for forwarding an
|
// interrupt request to the local process it has
|
||||||
// interrupt request to the local process it has
|
// attached to. That support has since been added and
|
||||||
// attached to. That support has since been added and
|
// will be available in 7.x. So, the only way to suspend the
|
||||||
// will be available in 7.x. So, the only way to suspend the
|
// attached-to inferior is to interrupt it directly.
|
||||||
// attached-to inferior is to interrupt it directly.
|
// The following call will take a special path in the
|
||||||
// The following call will take a special path in the
|
// JNI code. See Java_org_eclipse_cdt_utils_spawner_Spawner_raise()
|
||||||
// JNI code. See Java_org_eclipse_cdt_utils_spawner_Spawner_raise()
|
// We don't use the Cygwin 'kill' command since we don't
|
||||||
// We don't use the Cygwin 'kill' command since we don't
|
// know if the process associated with PID (the
|
||||||
// know if the process associated with PID (the
|
// inferior) is a cygwin
|
||||||
// inferior) is a cygwin
|
// process (kill only works on cygwin programs). We also
|
||||||
// process (kill only works on cygwin programs). We also
|
// can't use GenerateConsoleCtrlEvent() to send a CTRL-C
|
||||||
// can't use GenerateConsoleCtrlEvent() to send a CTRL-C
|
// since that can only be used if the recipient shares a
|
||||||
// since that can only be used if the recipient shares a
|
// console with the caller. So, we end up looking for a
|
||||||
// console with the caller. So, we end up looking for a
|
// console window associated with PID, and then we
|
||||||
// console window associated with PID, and then we
|
// fabricate keyboard events to simulate the user doing
|
||||||
// fabricate keyboard events to simulate the user doing
|
// a CTRL-C in that console! Crazy stuff, but it works.
|
||||||
// a CTRL-C in that console! Crazy stuff, but it works.
|
// Thing is, the PID associated with the console window
|
||||||
// Thing is, the PID associated with the console window
|
// has to be that of the process we're trying to
|
||||||
// has to be that of the process we're trying to
|
// interrupt. What that means is that in order for CDT's
|
||||||
// interrupt. What that means is that in order for CDT's
|
// 'suspend' button to work in an attach debug session,
|
||||||
// 'suspend' button to work in an attach debug session,
|
// the inferior must have been launched with its own
|
||||||
// the inferior must have been launched with its own
|
// console. If you open a Windows console and type
|
||||||
// console. If you open a Windows console and type
|
// 'myprogram.exe', CDT can attach to it but not suspend
|
||||||
// 'myprogram.exe', CDT can attach to it but not suspend
|
// it once it resumes it. Instead, you have to launch
|
||||||
// it once it resumes it. Instead, you have to launch
|
// the program by using 'start myprogram.exe'.
|
||||||
// the program by using 'start myprogram.exe'.
|
interruptInferior(inferior);
|
||||||
interruptInferior(inferior);
|
interruptedInferior = true;
|
||||||
interruptedInferior = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// The typical case--gdb launches the inferior.
|
|
||||||
// Interrupt gdb but with a CTRL-C. gdb (6.8) itself
|
|
||||||
// doesn't have a handler for CTRL-C, but all processes
|
|
||||||
// in the console
|
|
||||||
// process group will receive the CTRL-C, and gdb
|
|
||||||
// registers itself to catch any such events that
|
|
||||||
// happen in the inferior. Thus it is able to determine
|
|
||||||
// and report that the inferior has been interrupted.
|
|
||||||
// But it's important we don't interrupt Cygwin gdb with
|
|
||||||
// a 'kill' since that will only reach gdb, and gdb
|
|
||||||
// won't forward the request on to the inferior. See
|
|
||||||
// bugzilla comment referenced above for details.
|
|
||||||
gdbSpawner.interruptCTRLC();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gdbSpawner.interrupt();
|
// The typical case--gdb launches the inferior.
|
||||||
|
// Interrupt gdb but with a CTRL-C. gdb (6.8) itself
|
||||||
|
// doesn't have a handler for CTRL-C, but all processes
|
||||||
|
// in the console
|
||||||
|
// process group will receive the CTRL-C, and gdb
|
||||||
|
// registers itself to catch any such events that
|
||||||
|
// happen in the inferior. Thus it is able to determine
|
||||||
|
// and report that the inferior has been interrupted.
|
||||||
|
// But it's important we don't interrupt Cygwin gdb with
|
||||||
|
// a 'kill' since that will only reach gdb, and gdb
|
||||||
|
// won't forward the request on to the inferior. See
|
||||||
|
// bugzilla comment referenced above for details.
|
||||||
|
gdbSpawner.interruptCTRLC();
|
||||||
}
|
}
|
||||||
|
|
||||||
waitForInterrupt(inferior);
|
waitForInterrupt(inferior);
|
||||||
|
|
Loading…
Add table
Reference in a new issue