gdboptionspage.cpp 20.8 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
2
**
3 4
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
7
**
hjk's avatar
hjk committed
8 9 10 11
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
12 13 14
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
15
**
16 17 18 19 20 21 22
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
con's avatar
con committed
23
**
hjk's avatar
hjk committed
24
****************************************************************************/
25

26 27 28 29
#include <debugger/commonoptionspage.h>
#include <debugger/debuggeractions.h>
#include <debugger/debuggercore.h>
#include <debugger/debuggerinternalconstants.h>
30

31
#include <coreplugin/dialogs/ioptionspage.h>
32
#include <coreplugin/icore.h>
33
#include <coreplugin/variablechooser.h>
hjk's avatar
hjk committed
34

hjk's avatar
hjk committed
35 36 37
#include <utils/fancylineedit.h>
#include <utils/pathchooser.h>

hjk's avatar
hjk committed
38 39
#include <QCheckBox>
#include <QCoreApplication>
40 41
#include <QDebug>
#include <QFormLayout>
hjk's avatar
hjk committed
42
#include <QLabel>
43
#include <QLineEdit>
44
#include <QPointer>
45 46
#include <QSpinBox>
#include <QTextEdit>
hjk's avatar
hjk committed
47

48 49
using namespace Core;

50 51 52
namespace Debugger {
namespace Internal {

53 54 55 56 57 58
/////////////////////////////////////////////////////////////////////////
//
// GdbOptionsPageWidget - harmless options
//
/////////////////////////////////////////////////////////////////////////

59
class GdbOptionsPageWidget : public QWidget
hjk's avatar
hjk committed
60
{
Sergey Belyashov's avatar
Sergey Belyashov committed
61
    Q_OBJECT
hjk's avatar
hjk committed
62
public:
63
    GdbOptionsPageWidget();
hjk's avatar
hjk committed
64
    Utils::SavedActionSet group;
hjk's avatar
hjk committed
65 66
};

67 68
class GdbOptionsPage : public Core::IOptionsPage
{
Sergey Belyashov's avatar
Sergey Belyashov committed
69
    Q_OBJECT
70 71 72 73 74 75 76 77 78 79 80 81
public:
    GdbOptionsPage();

    QWidget *widget();
    void apply();
    void finish();

private:
    QPointer<GdbOptionsPageWidget> m_widget;
};

GdbOptionsPageWidget::GdbOptionsPageWidget()
hjk's avatar
hjk committed
82
{
hjk's avatar
hjk committed
83
    auto groupBoxGeneral = new QGroupBox(this);
hjk's avatar
hjk committed
84 85
    groupBoxGeneral->setTitle(GdbOptionsPage::tr("General"));

hjk's avatar
hjk committed
86
    auto labelGdbWatchdogTimeout = new QLabel(groupBoxGeneral);
hjk's avatar
hjk committed
87 88
    labelGdbWatchdogTimeout->setText(GdbOptionsPage::tr("GDB timeout:"));
    labelGdbWatchdogTimeout->setToolTip(GdbOptionsPage::tr(
hjk's avatar
hjk committed
89 90 91 92 93
        "The number of seconds Qt Creator will wait before it terminates\n"
        "a non-responsive GDB process. The default value of 20 seconds should\n"
        "be sufficient for most applications, but there are situations when\n"
        "loading big libraries or listing source files takes much longer than\n"
        "that on slow machines. In this case, the value should be increased."));
hjk's avatar
hjk committed
94

hjk's avatar
hjk committed
95
    auto spinBoxGdbWatchdogTimeout = new QSpinBox(groupBoxGeneral);
hjk's avatar
hjk committed
96 97 98 99 100 101 102 103
    spinBoxGdbWatchdogTimeout->setToolTip(labelGdbWatchdogTimeout->toolTip());
    spinBoxGdbWatchdogTimeout->setSuffix(GdbOptionsPage::tr("sec"));
    spinBoxGdbWatchdogTimeout->setLayoutDirection(Qt::LeftToRight);
    spinBoxGdbWatchdogTimeout->setMinimum(20);
    spinBoxGdbWatchdogTimeout->setMaximum(1000000);
    spinBoxGdbWatchdogTimeout->setSingleStep(20);
    spinBoxGdbWatchdogTimeout->setValue(20);

hjk's avatar
hjk committed
104
    auto checkBoxSkipKnownFrames = new QCheckBox(groupBoxGeneral);
hjk's avatar
hjk committed
105 106 107 108 109 110 111 112
    checkBoxSkipKnownFrames->setText(GdbOptionsPage::tr("Skip known frames when stepping"));
    checkBoxSkipKnownFrames->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body><p>"
        "Allows <i>Step Into</i> to compress several steps into one step\n"
        "for less noisy debugging. For example, the atomic reference\n"
        "counting code is skipped, and a single <i>Step Into</i> for a signal\n"
        "emission ends up directly in the slot connected to it."));

hjk's avatar
hjk committed
113
    auto checkBoxUseMessageBoxForSignals = new QCheckBox(groupBoxGeneral);
hjk's avatar
hjk committed
114 115 116
    checkBoxUseMessageBoxForSignals->setText(GdbOptionsPage::tr(
        "Show a message box when receiving a signal"));
    checkBoxUseMessageBoxForSignals->setToolTip(GdbOptionsPage::tr(
hjk's avatar
hjk committed
117
        "Displays a message box as soon as your application\n"
hjk's avatar
hjk committed
118 119
        "receives a signal like SIGSEGV during debugging."));

hjk's avatar
hjk committed
120
    auto checkBoxAdjustBreakpointLocations = new QCheckBox(groupBoxGeneral);
hjk's avatar
hjk committed
121 122 123 124 125 126 127 128 129
    checkBoxAdjustBreakpointLocations->setText(GdbOptionsPage::tr(
        "Adjust breakpoint locations"));
    checkBoxAdjustBreakpointLocations->setToolTip(GdbOptionsPage::tr(
        "GDB allows setting breakpoints on source lines for which no code \n"
        "was generated. In such situations the breakpoint is shifted to the\n"
        "next source code line for which code was actually generated.\n"
        "This option reflects such temporary change by moving the breakpoint\n"
        "markers in the source code editor."));

hjk's avatar
hjk committed
130
    auto checkBoxUseDynamicType = new QCheckBox(groupBoxGeneral);
hjk's avatar
hjk committed
131 132 133
    checkBoxUseDynamicType->setText(GdbOptionsPage::tr(
        "Use dynamic object type for display"));
    checkBoxUseDynamicType->setToolTip(GdbOptionsPage::tr(
Jarek Kobus's avatar
Jarek Kobus committed
134
        "Specifies whether the dynamic or the static type of objects will be "
hjk's avatar
hjk committed
135 136
        "displayed. Choosing the dynamic type might be slower."));

hjk's avatar
hjk committed
137
    auto checkBoxLoadGdbInit = new QCheckBox(groupBoxGeneral);
hjk's avatar
hjk committed
138 139
    checkBoxLoadGdbInit->setText(GdbOptionsPage::tr("Load .gdbinit file on startup"));
    checkBoxLoadGdbInit->setToolTip(GdbOptionsPage::tr(
hjk's avatar
hjk committed
140
        "Allows or inhibits reading the user's default\n"
hjk's avatar
hjk committed
141 142
        ".gdbinit file on debugger startup."));

hjk's avatar
hjk committed
143
    auto checkBoxLoadGdbDumpers = new QCheckBox(groupBoxGeneral);
144
    checkBoxLoadGdbDumpers->setText(GdbOptionsPage::tr("Load system GDB pretty printers"));
145
    checkBoxLoadGdbDumpers->setToolTip(GdbOptionsPage::tr(
146
        "Uses the default GDB pretty printers installed in your "
Jarek Kobus's avatar
Jarek Kobus committed
147
        "system or linked to the libraries your application uses."));
148

hjk's avatar
hjk committed
149
    auto checkBoxIntelFlavor = new QCheckBox(groupBoxGeneral);
150 151 152 153 154
    checkBoxIntelFlavor->setText(GdbOptionsPage::tr("Use Intel style disassembly"));
    checkBoxIntelFlavor->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body>GDB shows by default AT&&T style disassembly."
        "</body></html>"));

hjk's avatar
hjk committed
155
    auto checkBoxIdentifyDebugInfoPackages = new QCheckBox(groupBoxGeneral);
156 157
    checkBoxIdentifyDebugInfoPackages->setText(GdbOptionsPage::tr("Create tasks from missing packages"));
    checkBoxIdentifyDebugInfoPackages->setToolTip(GdbOptionsPage::tr(
158 159
        "<html><head/><body><p>Attempts to identify missing debug info packages "
        "and lists them in the Issues output pane.</p><p>"
Robert Loehning's avatar
Robert Loehning committed
160 161
        "<b>Note:</b> This feature needs special support from the Linux "
        "distribution and GDB build and is not available everywhere.</p></body></html>"));
162

163
    QString howToUsePython = GdbOptionsPage::tr(
164 165 166 167 168
        "<p>To execute simple Python commands, prefix them with \"python\".</p>"
        "<p>To execute sequences of Python commands spanning multiple lines "
        "prepend the block with \"python\" on a separate line, and append "
        "\"end\" on a separate line.</p>"
        "<p>To execute arbitrary Python scripts, "
169 170
        "use <i>python execfile('/path/to/script.py')</i>.</p>");

hjk's avatar
hjk committed
171
    auto groupBoxStartupCommands = new QGroupBox(this);
172 173 174 175 176
    groupBoxStartupCommands->setTitle(GdbOptionsPage::tr("Additional Startup Commands"));
    groupBoxStartupCommands->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body><p>GDB commands entered here will be executed after "
        "GDB has been started, but before the debugged program is started or "
        "attached, and before the debugging helpers are initialized.</p>%1"
Friedemann Kleint's avatar
Friedemann Kleint committed
177
        "</body></html>").arg(howToUsePython));
hjk's avatar
hjk committed
178

hjk's avatar
hjk committed
179
    auto textEditStartupCommands = new QTextEdit(groupBoxStartupCommands);
hjk's avatar
hjk committed
180 181 182
    textEditStartupCommands->setAcceptRichText(false);
    textEditStartupCommands->setToolTip(groupBoxStartupCommands->toolTip());

hjk's avatar
hjk committed
183
    auto groupBoxPostAttachCommands = new QGroupBox(this);
184 185 186 187 188 189 190 191
    groupBoxPostAttachCommands->setTitle(GdbOptionsPage::tr("Additional Attach Commands"));
    groupBoxPostAttachCommands->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body><p>GDB commands entered here will be executed after "
        "GDB has successfully attached to remote targets.</p>"
        "<p>You can add commands to further set up the target here, "
        "such as \"monitor reset\" or \"load\"."
        "</body></html>"));

hjk's avatar
hjk committed
192
    auto textEditPostAttachCommands = new QTextEdit(groupBoxPostAttachCommands);
193 194 195
    textEditPostAttachCommands->setAcceptRichText(false);
    textEditPostAttachCommands->setToolTip(groupBoxPostAttachCommands->toolTip());

hjk's avatar
hjk committed
196
    auto groupBoxCustomDumperCommands = new QGroupBox(this);
197 198 199 200 201 202 203
    groupBoxCustomDumperCommands->setTitle(GdbOptionsPage::tr("Debugging Helper Customization"));
    groupBoxCustomDumperCommands->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body><p>GDB commands entered here will be executed after "
        "Qt Creator's debugging helpers have been loaded and fully initialized. "
        "You can load additional debugging helpers or modify existing ones here.</p>"
        "%1</body></html>").arg(howToUsePython));

hjk's avatar
hjk committed
204
    auto textEditCustomDumperCommands = new QTextEdit(groupBoxCustomDumperCommands);
205
    textEditCustomDumperCommands->setAcceptRichText(false);
206
    textEditCustomDumperCommands->setToolTip(groupBoxCustomDumperCommands->toolTip());
207

hjk's avatar
hjk committed
208 209 210
    auto groupBoxExtraDumperFile = new QGroupBox(this);
    groupBoxExtraDumperFile->setTitle(GdbOptionsPage::tr("Extra Debugging Helpers"));
    groupBoxExtraDumperFile->setToolTip(GdbOptionsPage::tr(
211 212
        "Path to a Python file containing additional data dumpers."));

hjk's avatar
hjk committed
213 214 215
    auto pathChooserExtraDumperFile = new Utils::PathChooser(groupBoxExtraDumperFile);
    pathChooserExtraDumperFile->setExpectedKind(Utils::PathChooser::File);

hjk's avatar
hjk committed
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
    /*
    groupBoxPluginDebugging = new QGroupBox(q);
    groupBoxPluginDebugging->setTitle(GdbOptionsPage::tr(
        "Behavior of Breakpoint Setting in Plugins"));

    radioButtonAllPluginBreakpoints = new QRadioButton(groupBoxPluginDebugging);
    radioButtonAllPluginBreakpoints->setText(GdbOptionsPage::tr(
        "Always try to set breakpoints in plugins automatically"));
    radioButtonAllPluginBreakpoints->setToolTip(GdbOptionsPage::tr(
        "This is the slowest but safest option."));

    radioButtonSelectedPluginBreakpoints = new QRadioButton(groupBoxPluginDebugging);
    radioButtonSelectedPluginBreakpoints->setText(GdbOptionsPage::tr(
        "Try to set breakpoints in selected plugins"));

    radioButtonNoPluginBreakpoints = new QRadioButton(groupBoxPluginDebugging);
    radioButtonNoPluginBreakpoints->setText(GdbOptionsPage::tr(
        "Never set breakpoints in plugins automatically"));

    lineEditSelectedPluginBreakpointsPattern = new QLineEdit(groupBoxPluginDebugging);

    labelSelectedPluginBreakpoints = new QLabel(groupBoxPluginDebugging);
    labelSelectedPluginBreakpoints->setText(GdbOptionsPage::tr(
        "Matching regular expression: "));
    */

hjk's avatar
hjk committed
242 243 244 245 246
    auto chooser = new VariableChooser(this);
    chooser->addSupportedWidget(textEditCustomDumperCommands);
    chooser->addSupportedWidget(textEditPostAttachCommands);
    chooser->addSupportedWidget(textEditStartupCommands);
    chooser->addSupportedWidget(pathChooserExtraDumperFile->lineEdit());
247

hjk's avatar
hjk committed
248
    auto formLayout = new QFormLayout(groupBoxGeneral);
hjk's avatar
hjk committed
249 250 251 252 253 254
    formLayout->addRow(labelGdbWatchdogTimeout, spinBoxGdbWatchdogTimeout);
    formLayout->addRow(checkBoxSkipKnownFrames);
    formLayout->addRow(checkBoxUseMessageBoxForSignals);
    formLayout->addRow(checkBoxAdjustBreakpointLocations);
    formLayout->addRow(checkBoxUseDynamicType);
    formLayout->addRow(checkBoxLoadGdbInit);
255
    formLayout->addRow(checkBoxLoadGdbDumpers);
256
    formLayout->addRow(checkBoxIntelFlavor);
257
    formLayout->addRow(checkBoxIdentifyDebugInfoPackages);
hjk's avatar
hjk committed
258

hjk's avatar
hjk committed
259
    auto startLayout = new QGridLayout(groupBoxStartupCommands);
hjk's avatar
hjk committed
260 261
    startLayout->addWidget(textEditStartupCommands, 0, 0, 1, 1);

hjk's avatar
hjk committed
262
    auto postAttachLayout = new QGridLayout(groupBoxPostAttachCommands);
263 264
    postAttachLayout->addWidget(textEditPostAttachCommands, 0, 0, 1, 1);

hjk's avatar
hjk committed
265 266
    auto customDumperLayout = new QGridLayout(groupBoxCustomDumperCommands);
    customDumperLayout->addWidget(textEditCustomDumperCommands, 0, 0, 1, 1);
hjk's avatar
hjk committed
267

hjk's avatar
hjk committed
268 269
    auto extraDumperLayout = new QGridLayout(groupBoxExtraDumperFile);
    extraDumperLayout->addWidget(pathChooserExtraDumperFile, 0, 0, 1, 1);
hjk's avatar
hjk committed
270

hjk's avatar
hjk committed
271 272 273
    auto gridLayout = new QGridLayout(this);
    gridLayout->addWidget(groupBoxGeneral, 0, 0, 5, 1);
    gridLayout->addWidget(groupBoxExtraDumperFile, 5, 0, 1, 1);
hjk's avatar
hjk committed
274

hjk's avatar
hjk committed
275 276 277
    gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 2, 1);
    gridLayout->addWidget(groupBoxPostAttachCommands, 2, 1, 2, 1);
    gridLayout->addWidget(groupBoxCustomDumperCommands, 4, 1, 2, 1);
hjk's avatar
hjk committed
278

hjk's avatar
hjk committed
279 280 281 282 283 284 285 286 287 288 289 290 291
    group.insert(action(GdbStartupCommands), textEditStartupCommands);
    group.insert(action(ExtraDumperFile), pathChooserExtraDumperFile);
    group.insert(action(ExtraDumperCommands), textEditCustomDumperCommands);
    group.insert(action(GdbPostAttachCommands), textEditPostAttachCommands);
    group.insert(action(LoadGdbInit), checkBoxLoadGdbInit);
    group.insert(action(LoadGdbDumpers), checkBoxLoadGdbDumpers);
    group.insert(action(UseDynamicType), checkBoxUseDynamicType);
    group.insert(action(AdjustBreakpointLocations), checkBoxAdjustBreakpointLocations);
    group.insert(action(GdbWatchdogTimeout), spinBoxGdbWatchdogTimeout);
    group.insert(action(IntelFlavor), checkBoxIntelFlavor);
    group.insert(action(IdentifyDebugInfoPackages), checkBoxIdentifyDebugInfoPackages);
    group.insert(action(UseMessageBoxForSignals), checkBoxUseMessageBoxForSignals);
    group.insert(action(SkipKnownFrames), checkBoxSkipKnownFrames);
hjk's avatar
hjk committed
292 293

    //lineEditSelectedPluginBreakpointsPattern->
hjk's avatar
hjk committed
294
    //    setEnabled(action(SelectedPluginBreakpoints)->value().toBool());
hjk's avatar
hjk committed
295 296
    //connect(radioButtonSelectedPluginBreakpoints, &QRadioButton::toggled,
    //    lineEditSelectedPluginBreakpointsPattern, &QLineEdit::setEnabled);
hjk's avatar
hjk committed
297 298
}

299
GdbOptionsPage::GdbOptionsPage()
300
{
hjk's avatar
hjk committed
301
    setId("M.Gdb");
302
    setDisplayName(tr("GDB"));
hjk's avatar
hjk committed
303
    setCategory(Constants::DEBUGGER_SETTINGS_CATEGORY);
304 305
    setDisplayCategory(QCoreApplication::translate("Debugger", Constants::DEBUGGER_SETTINGS_TR_CATEGORY));
    setCategoryIcon(QLatin1String(Constants::DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON));
306 307
}

308
QWidget *GdbOptionsPage::widget()
309
{
310 311
    if (!m_widget)
        m_widget = new GdbOptionsPageWidget;
312
    return m_widget;
313
}
hjk's avatar
hjk committed
314

315 316
void GdbOptionsPage::apply()
{
317
    if (m_widget)
318
        m_widget->group.apply(ICore::settings());
319 320 321 322
}

void GdbOptionsPage::finish()
{
323
    if (m_widget) {
324
        m_widget->group.finish();
325 326
        delete m_widget;
    }
327 328
}

329 330 331 332 333 334 335 336
/////////////////////////////////////////////////////////////////////////
//
// GdbOptionsPageWidget2 - dangerous options
//
/////////////////////////////////////////////////////////////////////////

class GdbOptionsPageWidget2 : public QWidget
{
Sergey Belyashov's avatar
Sergey Belyashov committed
337
    Q_OBJECT
338
public:
339
    GdbOptionsPageWidget2();
340 341 342 343

    Utils::SavedActionSet group;
};

344
GdbOptionsPageWidget2::GdbOptionsPageWidget2()
345
{
346
    auto groupBoxDangerous = new QGroupBox(this);
347 348
    groupBoxDangerous->setTitle(GdbOptionsPage::tr("Extended"));

349
    auto labelDangerous = new QLabel(GdbOptionsPage::tr(
350 351 352 353 354 355 356 357 358
        "The options below should be used with care."));
    labelDangerous->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body>The options below give access to advanced "
        "or experimental functions of GDB. Enabling them may negatively "
        "impact your debugging experience.</body></html>"));
    QFont f = labelDangerous->font();
    f.setItalic(true);
    labelDangerous->setFont(f);

359
    auto checkBoxTargetAsync = new QCheckBox(groupBoxDangerous);
360 361 362
    checkBoxTargetAsync->setText(GdbOptionsPage::tr(
        "Use asynchronous mode to control the inferior"));

363
    auto checkBoxAutoEnrichParameters = new QCheckBox(groupBoxDangerous);
364 365 366
    checkBoxAutoEnrichParameters->setText(GdbOptionsPage::tr(
        "Use common locations for debug information"));
    checkBoxAutoEnrichParameters->setToolTip(GdbOptionsPage::tr(
jkobus's avatar
jkobus committed
367
        "<html><head/><body>Adds common paths to locations "
368 369 370
        "of debug information such as <i>/usr/src/debug</i> "
        "when starting GDB.</body></html>"));

371 372
    // FIXME: Move to common settings page.
    auto checkBoxBreakOnWarning = new QCheckBox(groupBoxDangerous);
373 374 375
    checkBoxBreakOnWarning->setText(CommonOptionsPage::msgSetBreakpointAtFunction("qWarning"));
    checkBoxBreakOnWarning->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("qWarning"));

376
    auto checkBoxBreakOnFatal = new QCheckBox(groupBoxDangerous);
377 378 379
    checkBoxBreakOnFatal->setText(CommonOptionsPage::msgSetBreakpointAtFunction("qFatal"));
    checkBoxBreakOnFatal->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("qFatal"));

380
    auto checkBoxBreakOnAbort = new QCheckBox(groupBoxDangerous);
381 382 383
    checkBoxBreakOnAbort->setText(CommonOptionsPage::msgSetBreakpointAtFunction("abort"));
    checkBoxBreakOnAbort->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("abort"));

384
    QCheckBox *checkBoxEnableReverseDebugging = 0;
385 386 387 388 389 390 391 392 393
    if (isReverseDebuggingEnabled()) {
        checkBoxEnableReverseDebugging = new QCheckBox(groupBoxDangerous);
        checkBoxEnableReverseDebugging->setText(GdbOptionsPage::tr("Enable reverse debugging"));
        checkBoxEnableReverseDebugging->setToolTip(GdbOptionsPage::tr(
           "<html><head/><body><p>Enables stepping backwards.</p><p>"
           "<b>Note:</b> This feature is very slow and unstable on the GDB side. "
           "It exhibits unpredictable behavior when going backwards over system "
           "calls and is very likely to destroy your debugging session.</p></body></html>"));
    }
394

395
    auto checkBoxAttemptQuickStart = new QCheckBox(groupBoxDangerous);
396 397
    checkBoxAttemptQuickStart->setText(GdbOptionsPage::tr("Attempt quick start"));
    checkBoxAttemptQuickStart->setToolTip(GdbOptionsPage::tr(
jkobus's avatar
jkobus committed
398
        "<html><head/><body>Postpones reading debug information as long as possible. "
399 400 401
        "This can result in faster startup times at the price of not being able to "
        "set breakpoints by file and number.</body></html>"));

402
    auto checkBoxMultiInferior = new QCheckBox(groupBoxDangerous);
403 404
    checkBoxMultiInferior->setText(GdbOptionsPage::tr("Debug all children"));
    checkBoxMultiInferior->setToolTip(GdbOptionsPage::tr(
jkobus's avatar
jkobus committed
405
        "<html><head/><body>Keeps debugging all children after a fork."
406 407 408
        "</body></html>"));


409
    auto formLayout = new QFormLayout(groupBoxDangerous);
410 411 412 413 414 415
    formLayout->addRow(labelDangerous);
    formLayout->addRow(checkBoxTargetAsync);
    formLayout->addRow(checkBoxAutoEnrichParameters);
    formLayout->addRow(checkBoxBreakOnWarning);
    formLayout->addRow(checkBoxBreakOnFatal);
    formLayout->addRow(checkBoxBreakOnAbort);
416
    if (checkBoxEnableReverseDebugging)
417
        formLayout->addRow(checkBoxEnableReverseDebugging);
418 419 420
    formLayout->addRow(checkBoxAttemptQuickStart);
    formLayout->addRow(checkBoxMultiInferior);

421
    auto gridLayout = new QGridLayout(this);
422 423
    gridLayout->addWidget(groupBoxDangerous, 0, 0, 2, 1);

hjk's avatar
hjk committed
424 425 426 427 428 429 430
    group.insert(action(AutoEnrichParameters), checkBoxAutoEnrichParameters);
    group.insert(action(TargetAsync), checkBoxTargetAsync);
    group.insert(action(BreakOnWarning), checkBoxBreakOnWarning);
    group.insert(action(BreakOnFatal), checkBoxBreakOnFatal);
    group.insert(action(BreakOnAbort), checkBoxBreakOnAbort);
    group.insert(action(AttemptQuickStart), checkBoxAttemptQuickStart);
    group.insert(action(MultiInferior), checkBoxMultiInferior);
431
    if (checkBoxEnableReverseDebugging)
432
        group.insert(action(EnableReverseDebugging), checkBoxEnableReverseDebugging);
433 434
}

435 436 437
// The "Dangerous" options.
class GdbOptionsPage2 : public Core::IOptionsPage
{
Sergey Belyashov's avatar
Sergey Belyashov committed
438
    Q_OBJECT
439 440 441 442 443 444 445 446 447 448 449
public:
    GdbOptionsPage2();

    QWidget *widget();
    void apply();
    void finish();

private:
    QPointer<GdbOptionsPageWidget2> m_widget;
};

450 451 452 453 454 455 456 457 458
GdbOptionsPage2::GdbOptionsPage2()
{
    setId("M.Gdb2");
    setDisplayName(tr("GDB Extended"));
    setCategory(Constants::DEBUGGER_SETTINGS_CATEGORY);
    setDisplayCategory(QCoreApplication::translate("Debugger", Constants::DEBUGGER_SETTINGS_TR_CATEGORY));
    setCategoryIcon(QLatin1String(Constants::DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON));
}

459
QWidget *GdbOptionsPage2::widget()
460
{
461 462
    if (!m_widget)
        m_widget = new GdbOptionsPageWidget2;
463 464 465 466 467 468
    return m_widget;
}

void GdbOptionsPage2::apply()
{
    if (m_widget)
469
        m_widget->group.apply(ICore::settings());
470 471 472 473
}

void GdbOptionsPage2::finish()
{
474
    if (m_widget) {
475
        m_widget->group.finish();
476 477
        delete m_widget;
    }
478 479
}

480 481 482 483 484 485 486 487
// Registration

void addGdbOptionPages(QList<IOptionsPage *> *opts)
{
    opts->push_back(new GdbOptionsPage);
    opts->push_back(new GdbOptionsPage2);
}

488 489
} // namespace Internal
} // namespace Debugger
Sergey Belyashov's avatar
Sergey Belyashov committed
490 491

#include "gdboptionspage.moc"