Commit 0d3709c3 authored by ck's avatar ck
Browse files

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
parent 42d3ada0
......@@ -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<GdbMi>(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("<p>The inferior stopped because it received a "
"signal from the Operating System.<p>"
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment