1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of Qt Creator.
7 **
8 ** Commercial License Usage
9 ** Licensees holding valid commercial Qt licenses may use this file in
10 ** accordance with the commercial license agreement provided with the
11 ** Software or, alternatively, in accordance with the terms contained in
12 ** a written agreement between you and The Qt Company. For licensing terms
13 ** and conditions see https://www.qt.io/terms-conditions. For further
14 ** information use the contact form at https://www.qt.io/contact-us.
15 **
16 ** GNU General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU
18 ** General Public License version 3 as published by the Free Software
19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
20 ** included in the packaging of this file. Please review the following
21 ** information to ensure the GNU General Public License requirements will
22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
23 **
24 ****************************************************************************/
25
26 #include <debugger/debuggeractions.h>
27 #include <debugger/debuggercore.h>
28 #include <debugger/debuggerinternalconstants.h>
29 #include <debugger/debuggerconstants.h>
30
31 #include <coreplugin/dialogs/ioptionspage.h>
32
33 #include <utils/layoutbuilder.h>
34
35 using namespace Core;
36 using namespace Utils;
37
38 namespace Debugger {
39 namespace Internal {
40
41 /////////////////////////////////////////////////////////////////////////
42 //
43 // GdbOptionsPage - harmless options
44 //
45 /////////////////////////////////////////////////////////////////////////
46
47 class GdbOptionsPage : public Core::IOptionsPage
48 {
49 Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::GdbOptionsPage)
50
51 public:
GdbOptionsPage()52 GdbOptionsPage()
53 {
54 setId("M.Gdb");
55 setDisplayName(tr("GDB"));
56 setCategory(Constants::DEBUGGER_SETTINGS_CATEGORY);
57 setSettings(&debuggerSettings()->page2);
58
59 setLayouter([](QWidget *w) {
60 using namespace Layouting;
61 DebuggerSettings &s = *debuggerSettings();
62
63 Group general {
64 Title { tr("General") },
65 Row { s.gdbWatchdogTimeout, Stretch() },
66 s.skipKnownFrames,
67 s.useMessageBoxForSignals,
68 s.adjustBreakpointLocations,
69 s.useDynamicType,
70 s.loadGdbInit,
71 s.loadGdbDumpers,
72 s.intelFlavor,
73 s.usePseudoTracepoints,
74 s.useIndexCache,
75 Stretch()
76 };
77
78 Column commands {
79 Group { Title { tr("Additional Startup Commands") }, s.gdbStartupCommands },
80 Group { Title { tr("Additional Attach Commands") }, s.gdbPostAttachCommands },
81 Stretch()
82 };
83
84 Row { general, commands }.attachTo(w);
85 });
86 }
87 };
88
89 /////////////////////////////////////////////////////////////////////////
90 //
91 // GdbOptionsPage2 - dangerous options
92 //
93 /////////////////////////////////////////////////////////////////////////
94
95 // The "Dangerous" options.
96 class GdbOptionsPage2 : public Core::IOptionsPage
97 {
98 public:
GdbOptionsPage2()99 GdbOptionsPage2()
100 {
101 setId("M.Gdb2");
102 setDisplayName(GdbOptionsPage::tr("GDB Extended"));
103 setCategory(Constants::DEBUGGER_SETTINGS_CATEGORY);
104 setSettings(&debuggerSettings()->page3);
105
106 setLayouter([](QWidget *w) {
107 auto labelDangerous = new QLabel("<html><head/><body><i>" +
108 GdbOptionsPage::tr("The options below give access to advanced "
109 "or experimental functions of GDB.<br>Enabling them may negatively "
110 "impact your debugging experience.") + "</i></body></html>");
111
112 using namespace Layouting;
113 DebuggerSettings &s = *debuggerSettings();
114
115 Group extended {
116 Title(GdbOptionsPage::tr("Extended")),
117 labelDangerous,
118 s.targetAsync,
119 s.autoEnrichParameters,
120 s.breakOnWarning,
121 s.breakOnFatal,
122 s.breakOnAbort,
123 s.enableReverseDebugging,
124 s.multiInferior,
125 };
126
127 Column { extended, Stretch() }.attachTo(w);
128 });
129 }
130 };
131
132 // Registration
133
addGdbOptionPages(QList<IOptionsPage * > * opts)134 void addGdbOptionPages(QList<IOptionsPage *> *opts)
135 {
136 opts->push_back(new GdbOptionsPage);
137 opts->push_back(new GdbOptionsPage2);
138 }
139
140 } // namespace Internal
141 } // namespace Debugger
142