Commit 6fd0433c authored by hjk's avatar hjk

debugger: pop up a window when the application receives a signal like SIGSEGV

Just mentioning it in the status bar is often not enough to take notice.
parent 21c3e014
......@@ -27,6 +27,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseMessageBoxForSignals">
<property name="text">
<string>Show a message box when receiving a signal</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseAlternatingRowColors">
<property name="text">
......
......@@ -122,13 +122,13 @@ DebuggerSettings *DebuggerSettings::instance()
// View
//
item = new SavedAction(instance);
instance->insertItem(AdjustColumnWidths, item);
item->setText(tr("Adjust column widths to contents"));
instance->insertItem(AdjustColumnWidths, item);
item = new SavedAction(instance);
instance->insertItem(AlwaysAdjustColumnWidths, item);
item->setText(tr("Always adjust column widths to contents"));
item->setCheckable(true);
instance->insertItem(AlwaysAdjustColumnWidths, item);
item = new SavedAction(instance);
item->setText(tr("Use alternating row colors"));
......@@ -138,8 +138,16 @@ DebuggerSettings *DebuggerSettings::instance()
instance->insertItem(UseAlternatingRowColors, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("LogTimeStamps"));
item->setText(tr("Show a message box when receiving a signal"));
item->setSettingsKey(debugModeGroup, QLatin1String("UseMessageBoxForSignals"));
item->setCheckable(true);
item->setDefaultValue(true);
item->setValue(true);
instance->insertItem(UseMessageBoxForSignals, item);
item = new SavedAction(instance);
item->setText(tr("Log time stamps"));
item->setSettingsKey(debugModeGroup, QLatin1String("LogTimeStamps"));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(LogTimeStamps, item);
......
......@@ -77,6 +77,7 @@ enum DebuggerActionCode
AdjustColumnWidths,
AlwaysAdjustColumnWidths,
UseAlternatingRowColors,
UseMessageBoxForSignals,
AutoQuit,
LockView,
LogTimeStamps,
......
......@@ -294,6 +294,8 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent)
m_ui.checkBoxListSourceFiles);
m_group.insert(theDebuggerAction(UseAlternatingRowColors),
m_ui.checkBoxUseAlternatingRowColors);
m_group.insert(theDebuggerAction(UseMessageBoxForSignals),
m_ui.checkBoxUseMessageBoxForSignals);
m_group.insert(theDebuggerAction(SkipKnownFrames),
m_ui.checkBoxSkipKnownFrames);
m_group.insert(theDebuggerAction(UseToolTips),
......
......@@ -790,7 +790,7 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
if (record.token < m_oldestAcceptableToken && (cmd.flags & Discardable)) {
//qDebug() << "### SKIPPING OLD RESULT" << record.toString();
//QMessageBox::information(m_mainWindow, tr("Skipped"), "xxx");
//QMessageBox::information(q->mainWindow(), tr("Skipped"), "xxx");
return;
}
......@@ -1186,6 +1186,19 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
}
}
#endif
if (reason == "signal-received"
&& theDebuggerBoolSetting(UseMessageBoxForSignals)) {
QByteArray name = data.findChild("signal-name").data();
QByteArray meaning = data.findChild("signal-meaning").data();
QString msg = tr("<p>The inferior stopped because it received a "
"signal from the Operating System.<p>"
"<table><tr><td>Signal name : </td><td>%1</td></tr>"
"<tr><td>Signal meaning : </td><td>%2</td></tr></table>")
.arg(name.isEmpty() ? tr(" <Unknown> ") : _(name))
.arg(meaning.isEmpty() ? tr(" <Unknown> ") : _(meaning));
QMessageBox::information(q->mainWindow(), tr("Signal received"), msg);
}
if (reason.isEmpty())
q->showStatusMessage(tr("Stopped."));
else
......@@ -1295,11 +1308,11 @@ void GdbEngine::handleShowVersion(const GdbResultRecord &response, const QVarian
"Using gdb 6.7 or later is strongly recommended.");
#if 0
// ugly, but 'Show again' check box...
static QErrorMessage *err = new QErrorMessage(m_mainWindow);
static QErrorMessage *err = new QErrorMessage(q->mainWindow());
err->setMinimumSize(400, 300);
err->showMessage(msg);
#else
//QMessageBox::information(m_mainWindow, tr("Warning"), msg);
//QMessageBox::information(q->mainWindow(), tr("Warning"), msg);
#endif
} else {
m_gdbVersion = 10000 * supported.cap(2).toInt()
......
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