forked from qt-creator/qt-creator
Debugger[CDB]: Introduce setting for breakpoint correction.
Make it possible to turn it off in case something goes wrong. Squeeze/polish the CDB options dialog and correct translation code of the break options. Task-number: QTCREATORBUG-6207 Change-Id: I1805558abd4478ab680b1e292bb13306b3a0ff05 Reviewed-on: http://codereview.qt-project.org/5838 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
@@ -2688,7 +2688,8 @@ void CdbEngine::attemptBreakpointSynchronization()
|
|||||||
}
|
}
|
||||||
switch (handler->state(id)) {
|
switch (handler->state(id)) {
|
||||||
case BreakpointInsertRequested:
|
case BreakpointInsertRequested:
|
||||||
if (parameters.type == BreakpointByFileAndLine) {
|
if (parameters.type == BreakpointByFileAndLine
|
||||||
|
&& m_options->breakpointCorrection) {
|
||||||
if (lineCorrection.isNull())
|
if (lineCorrection.isNull())
|
||||||
lineCorrection.reset(new BreakpointCorrectionContext(debuggerCore()->cppCodeModelSnapshot(),
|
lineCorrection.reset(new BreakpointCorrectionContext(debuggerCore()->cppCodeModelSnapshot(),
|
||||||
CPlusPlus::CppModelManagerInterface::instance()->workingCopy()));
|
CPlusPlus::CppModelManagerInterface::instance()->workingCopy()));
|
||||||
|
|||||||
@@ -40,11 +40,12 @@ static const char sourcePathsKeyC[] = "SourcePaths";
|
|||||||
static const char breakEventKeyC[] = "BreakEvent";
|
static const char breakEventKeyC[] = "BreakEvent";
|
||||||
static const char additionalArgumentsKeyC[] = "AdditionalArguments";
|
static const char additionalArgumentsKeyC[] = "AdditionalArguments";
|
||||||
static const char cdbConsoleKeyC[] = "CDB_Console";
|
static const char cdbConsoleKeyC[] = "CDB_Console";
|
||||||
|
static const char breakpointCorrectionKeyC[] = "BreakpointCorrection";
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
CdbOptions::CdbOptions() : cdbConsole(false)
|
CdbOptions::CdbOptions() : cdbConsole(false), breakpointCorrection(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,6 +75,7 @@ void CdbOptions::fromSettings(QSettings *s)
|
|||||||
sourcePaths = s->value(keyRoot + QLatin1String(sourcePathsKeyC), QStringList()).toStringList();
|
sourcePaths = s->value(keyRoot + QLatin1String(sourcePathsKeyC), QStringList()).toStringList();
|
||||||
breakEvents = s->value(keyRoot + QLatin1String(breakEventKeyC), QStringList()).toStringList();
|
breakEvents = s->value(keyRoot + QLatin1String(breakEventKeyC), QStringList()).toStringList();
|
||||||
cdbConsole = s->value(keyRoot + QLatin1String(cdbConsoleKeyC), QVariant(false)).toBool();
|
cdbConsole = s->value(keyRoot + QLatin1String(cdbConsoleKeyC), QVariant(false)).toBool();
|
||||||
|
breakpointCorrection = s->value(keyRoot + QLatin1String(breakpointCorrectionKeyC), QVariant(true)).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbOptions::toSettings(QSettings *s) const
|
void CdbOptions::toSettings(QSettings *s) const
|
||||||
@@ -84,12 +86,14 @@ void CdbOptions::toSettings(QSettings *s) const
|
|||||||
s->setValue(QLatin1String(breakEventKeyC), breakEvents);
|
s->setValue(QLatin1String(breakEventKeyC), breakEvents);
|
||||||
s->setValue(QLatin1String(additionalArgumentsKeyC), additionalArguments);
|
s->setValue(QLatin1String(additionalArgumentsKeyC), additionalArguments);
|
||||||
s->setValue(QLatin1String(cdbConsoleKeyC), QVariant(cdbConsole));
|
s->setValue(QLatin1String(cdbConsoleKeyC), QVariant(cdbConsole));
|
||||||
|
s->setValue(QLatin1String(breakpointCorrectionKeyC), QVariant(breakpointCorrection));
|
||||||
s->endGroup();
|
s->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CdbOptions::equals(const CdbOptions &rhs) const
|
bool CdbOptions::equals(const CdbOptions &rhs) const
|
||||||
{
|
{
|
||||||
return cdbConsole == rhs.cdbConsole
|
return cdbConsole == rhs.cdbConsole
|
||||||
|
&& breakpointCorrection == rhs.breakpointCorrection
|
||||||
&& additionalArguments == rhs.additionalArguments
|
&& additionalArguments == rhs.additionalArguments
|
||||||
&& symbolPaths == rhs.symbolPaths
|
&& symbolPaths == rhs.symbolPaths
|
||||||
&& sourcePaths == rhs.sourcePaths
|
&& sourcePaths == rhs.sourcePaths
|
||||||
|
|||||||
@@ -64,7 +64,10 @@ public:
|
|||||||
QStringList sourcePaths;
|
QStringList sourcePaths;
|
||||||
// Events to break on (Command 'sxe' with abbreviation and optional parameter)
|
// Events to break on (Command 'sxe' with abbreviation and optional parameter)
|
||||||
QStringList breakEvents;
|
QStringList breakEvents;
|
||||||
|
// Launch CDB's own console instead of Qt Creator's
|
||||||
bool cdbConsole;
|
bool cdbConsole;
|
||||||
|
// Perform code-model based correction of breakpoint location.
|
||||||
|
bool breakpointCorrection;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator==(const CdbOptions &s1, const CdbOptions &s2)
|
inline bool operator==(const CdbOptions &s1, const CdbOptions &s2)
|
||||||
|
|||||||
@@ -55,17 +55,17 @@ struct EventsDescription {
|
|||||||
// Parameters of the "sxe" command
|
// Parameters of the "sxe" command
|
||||||
const EventsDescription eventDescriptions[] =
|
const EventsDescription eventDescriptions[] =
|
||||||
{
|
{
|
||||||
{"eh", false, QT_TRANSLATE_NOOP("Debugger::Cdb::CdbBreakEventWidget",
|
{"eh", false, QT_TRANSLATE_NOOP("Debugger::Internal::CdbBreakEventWidget",
|
||||||
"C++ exception")},
|
"C++ exception")},
|
||||||
{"ct", false, QT_TRANSLATE_NOOP("Debugger::Cdb::CdbBreakEventWidget",
|
{"ct", false, QT_TRANSLATE_NOOP("Debugger::Internal::CdbBreakEventWidget",
|
||||||
"Thread creation")},
|
"Thread creation")},
|
||||||
{"et", false, QT_TRANSLATE_NOOP("Debugger::Cdb::CdbBreakEventWidget",
|
{"et", false, QT_TRANSLATE_NOOP("Debugger::Internal::CdbBreakEventWidget",
|
||||||
"Thread exit")},
|
"Thread exit")},
|
||||||
{"ld", true, QT_TRANSLATE_NOOP("Debugger::Cdb::CdbBreakEventWidget",
|
{"ld", true, QT_TRANSLATE_NOOP("Debugger::Internal::CdbBreakEventWidget",
|
||||||
"Load module:")},
|
"Load module:")},
|
||||||
{"ud", true, QT_TRANSLATE_NOOP("Debugger::Cdb::CdbBreakEventWidget",
|
{"ud", true, QT_TRANSLATE_NOOP("Debugger::Internal::CdbBreakEventWidget",
|
||||||
"Unload module:")},
|
"Unload module:")},
|
||||||
{"out", true, QT_TRANSLATE_NOOP("Debugger::Cdb::CdbBreakEventWidget",
|
{"out", true, QT_TRANSLATE_NOOP("Debugger::Internal::CdbBreakEventWidget",
|
||||||
"Output:")}
|
"Output:")}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -83,6 +83,7 @@ CdbBreakEventWidget::CdbBreakEventWidget(QWidget *parent) : QWidget(parent)
|
|||||||
// 1 column with checkboxes only,
|
// 1 column with checkboxes only,
|
||||||
// further columns with checkbox + parameter
|
// further columns with checkbox + parameter
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||||
|
mainLayout->setMargin(0);
|
||||||
QVBoxLayout *leftLayout = new QVBoxLayout;
|
QVBoxLayout *leftLayout = new QVBoxLayout;
|
||||||
QFormLayout *parameterLayout = 0;
|
QFormLayout *parameterLayout = 0;
|
||||||
mainLayout->addLayout(leftLayout);
|
mainLayout->addLayout(leftLayout);
|
||||||
@@ -98,7 +99,7 @@ CdbBreakEventWidget::CdbBreakEventWidget(QWidget *parent) : QWidget(parent)
|
|||||||
}
|
}
|
||||||
le = new QLineEdit;
|
le = new QLineEdit;
|
||||||
parameterLayout->addRow(cb, le);
|
parameterLayout->addRow(cb, le);
|
||||||
if (parameterLayout->count() >= 4) // New column
|
if (parameterLayout->count() >= 6) // New column
|
||||||
parameterLayout = 0;
|
parameterLayout = 0;
|
||||||
} else {
|
} else {
|
||||||
leftLayout->addWidget(cb);
|
leftLayout->addWidget(cb);
|
||||||
@@ -162,8 +163,19 @@ CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent) :
|
|||||||
QWidget(parent), m_breakEventWidget(new CdbBreakEventWidget)
|
QWidget(parent), m_breakEventWidget(new CdbBreakEventWidget)
|
||||||
{
|
{
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
|
// Squeeze the groupbox layouts vertically to
|
||||||
|
// accommodate all options. This page only shows on
|
||||||
|
// Windows, which has large margins by default.
|
||||||
|
|
||||||
|
const int margin = m_ui.verticalLayout->margin();
|
||||||
|
const QMargins margins(margin, margin / 3, margin, margin / 3);
|
||||||
|
|
||||||
|
m_ui.startupFormLayout->setContentsMargins(margins);
|
||||||
|
m_ui.pathFormLayout->setContentsMargins(margins);
|
||||||
|
m_ui.breakpointLayout->setContentsMargins(margins);
|
||||||
|
|
||||||
QVBoxLayout *eventLayout = new QVBoxLayout;
|
QVBoxLayout *eventLayout = new QVBoxLayout;
|
||||||
|
eventLayout->setContentsMargins(margins);
|
||||||
eventLayout->addWidget(m_breakEventWidget);
|
eventLayout->addWidget(m_breakEventWidget);
|
||||||
m_ui.eventGroupBox->setLayout(eventLayout);
|
m_ui.eventGroupBox->setLayout(eventLayout);
|
||||||
}
|
}
|
||||||
@@ -175,6 +187,7 @@ void CdbOptionsPageWidget::setOptions(CdbOptions &o)
|
|||||||
m_ui.sourcePathListEditor->setPathList(o.sourcePaths);
|
m_ui.sourcePathListEditor->setPathList(o.sourcePaths);
|
||||||
m_breakEventWidget->setBreakEvents(o.breakEvents);
|
m_breakEventWidget->setBreakEvents(o.breakEvents);
|
||||||
m_ui.consoleCheckBox->setChecked(o.cdbConsole);
|
m_ui.consoleCheckBox->setChecked(o.cdbConsole);
|
||||||
|
m_ui.breakpointCorrectionCheckBox->setChecked(o.breakpointCorrection);
|
||||||
}
|
}
|
||||||
|
|
||||||
CdbOptions CdbOptionsPageWidget::options() const
|
CdbOptions CdbOptionsPageWidget::options() const
|
||||||
@@ -185,6 +198,7 @@ CdbOptions CdbOptionsPageWidget::options() const
|
|||||||
rc.sourcePaths = m_ui.sourcePathListEditor->pathList();
|
rc.sourcePaths = m_ui.sourcePathListEditor->pathList();
|
||||||
rc.breakEvents = m_breakEventWidget->breakEvents();
|
rc.breakEvents = m_breakEventWidget->breakEvents();
|
||||||
rc.cdbConsole = m_ui.consoleCheckBox->isChecked();
|
rc.cdbConsole = m_ui.consoleCheckBox->isChecked();
|
||||||
|
rc.breakpointCorrection = m_ui.breakpointCorrectionCheckBox->isChecked();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>334</width>
|
<width>629</width>
|
||||||
<height>317</height>
|
<height>807</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="startupFormLayout">
|
||||||
<property name="fieldGrowthPolicy">
|
<property name="fieldGrowthPolicy">
|
||||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
</property>
|
</property>
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Debugger Paths</string>
|
<string>Debugger Paths</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout_2">
|
<layout class="QFormLayout" name="pathFormLayout">
|
||||||
<property name="fieldGrowthPolicy">
|
<property name="fieldGrowthPolicy">
|
||||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
</property>
|
</property>
|
||||||
@@ -94,6 +94,25 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="breakpointsGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Breakpoints</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="breakpointLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="breakpointCorrectionCheckBox">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Attempt to correct the location of a breakpoint based on file and line number should it be in a comment or in a line for which no code is generated. The correction is based on the code model.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Correct breakpoint location</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="eventGroupBox">
|
<widget class="QGroupBox" name="eventGroupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
|||||||
Reference in New Issue
Block a user