Commit b7b8c47b authored by Tim Sander's avatar Tim Sander Committed by hjk

BareMetal: add variable support for device gdb commands

Change-Id: I192ccf4dc7a2599ead1fcdd11a4d59f0e22e3e1d
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 9ed5e808
......@@ -32,6 +32,7 @@
#include "ui_baremetaldeviceconfigurationwidget.h"
#include "baremetaldevice.h"
#include <coreplugin/variablechooser.h>
#include <ssh/sshconnection.h>
#include <utils/qtcassert.h>
#include <QLabel>
......@@ -49,6 +50,8 @@ BareMetalDeviceConfigurationWidget::BareMetalDeviceConfigurationWidget(
connect(m_ui->gdbHostLineEdit, SIGNAL(editingFinished()), SLOT(hostnameChanged()));
connect(m_ui->gdbPortSpinBox, SIGNAL(valueChanged(int)), SLOT(portChanged()));
connect(m_ui->gdbCommandsTextEdit, SIGNAL(textChanged()), SLOT(gdbInitCommandsChanged()));
Core::VariableChooser::addVariableSupport(m_ui->gdbCommandsTextEdit);
new Core::VariableChooser(this);
initGui();
}
......
......@@ -30,6 +30,7 @@
#include "baremetaldeviceconfigurationwizardpages.h"
#include "ui_baremetaldeviceconfigurationwizardsetuppage.h"
#include <coreplugin/variablechooser.h>
#include <projectexplorer/devicesupport/idevice.h>
namespace BareMetal {
......@@ -43,10 +44,12 @@ BareMetalDeviceConfigurationWizardSetupPage::BareMetalDeviceConfigurationWizardS
d->ui.setupUi(this);
setTitle(tr("Set up GDB Server or Hardware Debugger"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
connect(d->ui.hostNameLineEdit,SIGNAL(textChanged(QString)),SIGNAL(completeChanged()));
connect(d->ui.nameLineEdit,SIGNAL(textChanged(QString)),SIGNAL(completeChanged()));
connect(d->ui.portSpinBox,SIGNAL(valueChanged(int)),SIGNAL(completeChanged()));
connect(d->ui.gdbInitCommandsPlainTextEdit,SIGNAL(textChanged()),SIGNAL(completeChanged()));
connect(d->ui.hostNameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
connect(d->ui.nameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
connect(d->ui.portSpinBox, SIGNAL(valueChanged(int)), SIGNAL(completeChanged()));
connect(d->ui.gdbInitCommandsPlainTextEdit, SIGNAL(textChanged()), SIGNAL(completeChanged()));
Core::VariableChooser::addVariableSupport(d->ui.gdbInitCommandsPlainTextEdit);
new Core::VariableChooser(this);
}
BareMetalDeviceConfigurationWizardSetupPage::~BareMetalDeviceConfigurationWizardSetupPage()
......
......@@ -71,8 +71,11 @@
<item row="7" column="1">
<widget class="QPlainTextEdit" name="gdbInitCommandsPlainTextEdit">
<property name="plainText">
<string>load
monitor reset</string>
<string>set remote hardware-breakpoint-limit 6
set remote hardware-watchpoint-limit 4
monitor reset halt
load
monitor reset halt</string>
</property>
</widget>
</item>
......
......@@ -64,6 +64,8 @@ const char QML_UPDATE_ON_SAVE[] = "Debugger.QmlUpdateOnSave";
const char QML_SELECTTOOL[] = "Debugger.QmlSelectTool";
const char QML_ZOOMTOOL[] = "Debugger.QmlZoomTool";
// VariableManager Prefix
const char PrefixDebugExecutable[] = "DebuggedExecutable";
const char TASK_CATEGORY_DEBUGGER_DEBUGINFO[] = "Debuginfo";
const char TASK_CATEGORY_DEBUGGER_RUNTIME[] = "DebugRuntime";
......
......@@ -172,6 +172,11 @@ public:
connect(&m_locationTimer, SIGNAL(timeout()), SLOT(resetLocation()));
connect(debuggerCore()->action(IntelFlavor), SIGNAL(valueChanged(QVariant)),
SLOT(reloadDisassembly()));
Core::VariableManager::registerFileVariables(Constants::PrefixDebugExecutable,
tr("Debugged executable"));
connect(Core::VariableManager::instance(),
SIGNAL(variableUpdateRequested(QByteArray)),
SLOT(updateVariable(QByteArray)));
}
public slots:
......@@ -183,6 +188,13 @@ public slots:
void doInterruptInferior();
void doFinishDebugger();
void updateVariable(QByteArray variable) {
if (Core::VariableManager::isFileVariable(variable, Constants::PrefixDebugExecutable)) {
VariableManager::insert(variable, Core::VariableManager::fileVariableValue(variable,
Constants::PrefixDebugExecutable, QFileInfo(m_startParameters.executable)));
}
}
void reloadDisassembly()
{
m_disassemblerAgent.reload();
......@@ -305,6 +317,7 @@ public:
bool m_isStateDebugging;
Utils::FileInProjectFinder m_fileFinder;
};
......
......@@ -34,6 +34,7 @@
#include "debuggerconstants.h"
#include "breakpoint.h" // For BreakpointModelId.
#include "threaddata.h" // For ThreadId.
#include "coreplugin/variablemanager.h"
#include <QObject>
......
......@@ -4460,7 +4460,8 @@ void GdbEngine::handleInferiorPrepared()
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
if (!sp.commandsAfterConnect.isEmpty()) {
foreach (QByteArray command, sp.commandsAfterConnect.split('\n')) {
QByteArray substitutedCommands = Core::VariableManager::expandedString(QString::fromLatin1(sp.commandsAfterConnect)).toLatin1();
foreach (QByteArray command, substitutedCommands.split('\n')) {
postCommand(command);
}
}
......
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