diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 6fe10d932d7..0ac319d45d1 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -2688,7 +2688,8 @@ void CdbEngine::attemptBreakpointSynchronization() } switch (handler->state(id)) { case BreakpointInsertRequested: - if (parameters.type == BreakpointByFileAndLine) { + if (parameters.type == BreakpointByFileAndLine + && m_options->breakpointCorrection) { if (lineCorrection.isNull()) lineCorrection.reset(new BreakpointCorrectionContext(debuggerCore()->cppCodeModelSnapshot(), CPlusPlus::CppModelManagerInterface::instance()->workingCopy())); diff --git a/src/plugins/debugger/cdb/cdboptions.cpp b/src/plugins/debugger/cdb/cdboptions.cpp index 636547e75f0..6a84741804a 100644 --- a/src/plugins/debugger/cdb/cdboptions.cpp +++ b/src/plugins/debugger/cdb/cdboptions.cpp @@ -40,11 +40,12 @@ static const char sourcePathsKeyC[] = "SourcePaths"; static const char breakEventKeyC[] = "BreakEvent"; static const char additionalArgumentsKeyC[] = "AdditionalArguments"; static const char cdbConsoleKeyC[] = "CDB_Console"; +static const char breakpointCorrectionKeyC[] = "BreakpointCorrection"; namespace Debugger { 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(); breakEvents = s->value(keyRoot + QLatin1String(breakEventKeyC), QStringList()).toStringList(); cdbConsole = s->value(keyRoot + QLatin1String(cdbConsoleKeyC), QVariant(false)).toBool(); + breakpointCorrection = s->value(keyRoot + QLatin1String(breakpointCorrectionKeyC), QVariant(true)).toBool(); } void CdbOptions::toSettings(QSettings *s) const @@ -84,12 +86,14 @@ void CdbOptions::toSettings(QSettings *s) const s->setValue(QLatin1String(breakEventKeyC), breakEvents); s->setValue(QLatin1String(additionalArgumentsKeyC), additionalArguments); s->setValue(QLatin1String(cdbConsoleKeyC), QVariant(cdbConsole)); + s->setValue(QLatin1String(breakpointCorrectionKeyC), QVariant(breakpointCorrection)); s->endGroup(); } bool CdbOptions::equals(const CdbOptions &rhs) const { return cdbConsole == rhs.cdbConsole + && breakpointCorrection == rhs.breakpointCorrection && additionalArguments == rhs.additionalArguments && symbolPaths == rhs.symbolPaths && sourcePaths == rhs.sourcePaths diff --git a/src/plugins/debugger/cdb/cdboptions.h b/src/plugins/debugger/cdb/cdboptions.h index 6f34f172c69..28b84add474 100644 --- a/src/plugins/debugger/cdb/cdboptions.h +++ b/src/plugins/debugger/cdb/cdboptions.h @@ -64,7 +64,10 @@ public: QStringList sourcePaths; // Events to break on (Command 'sxe' with abbreviation and optional parameter) QStringList breakEvents; + // Launch CDB's own console instead of Qt Creator's bool cdbConsole; + // Perform code-model based correction of breakpoint location. + bool breakpointCorrection; }; inline bool operator==(const CdbOptions &s1, const CdbOptions &s2) diff --git a/src/plugins/debugger/cdb/cdboptionspage.cpp b/src/plugins/debugger/cdb/cdboptionspage.cpp index ae243a53cfd..0e9146fd1ee 100644 --- a/src/plugins/debugger/cdb/cdboptionspage.cpp +++ b/src/plugins/debugger/cdb/cdboptionspage.cpp @@ -55,17 +55,17 @@ struct EventsDescription { // Parameters of the "sxe" command const EventsDescription eventDescriptions[] = { - {"eh", false, QT_TRANSLATE_NOOP("Debugger::Cdb::CdbBreakEventWidget", + {"eh", false, QT_TRANSLATE_NOOP("Debugger::Internal::CdbBreakEventWidget", "C++ exception")}, - {"ct", false, QT_TRANSLATE_NOOP("Debugger::Cdb::CdbBreakEventWidget", + {"ct", false, QT_TRANSLATE_NOOP("Debugger::Internal::CdbBreakEventWidget", "Thread creation")}, - {"et", false, QT_TRANSLATE_NOOP("Debugger::Cdb::CdbBreakEventWidget", + {"et", false, QT_TRANSLATE_NOOP("Debugger::Internal::CdbBreakEventWidget", "Thread exit")}, - {"ld", true, QT_TRANSLATE_NOOP("Debugger::Cdb::CdbBreakEventWidget", + {"ld", true, QT_TRANSLATE_NOOP("Debugger::Internal::CdbBreakEventWidget", "Load module:")}, - {"ud", true, QT_TRANSLATE_NOOP("Debugger::Cdb::CdbBreakEventWidget", + {"ud", true, QT_TRANSLATE_NOOP("Debugger::Internal::CdbBreakEventWidget", "Unload module:")}, - {"out", true, QT_TRANSLATE_NOOP("Debugger::Cdb::CdbBreakEventWidget", + {"out", true, QT_TRANSLATE_NOOP("Debugger::Internal::CdbBreakEventWidget", "Output:")} }; @@ -83,6 +83,7 @@ CdbBreakEventWidget::CdbBreakEventWidget(QWidget *parent) : QWidget(parent) // 1 column with checkboxes only, // further columns with checkbox + parameter QHBoxLayout *mainLayout = new QHBoxLayout; + mainLayout->setMargin(0); QVBoxLayout *leftLayout = new QVBoxLayout; QFormLayout *parameterLayout = 0; mainLayout->addLayout(leftLayout); @@ -98,7 +99,7 @@ CdbBreakEventWidget::CdbBreakEventWidget(QWidget *parent) : QWidget(parent) } le = new QLineEdit; parameterLayout->addRow(cb, le); - if (parameterLayout->count() >= 4) // New column + if (parameterLayout->count() >= 6) // New column parameterLayout = 0; } else { leftLayout->addWidget(cb); @@ -162,8 +163,19 @@ CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent) : QWidget(parent), m_breakEventWidget(new CdbBreakEventWidget) { 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; + eventLayout->setContentsMargins(margins); eventLayout->addWidget(m_breakEventWidget); m_ui.eventGroupBox->setLayout(eventLayout); } @@ -175,6 +187,7 @@ void CdbOptionsPageWidget::setOptions(CdbOptions &o) m_ui.sourcePathListEditor->setPathList(o.sourcePaths); m_breakEventWidget->setBreakEvents(o.breakEvents); m_ui.consoleCheckBox->setChecked(o.cdbConsole); + m_ui.breakpointCorrectionCheckBox->setChecked(o.breakpointCorrection); } CdbOptions CdbOptionsPageWidget::options() const @@ -185,6 +198,7 @@ CdbOptions CdbOptionsPageWidget::options() const rc.sourcePaths = m_ui.sourcePathListEditor->pathList(); rc.breakEvents = m_breakEventWidget->breakEvents(); rc.cdbConsole = m_ui.consoleCheckBox->isChecked(); + rc.breakpointCorrection = m_ui.breakpointCorrectionCheckBox->isChecked(); return rc; } diff --git a/src/plugins/debugger/cdb/cdboptionspagewidget.ui b/src/plugins/debugger/cdb/cdboptionspagewidget.ui index 94f6fc12c85..8160cd74db3 100644 --- a/src/plugins/debugger/cdb/cdboptionspagewidget.ui +++ b/src/plugins/debugger/cdb/cdboptionspagewidget.ui @@ -6,8 +6,8 @@ 0 0 - 334 - 317 + 629 + 807 @@ -24,7 +24,7 @@ false - + QFormLayout::AllNonFixedFieldsGrow @@ -61,7 +61,7 @@ Debugger Paths - + QFormLayout::AllNonFixedFieldsGrow @@ -94,6 +94,25 @@ + + + + Breakpoints + + + + + + <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> + + + Correct breakpoint location + + + + + +