aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/debugger
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2020-02-21 18:37:30 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2020-02-21 16:07:40 +0000
commitb858e58d3f223c7e04756bd24415a9d66a63912c (patch)
treef11411dbcbab8e7929a005a1d19aca46444e2ebc /src/plugins/debugger
parentaf9f703dc37be1fefa6c4b105e4076693ac4dfff (diff)
Debugger: Allow to specify 'init' and 'reset' GDB commands
... in case the attaching to the remote running GDB server. We need in this option for the bare-metal programming, because the 'Attach to Running Debug Server' option should cover functionality of the removed 'Default' GDB server provider. Without of this option the debugging is non-functional in a most cases. Change-Id: I77a37552b2c7c2e76d70dbecfe9e21f316c02534 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/debugger')
-rw-r--r--src/plugins/debugger/debuggerdialogs.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp
index 599d2382a9b..313b8a7d0a1 100644
--- a/src/plugins/debugger/debuggerdialogs.cpp
+++ b/src/plugins/debugger/debuggerdialogs.cpp
@@ -49,6 +49,7 @@
#include <QFormLayout>
#include <QGroupBox>
#include <QLabel>
+#include <QPlainTextEdit>
#include <QPushButton>
#include <QRadioButton>
#include <QRegExp>
@@ -85,6 +86,8 @@ public:
PathChooser *debuginfoPathChooser;
QLabel *serverStartScriptLabel;
PathChooser *serverStartScriptPathChooser;
+ QPlainTextEdit *serverInitCommandsTextEdit;
+ QPlainTextEdit *serverResetCommandsTextEdit;
QComboBox *historyComboBox;
QDialogButtonBox *buttonBox;
};
@@ -121,6 +124,8 @@ public:
bool breakAtMain = false;
bool runInTerminal = false;
FilePath serverStartScript;
+ QString serverInitCommands;
+ QString serverResetCommands;
QString debugInfoLocation;
};
@@ -133,6 +138,8 @@ bool StartApplicationParameters::equals(const StartApplicationParameters &rhs) c
&& breakAtMain == rhs.breakAtMain
&& runInTerminal == rhs.runInTerminal
&& serverStartScript == rhs.serverStartScript
+ && serverInitCommands == rhs.serverInitCommands
+ && serverResetCommands == rhs.serverResetCommands
&& kitId == rhs.kitId
&& debugInfoLocation == rhs.debugInfoLocation
&& serverAddress == rhs.serverAddress;
@@ -169,6 +176,8 @@ void StartApplicationParameters::toSettings(QSettings *settings) const
settings->setValue("LastExternalBreakAtMain", breakAtMain);
settings->setValue("LastExternalRunInTerminal", runInTerminal);
settings->setValue("LastServerStartScript", serverStartScript.toVariant());
+ settings->setValue("LastServerInitCommands", serverInitCommands);
+ settings->setValue("LastServerResetCommands", serverResetCommands);
settings->setValue("LastDebugInfoLocation", debugInfoLocation);
}
@@ -183,6 +192,8 @@ void StartApplicationParameters::fromSettings(const QSettings *settings)
breakAtMain = settings->value("LastExternalBreakAtMain").toBool();
runInTerminal = settings->value("LastExternalRunInTerminal").toBool();
serverStartScript = FilePath::fromVariant(settings->value("LastServerStartScript"));
+ serverInitCommands = settings->value("LastServerInitCommands").toString();
+ serverResetCommands = settings->value("LastServerResetCommands").toString();
debugInfoLocation = settings->value("LastDebugInfoLocation").toString();
}
@@ -247,6 +258,14 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
d->serverStartScriptLabel->setBuddy(d->serverStartScriptPathChooser);
d->serverStartScriptLabel->setToolTip(d->serverStartScriptPathChooser->toolTip());
+ d->serverInitCommandsTextEdit = new QPlainTextEdit(this);
+ d->serverInitCommandsTextEdit->setToolTip(tr(
+ "This option can be used to send the target init commands."));
+
+ d->serverResetCommandsTextEdit = new QPlainTextEdit(this);
+ d->serverResetCommandsTextEdit->setToolTip(tr(
+ "This option can be used to send the target reset commands."));
+
d->debuginfoPathChooser = new PathChooser(this);
d->debuginfoPathChooser->setPromptDialogTitle(tr("Select Location of Debugging Information"));
d->debuginfoPathChooser->setToolTip(tr(
@@ -278,6 +297,8 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
formLayout->addRow(tr("Run in &terminal:"), d->runInTerminalCheckBox);
formLayout->addRow(tr("Break at \"&main\":"), d->breakAtMainCheckBox);
formLayout->addRow(d->serverStartScriptLabel, d->serverStartScriptPathChooser);
+ formLayout->addRow(tr("&Init commands:"), d->serverInitCommandsTextEdit);
+ formLayout->addRow(tr("&Reset commands:"), d->serverResetCommandsTextEdit);
formLayout->addRow(tr("Debug &information:"), d->debuginfoPathChooser);
formLayout->addRow(d->channelOverrideHintLabel);
formLayout->addRow(d->channelOverrideLabel, d->channelOverrideEdit);
@@ -366,6 +387,8 @@ void StartApplicationDialog::run(bool attachRemote)
if (!attachRemote) {
dialog.d->serverStartScriptPathChooser->setVisible(false);
dialog.d->serverStartScriptLabel->setVisible(false);
+ dialog.d->serverInitCommandsTextEdit->setVisible(false);
+ dialog.d->serverResetCommandsTextEdit->setVisible(false);
dialog.d->serverPortSpinBox->setVisible(false);
dialog.d->serverPortLabel->setVisible(false);
dialog.d->channelOverrideHintLabel->setVisible(false);
@@ -408,6 +431,8 @@ void StartApplicationDialog::run(bool attachRemote)
debugger->setDebugInfoLocation(newParameters.debugInfoLocation);
debugger->setInferior(inferior);
debugger->setServerStartScript(newParameters.serverStartScript); // Note: This requires inferior.
+ debugger->setCommandsAfterConnect(newParameters.serverInitCommands);
+ debugger->setCommandsForReset(newParameters.serverResetCommands);
debugger->setUseTerminal(newParameters.runInTerminal);
bool isLocal = !dev || (dev->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
@@ -445,6 +470,8 @@ StartApplicationParameters StartApplicationDialog::parameters() const
result.serverAddress = d->channelOverrideEdit->text();
result.runnable.executable = d->localExecutablePathChooser->fileName();
result.serverStartScript = d->serverStartScriptPathChooser->fileName();
+ result.serverInitCommands = d->serverInitCommandsTextEdit->toPlainText();
+ result.serverResetCommands = d->serverResetCommandsTextEdit->toPlainText();
result.kitId = d->kitChooser->currentKitId();
result.debugInfoLocation = d->debuginfoPathChooser->path();
result.runnable.commandLineArguments = d->arguments->text();
@@ -461,6 +488,8 @@ void StartApplicationDialog::setParameters(const StartApplicationParameters &p)
d->channelOverrideEdit->setText(p.serverAddress);
d->localExecutablePathChooser->setFileName(p.runnable.executable);
d->serverStartScriptPathChooser->setFileName(p.serverStartScript);
+ d->serverInitCommandsTextEdit->setPlainText(p.serverInitCommands);
+ d->serverResetCommandsTextEdit->setPlainText(p.serverResetCommands);
d->debuginfoPathChooser->setPath(p.debugInfoLocation);
d->arguments->setText(p.runnable.commandLineArguments);
d->workingDirectory->setPath(p.runnable.workingDirectory);