Commit 214d998b authored by hjk's avatar hjk
Browse files

debugger: let debugger console directly communicate with TRK

parent b5706d77
......@@ -133,8 +133,7 @@ TrkGdbAdapter::TrkGdbAdapter(GdbEngine *engine, const TrkOptionsPtr &options) :
connect(&m_trkDevice, SIGNAL(error(QString)),
this, SLOT(handleTrkError(QString)));
if (m_verbose > 1)
m_trkDevice.setVerbose(true);
m_trkDevice.setVerbose(m_verbose);
m_trkDevice.setSerialFrame(m_options->mode != TrkOptions::BlueTooth);
connect(&m_trkDevice, SIGNAL(logMessage(QString)),
......@@ -1202,7 +1201,7 @@ void TrkGdbAdapter::handleReadMemoryUnbuffered(const TrkResult &result)
void TrkGdbAdapter::handleStepInto(const TrkResult &result)
{
if (result.errorCode()) {
logMessage("ERROR: " + result.errorString() + "in handleStepInto");
logMessage("ERROR: " + result.errorString() + " in handleStepInto");
// Try fallback with Step Over
QByteArray ba = trkStepRangeMessage(0x11); // options "step over"
sendTrkMessage(0x19, TrkCB(handleStepInto2), ba, "Step range");
......@@ -1215,7 +1214,7 @@ void TrkGdbAdapter::handleStepInto(const TrkResult &result)
void TrkGdbAdapter::handleStepInto2(const TrkResult &result)
{
if (result.errorCode()) {
logMessage("ERROR: " + result.errorString() + "in handleStepInto2");
logMessage("ERROR: " + result.errorString() + " in handleStepInto2");
// Try fallback with Continue
sendTrkMessage(0x18, TrkCallback(), trkContinueMessage(), "CONTINUE");
//sendGdbServerMessage("S05", "Stepping finished");
......@@ -1625,9 +1624,22 @@ QByteArray TrkGdbAdapter::readAllStandardOutput()
void TrkGdbAdapter::write(const QByteArray &data)
{
// Write magic packets directly to TRK.
if (data.startsWith("@#")) {
QByteArray ba = QByteArray::fromHex(data.mid(2));
qDebug() << "Writing: " << quoteUnprintableLatin1(ba);
if (ba.size() >= 1)
sendTrkMessage(ba.at(0), TrkCB(handleDirectTrk), ba.mid(1));
return;
}
m_gdbProc.write(data, data.size());
}
void TrkGdbAdapter::handleDirectTrk(const TrkResult &result)
{
logMessage("HANDLE DIRECT TRK: " + stringFromArray(result.data));
}
void TrkGdbAdapter::setWorkingDirectory(const QString &dir)
{
m_gdbProc.setWorkingDirectory(dir);
......
......@@ -150,6 +150,7 @@ public:
void handleDisconnect(const TrkResult &result);
void handleDeleteProcess(const TrkResult &result);
void handleDeleteProcess2(const TrkResult &result);
void handleDirectTrk(const TrkResult &response);
void handleAndReportCreateProcess(const TrkResult &result);
void handleAndReportReadRegistersAfterStop(const TrkResult &result);
......
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