debugger: implement an option to stop on qWarnings (gdb only)

Task-number: QTCREATORBUG-842
Change-Id: If1a7d0cd9dfaa5b6b4915fa67a150683cf6786b9
Reviewed-on: http://codereview.qt.nokia.com/226
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2011-05-30 16:01:50 +02:00
committed by hjk
parent 7295d50591
commit cf62837fab
6 changed files with 32 additions and 3 deletions

View File

@@ -321,6 +321,14 @@ DebuggerSettings::DebuggerSettings(QSettings *settings)
item->setSettingsKey(debugModeGroup, QLatin1String("BreakOnCatch"));
insertItem(BreakOnCatch, item);
item = new SavedAction(this);
item->setText(tr("Break on \"qWarning\""));
item->setCheckable(true);
item->setDefaultValue(false);
item->setValue(false);
item->setSettingsKey(debugModeGroup, QLatin1String("BreakOnWarning"));
insertItem(BreakOnWarning, item);
//
// Settings
//

View File

@@ -150,6 +150,7 @@ enum DebuggerActionCode
SelectedPluginBreakpointsPattern,
BreakOnThrow,
BreakOnCatch,
BreakOnWarning,
// Registers
AlwaysAdjustRegistersColumnWidths,

View File

@@ -4726,11 +4726,14 @@ void GdbEngine::handleNamespaceExtraction(const GdbResponse &response)
setQtNamespace(ns + "::");
}
if (startParameters().startMode == AttachCore)
if (startParameters().startMode == AttachCore) {
notifyInferiorSetupOk(); // No breakpoints in core files.
else
} else {
postCommand("-break-insert -f '" + qtNamespace() + "qFatal'",
CB(handleBreakOnQFatal));
if (debuggerCore()->boolSetting(BreakOnWarning))
postCommand("-break-insert -f '" + qtNamespace() + "qWarning'");
}
}
void GdbEngine::handleBreakOnQFatal(const GdbResponse &response)

View File

@@ -94,6 +94,8 @@ QWidget *GdbOptionsPage::createPage(QWidget *parent)
m_ui->checkBoxTargetAsync);
m_group.insert(debuggerCore()->action(AdjustBreakpointLocations),
m_ui->checkBoxAdjustBreakpointLocations);
m_group.insert(debuggerCore()->action(BreakOnWarning),
m_ui->checkBoxBreakOnWarning);
m_group.insert(debuggerCore()->action(GdbWatchdogTimeout),
m_ui->spinBoxGdbWatchdogTimeout);

View File

@@ -123,6 +123,13 @@ on slow machines. In this case, the value should be increased.</string>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxBreakOnWarning">
<property name="text">
<string>Stop when a qWarning is issued</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxEnableReverseDebugging">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Selecting this enables reverse debugging.&lt;/p&gt;&lt;.p&gt;&lt;b&gt;Note:&lt;/b&gt;This feature is very slow and unstable on the GDB side. It exhibits unpredictable behaviour when going backwards over system calls and is very likely to destroy your debugging session.&lt;/p&gt;&lt;body&gt;&lt;/html&gt;</string>

View File

@@ -2612,6 +2612,13 @@ void testEigen()
#endif
}
// http://bugreports.qt.nokia.com/browse/QTCREATORBUG-842
void test842()
{
qWarning("Test");
int x = 0;
++x;
}
// http://bugreports.qt.nokia.com/browse/QTCREATORBUG-4019
class A4019
@@ -2654,8 +2661,9 @@ void test4497()
int main(int argc, char *argv[])
{
//test4497();
test842();
test4019();
//test4497();
testEigen();
testKR();
int *x = new int(32);