From 0d3709c35086f0f0aa4158348feb04492e6d7665 Mon Sep 17 00:00:00 2001 From: ck Date: Fri, 16 Oct 2009 15:47:54 +0200 Subject: [PATCH] Inferior interruption handling changes On UNIX, use SIGINT to interrupt the child, as the remote debugger's -exec-interrupt does so as well. On Windows, we get a SIGTRAP which we cannot influence. As we currently do not know on which OS a remote debuggee is running, accept either signal in that mode. Reviewed-By: ossi --- src/plugins/debugger/gdb/gdbengine.cpp | 26 ++++++++++++++++++++------ src/plugins/debugger/procinterrupt.cpp | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index acb1d1ac88e..874488e6e24 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1005,6 +1005,14 @@ void GdbEngine::handleAqcuiredInferior() } #endif +#ifdef Q_OS_UNIX +# define STOP_SIGNAL "SIGINT" +# define CROSS_STOP_SIGNAL "SIGTRAP" +#else +# define STOP_SIGNAL "SIGTRAP" +# define CROSS_STOP_SIGNAL "SIGINT" +#endif + void GdbEngine::handleStopResponse(const GdbMi &data) { const QByteArray reason = data.findChild("reason").data(); @@ -1124,10 +1132,14 @@ void GdbEngine::handleStopResponse(const GdbMi &data) initHelpers = false; // Don't load helpers on stops triggered by signals unless it's // an intentional trap. - if (initHelpers && reason == "signal-received" - && data.findChild("signal-name").data() != "SIGTRAP") - initHelpers = false; - + if (initHelpers && reason == "signal-received") { + QByteArray name = data.findChild("signal-name").data(); + if (name != STOP_SIGNAL + && (startParameters().startMode != StartRemote + || name != CROSS_STOP_SIGNAL)) + initHelpers = false; + } + if (initHelpers) { tryLoadDebuggingHelpers(); QVariant var = QVariant::fromValue(data); @@ -1202,9 +1214,11 @@ void GdbEngine::handleStop1(const GdbMi &data) if (reason == "signal-received" && theDebuggerBoolSetting(UseMessageBoxForSignals)) { QByteArray name = data.findChild("signal-name").data(); - // Ignore SIGTRAP as they are showing up regularily when + // Ignore these as they are showing up regularly when // stopping debugging. - if (name != "SIGTRAP") { + if (name != STOP_SIGNAL + && (startParameters().startMode != StartRemote + || name != CROSS_STOP_SIGNAL)) { QByteArray meaning = data.findChild("signal-meaning").data(); QString msg = tr("

The inferior stopped because it received a " "signal from the Operating System.

" diff --git a/src/plugins/debugger/procinterrupt.cpp b/src/plugins/debugger/procinterrupt.cpp index a65cdcb8232..98d4232e25e 100644 --- a/src/plugins/debugger/procinterrupt.cpp +++ b/src/plugins/debugger/procinterrupt.cpp @@ -61,7 +61,7 @@ bool Debugger::Internal::interruptProcess(int pID) bool Debugger::Internal::interruptProcess(int pID) { if (pID > 0) { - if (kill(pID, SIGTRAP) == 0) + if (kill(pID, SIGINT) == 0) return true; } return false;