Commit 38f9169e authored by hjk's avatar hjk

Debugger: allow user commands after attaching to a remote target

Change-Id: I365f34a8ddc6d895bb3fcb09bd991b24108d922b
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 19e92773
......@@ -396,6 +396,11 @@ DebuggerSettings::DebuggerSettings(QSettings *settings)
item->setDefaultValue(QString());
insertItem(GdbStartupCommands, item);
item = new SavedAction(this);
item->setSettingsKey(debugModeGroup, QLatin1String("GdbPostAttachCommands"));
item->setDefaultValue(QString());
insertItem(GdbPostAttachCommands, item);
item = new SavedAction(this);
item->setSettingsKey(debugModeGroup, QLatin1String("CloseBuffersOnExit"));
item->setCheckable(true);
......
......@@ -119,6 +119,7 @@ enum DebuggerActionCode
LoadGdbInit,
AttemptQuickStart,
GdbStartupCommands,
GdbPostAttachCommands,
GdbWatchdogTimeout,
AutoEnrichParameters,
UseDynamicType,
......
......@@ -79,6 +79,8 @@ public:
QGroupBox *groupBoxStartupCommands;
QTextEdit *textEditStartupCommands;
QGroupBox *groupBoxPostAttachCommands;
QTextEdit *textEditPostAttachCommands;
//QGroupBox *groupBoxPluginDebugging;
//QRadioButton *radioButtonAllPluginBreakpoints;
......@@ -221,6 +223,19 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
textEditStartupCommands->setAcceptRichText(false);
textEditStartupCommands->setToolTip(groupBoxStartupCommands->toolTip());
groupBoxPostAttachCommands = new QGroupBox(this);
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>"));
textEditPostAttachCommands = new QTextEdit(groupBoxPostAttachCommands);
textEditPostAttachCommands->setAcceptRichText(false);
textEditPostAttachCommands->setToolTip(groupBoxPostAttachCommands->toolTip());
/*
groupBoxPluginDebugging = new QGroupBox(q);
groupBoxPluginDebugging->setTitle(GdbOptionsPage::tr(
......@@ -268,14 +283,18 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
QGridLayout *startLayout = new QGridLayout(groupBoxStartupCommands);
startLayout->addWidget(textEditStartupCommands, 0, 0, 1, 1);
QGridLayout *postAttachLayout = new QGridLayout(groupBoxPostAttachCommands);
postAttachLayout->addWidget(textEditPostAttachCommands, 0, 0, 1, 1);
//QHBoxLayout *horizontalLayout = new QHBoxLayout();
//horizontalLayout->addItem(new QSpacerItem(10, 10, QSizePolicy::Preferred, QSizePolicy::Minimum));
//horizontalLayout->addWidget(labelSelectedPluginBreakpoints);
//horizontalLayout->addWidget(lineEditSelectedPluginBreakpointsPattern);
QGridLayout *gridLayout = new QGridLayout(this);
gridLayout->addWidget(groupBoxGeneral, 0, 0);
gridLayout->addWidget(groupBoxStartupCommands, 0, 1);
gridLayout->addWidget(groupBoxGeneral, 0, 0, 2, 1);
gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 1, 1);
gridLayout->addWidget(groupBoxPostAttachCommands, 1, 1, 1, 1);
//gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 1, 1);
//gridLayout->addWidget(radioButtonAllPluginBreakpoints, 0, 0, 1, 1);
......@@ -287,6 +306,7 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
DebuggerCore *dc = debuggerCore();
group.insert(dc->action(GdbStartupCommands), textEditStartupCommands);
group.insert(dc->action(GdbPostAttachCommands), textEditPostAttachCommands);
group.insert(dc->action(LoadGdbInit), checkBoxLoadGdbInit);
group.insert(dc->action(AutoEnrichParameters), checkBoxAutoEnrichParameters);
group.insert(dc->action(UseDynamicType), checkBoxUseDynamicType);
......
......@@ -282,6 +282,11 @@ void GdbRemoteServerEngine::handleTargetRemote(const GdbResponse &record)
// gdb server will stop the remote application itself.
showMessage(_("INFERIOR STARTED"));
showMessage(msgAttachedToStoppedInferior(), StatusBar);
QString postAttachCommands = debuggerCore()->stringSetting(GdbPostAttachCommands);
if (!postAttachCommands.isEmpty()) {
foreach (const QString &cmd, postAttachCommands.split(QLatin1Char('\n')))
postCommand(cmd.toLatin1());
}
handleInferiorPrepared();
} else {
// 16^error,msg="hd:5555: Connection timed out."
......
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