Commit 648ceaed authored by hjk's avatar hjk
Browse files

debugger: work on trk integration

parent 700bfa63
......@@ -1563,6 +1563,8 @@ void GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp)
void GdbEngine::startDebugger2()
{
qDebug() << "STARTUP, PHASE 2";
debugMessage(_("STARTUP, PHASE 2"));
#if 0
if (!m_gdbProc->waitForStarted()) {
QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"),
......@@ -1726,11 +1728,16 @@ void GdbEngine::handleStart(const GdbResultRecord &response, const QVariant &)
QString msg = _(response.data.findChild("consolestreamoutput").data());
QRegExp needle(_("\\bEntry point: (0x[0-9a-f]+)\\b"));
if (needle.indexIn(msg) != -1) {
//debugMessage(_("STREAM: ") + msg + " " + needle.cap(1));
postCommand(_("tbreak *") + needle.cap(1));
m_waitingForFirstBreakpointToBeHit = true;
qq->notifyInferiorRunningRequested();
postCommand(_("-exec-run"), CB(handleExecRun));
if (m_gdbProc->isAdapter()) {
postCommand(_("-exec-continue"), CB(handleExecRun));
qq->notifyInferiorRunningRequested();
} else {
//debugMessage(_("STREAM: ") + msg + " " + needle.cap(1));
postCommand(_("tbreak *") + needle.cap(1));
m_waitingForFirstBreakpointToBeHit = true;
qq->notifyInferiorRunningRequested();
postCommand(_("-exec-run"), CB(handleExecRun));
}
} else {
debugMessage(_("PARSING START ADDRESS FAILED: ") + msg);
}
......
......@@ -106,6 +106,7 @@ public:
qint64 write(const char *data) { return m_proc.write(data); }
void setWorkingDirectory(const QString &dir) { m_proc.setWorkingDirectory(dir); }
void setEnvironment(const QStringList &env) { m_proc.setEnvironment(env); }
bool isAdapter() const { return false; }
private:
QProcess m_proc;
......
......@@ -60,6 +60,7 @@ public:
virtual qint64 write(const char *data) = 0;
virtual void setWorkingDirectory(const QString &dir) = 0;
virtual void setEnvironment(const QStringList &env) = 0;
virtual bool isAdapter() const = 0;
signals:
void error(QProcess::ProcessError);
......
......@@ -71,7 +71,7 @@ SymbianAdapter::SymbianAdapter()
{
m_running = false;
m_gdbAckMode = true;
m_verbose = 0;
m_verbose = 2;
m_serialFrame = false;
m_bufferedMemoryRead = true;
m_rfcommDevice = "/dev/rfcomm0";
......@@ -191,7 +191,6 @@ void SymbianAdapter::startInferior()
appendString(&ba, file, TargetByteOrder);
sendTrkMessage(0x40, TrkCB(handleCreateProcess), ba); // Create Item
//sendTrkMessage(TRK_WRITE_QUEUE_NOOP_CODE, TrkCB(startGdbServer));
emit started();
}
void SymbianAdapter::logMessage(const QString &msg)
......@@ -1047,7 +1046,7 @@ void SymbianAdapter::handleAndReportReadRegisters(const TrkResult &result)
sendGdbServerMessage(ba, logMsg);
}
static inline QString msgMemoryReadError(int code, uint addr, uint len = 0)
static QString msgMemoryReadError(int code, uint addr, uint len = 0)
{
const QString lenS = len ? QString::number(len) : QLatin1String("<unknown>");
return QString::fromLatin1("Memory read error %1 at: 0x%2 %3")
......@@ -1372,21 +1371,18 @@ void SymbianAdapter::startGdb()
sendGdbMessage("-break-insert filebrowseappui.cpp:39");
sendGdbMessage("target remote " + m_gdbServerName);
//sendGdbMessage("-exec-continue");
emit started();
}
void SymbianAdapter::sendGdbMessage(const QString &msg, GdbCallback callback,
const QVariant &cookie)
{
static int token = 0;
++token;
GdbCommand data;
data.command = msg;
data.callback = callback;
data.cookie = cookie;
m_gdbCookieForToken[token] = data;
logMessage(QString("<- GDB: %1 %2").arg(token).arg(msg));
m_gdbProc.write(QString("%1%2\n").arg(token).arg(msg).toLatin1());
logMessage(QString("<- GDB: %2").arg(msg));
m_gdbProc.write(msg.toLatin1() + "\n");
}
void SymbianAdapter::handleSetTrkMainBreakpoint(const TrkResult &result)
......@@ -1438,7 +1434,6 @@ void SymbianAdapter::terminate()
bool SymbianAdapter::waitForFinished(int msecs)
{
return m_gdbProc.waitForFinished(msecs);
//return true;
}
QProcess::ProcessState SymbianAdapter::state() const
......
......@@ -93,6 +93,7 @@ public:
public slots:
void startInferior();
void run();
signals:
void output(const QString &msg);
......@@ -103,7 +104,6 @@ private slots:
void handleProcFinished(int exitCode, QProcess::ExitStatus exitStatus);
void handleProcStarted();
void handleProcStateChanged(QProcess::ProcessState newState);
void run();
void startGdb();
private:
......@@ -135,6 +135,7 @@ public:
qint64 write(const char *data);
void setWorkingDirectory(const QString &dir);
void setEnvironment(const QStringList &env);
bool isAdapter() const { return true; }
//
// TRK
......
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