Commit ffd05715 authored by hjk's avatar hjk Committed by hjk
Browse files

debugger: make "gdb startup script" directly editable



External files are still accessible using "source ..."

Change-Id: Icbf27302ef55b9061b69a9274cb7088798adf73d
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 47747630
......@@ -365,9 +365,9 @@ DebuggerSettings::DebuggerSettings(QSettings *settings)
insertItem(TargetAsync, item);
item = new SavedAction(this);
item->setSettingsKey(debugModeGroup, QLatin1String("ScriptFile"));
item->setSettingsKey(debugModeGroup, QLatin1String("GdbStartupCommands"));
item->setDefaultValue(QString());
insertItem(GdbScriptFile, item);
insertItem(GdbStartupCommands, item);
item = new SavedAction(this);
item->setSettingsKey(debugModeGroup, QLatin1String("CloseBuffersOnExit"));
......
......@@ -117,7 +117,7 @@ enum DebuggerActionCode
// Gdb
LoadGdbInit,
GdbScriptFile,
GdbStartupCommands,
GdbWatchdogTimeout,
AutoEnrichParameters,
TargetAsync,
......
......@@ -4666,12 +4666,10 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &settingsIdHint)
loadPythonDumpers();
QString scriptFileName = sp.overrideStartScript;
if (scriptFileName.isEmpty())
scriptFileName = debuggerCore()->stringSetting(GdbScriptFile);
if (!scriptFileName.isEmpty()) {
if (QFileInfo(scriptFileName).isReadable()) {
postCommand("source " + scriptFileName.toLocal8Bit());
const QString script = sp.overrideStartScript;
if (!script.isEmpty()) {
if (QFileInfo(script).isReadable()) {
postCommand("source " + script.toLocal8Bit());
// Re-do the setup, as the "source" might have changed something.
postCommand("bbsetup", ConsoleCommand, CB(handleHasPython));
} else {
......@@ -4680,7 +4678,14 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &settingsIdHint)
tr("The debugger settings point to a script file at '%1' "
"which is not accessible. If a script file is not needed, "
"consider clearing that entry to avoid this warning. "
).arg(scriptFileName));
).arg(script));
}
} else {
const QString commands = debuggerCore()->stringSetting(GdbStartupCommands);
if (!commands.isEmpty()) {
postCommand(commands.toLocal8Bit());
// Re-do the setup, as the "source" might have changed something.
postCommand("bbsetup", ConsoleCommand, CB(handleHasPython));
}
}
......
......@@ -81,13 +81,9 @@ QWidget *GdbOptionsPage::createPage(QWidget *parent)
m_ui = new Ui::GdbOptionsPage;
m_ui->setupUi(w);
m_ui->scriptFileChooser->setExpectedKind(Utils::PathChooser::File);
m_ui->scriptFileChooser->setPromptDialogTitle(
tr("Choose Location of Startup Script File"));
m_group.clear();
m_group.insert(debuggerCore()->action(GdbScriptFile),
m_ui->scriptFileChooser);
m_group.insert(debuggerCore()->action(GdbStartupCommands),
m_ui->textEditStartupCommands);
m_group.insert(debuggerCore()->action(LoadGdbInit),
m_ui->checkBoxLoadGdbInit);
m_group.insert(debuggerCore()->action(AutoEnrichParameters),
......@@ -124,7 +120,6 @@ QWidget *GdbOptionsPage::createPage(QWidget *parent)
<< sep << m_ui->groupBoxLocations->title()
<< sep << m_ui->checkBoxLoadGdbInit->text()
<< sep << m_ui->checkBoxTargetAsync->text()
<< sep << m_ui->labelGdbStartupScript->text()
<< sep << m_ui->labelGdbWatchdogTimeout->text()
<< sep << m_ui->checkBoxEnableReverseDebugging->text()
<< sep << m_ui->checkBoxSkipKnownFrames->text()
......@@ -134,8 +129,7 @@ QWidget *GdbOptionsPage::createPage(QWidget *parent)
<< sep << m_ui->radioButtonAllPluginBreakpoints->text()
<< sep << m_ui->radioButtonSelectedPluginBreakpoints->text()
<< sep << m_ui->labelSelectedPluginBreakpoints->text()
<< sep << m_ui->radioButtonNoPluginBreakpoints->text()
;
<< sep << m_ui->radioButtonNoPluginBreakpoints->text();
m_searchKeywords.remove(QLatin1Char('&'));
}
......
......@@ -2,39 +2,22 @@
<ui version="4.0">
<class>GdbOptionsPage</class>
<widget class="QWidget" name="GdbOptionsPage">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>673</width>
<height>474</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBoxLocations">
<property name="title">
<string>GDB</string>
<string>General</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelGdbStartupScript">
<property name="toolTip">
<string>This is either empty or points to a file containing GDB commands that will be executed immediately after GDB starts up.</string>
</property>
<property name="text">
<string>GDB startup script:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="scriptFileChooser"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelGdbWatchdogTimeout">
<property name="toolTip">
<string>This is the number of seconds Qt Creator will wait before
......@@ -48,7 +31,7 @@ on slow machines. In this case, the value should be increased.</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="1">
<widget class="QSpinBox" name="spinBoxGdbWatchdogTimeout">
<property name="toolTip">
<string>This is the number of seconds Qt Creator will wait before
......@@ -60,6 +43,9 @@ on slow machines. In this case, the value should be increased.</string>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="suffix">
<string>sec</string>
</property>
<property name="minimum">
<number>20</number>
</property>
......@@ -74,7 +60,7 @@ on slow machines. In this case, the value should be increased.</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxSkipKnownFrames">
<property name="toolTip">
<string>Allows 'Step Into' to compress several steps into one step for less noisy debugging. For example, the atomic reference
......@@ -85,7 +71,7 @@ on slow machines. In this case, the value should be increased.</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxUseMessageBoxForSignals">
<property name="toolTip">
<string>This will show a message box as soon as your application receives a signal like SIGSEGV during debugging.</string>
......@@ -95,7 +81,7 @@ on slow machines. In this case, the value should be increased.</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxAdjustBreakpointLocations">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;/body&gt;&lt;p&gt;GDB allows setting breakpoints on source lines for which no code was generated. In such situations the breakpoint is shifted to the next source code line for which code was actually generated. This option reflects such temporary change by moving the breakpoint markers in the source code editor.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
......@@ -105,7 +91,7 @@ on slow machines. In this case, the value should be increased.</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxLoadGdbInit">
<property name="toolTip">
<string>This allows or inhibits reading the user's default .gdbinit file on debugger startup.</string>
......@@ -115,38 +101,38 @@ on slow machines. In this case, the value should be increased.</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxTargetAsync">
<property name="text">
<string>Use asynchronous mode to control the inferior</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxAutoEnrichParameters">
<property name="toolTip">
<string>This adds common paths to locations of debug information at debugger startup.</string>
</property>
<property name="text">
<string>Use common locations for debug information automatically</string>
<string>Use common locations for debug information</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<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="9" column="0" colspan="2">
<item row="8" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxBreakOnFatal">
<property name="text">
<string>Stop when a qFatal is issued</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<item row="9" 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 behavior 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>
......@@ -159,7 +145,19 @@ on slow machines. In this case, the value should be increased.</string>
</layout>
</widget>
</item>
<item>
<item row="0" column="1">
<widget class="QGroupBox" name="groupBoxStartupCommands">
<property name="title">
<string>Additional Startup Commands</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QTextEdit" name="textEditStartupCommands"/>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="groupBoxPluginDebugging">
<property name="title">
<string>Behavior of Breakpoint Setting in Plugins</string>
......@@ -222,32 +220,8 @@ on slow machines. In this case, the value should be increased.</string>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment