forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user