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
This commit is contained in:
ck
2009-10-16 15:47:54 +02:00
parent 42d3ada0b4
commit 0d3709c350
2 changed files with 21 additions and 7 deletions

View File

@@ -1005,6 +1005,14 @@ void GdbEngine::handleAqcuiredInferior()
} }
#endif #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) void GdbEngine::handleStopResponse(const GdbMi &data)
{ {
const QByteArray reason = data.findChild("reason").data(); const QByteArray reason = data.findChild("reason").data();
@@ -1124,9 +1132,13 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
initHelpers = false; initHelpers = false;
// Don't load helpers on stops triggered by signals unless it's // Don't load helpers on stops triggered by signals unless it's
// an intentional trap. // an intentional trap.
if (initHelpers && reason == "signal-received" if (initHelpers && reason == "signal-received") {
&& data.findChild("signal-name").data() != "SIGTRAP") QByteArray name = data.findChild("signal-name").data();
if (name != STOP_SIGNAL
&& (startParameters().startMode != StartRemote
|| name != CROSS_STOP_SIGNAL))
initHelpers = false; initHelpers = false;
}
if (initHelpers) { if (initHelpers) {
tryLoadDebuggingHelpers(); tryLoadDebuggingHelpers();
@@ -1202,9 +1214,11 @@ void GdbEngine::handleStop1(const GdbMi &data)
if (reason == "signal-received" if (reason == "signal-received"
&& theDebuggerBoolSetting(UseMessageBoxForSignals)) { && theDebuggerBoolSetting(UseMessageBoxForSignals)) {
QByteArray name = data.findChild("signal-name").data(); 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. // stopping debugging.
if (name != "SIGTRAP") { if (name != STOP_SIGNAL
&& (startParameters().startMode != StartRemote
|| name != CROSS_STOP_SIGNAL)) {
QByteArray meaning = data.findChild("signal-meaning").data(); QByteArray meaning = data.findChild("signal-meaning").data();
QString msg = tr("<p>The inferior stopped because it received a " QString msg = tr("<p>The inferior stopped because it received a "
"signal from the Operating System.<p>" "signal from the Operating System.<p>"

View File

@@ -61,7 +61,7 @@ bool Debugger::Internal::interruptProcess(int pID)
bool Debugger::Internal::interruptProcess(int pID) bool Debugger::Internal::interruptProcess(int pID)
{ {
if (pID > 0) { if (pID > 0) {
if (kill(pID, SIGTRAP) == 0) if (kill(pID, SIGINT) == 0)
return true; return true;
} }
return false; return false;