Symbian: tcftrk renamed to Coda

This commit is contained in:
Pawel Polanski
2011-02-07 14:26:34 +01:00
parent 3212e1152c
commit 532a8ad2e7
17 changed files with 535 additions and 535 deletions

View File

@@ -31,10 +31,10 @@
**
**************************************************************************/
#include "tcftrkgdbadapter.h"
#include "codagdbadapter.h"
#include "debuggerstartparameters.h"
#include "tcftrkdevice.h"
#include "codadevice.h"
#include "trkutils.h"
#include "gdbmi.h"
#include "virtualserialdevice.h"
@@ -66,7 +66,7 @@
#endif
#define CB(callback) \
static_cast<GdbEngine::AdapterCallback>(&TcfTrkGdbAdapter::callback), \
static_cast<GdbEngine::AdapterCallback>(&CodaGdbAdapter::callback), \
STRINGIFY(callback)
enum { debug = 0 };
@@ -88,17 +88,17 @@ namespace Debugger {
namespace Internal {
using namespace Symbian;
using namespace tcftrk;
using namespace Coda;
static inline QString startMsg(const trk::Session &session)
{
return TcfTrkGdbAdapter::tr("Process started, PID: 0x%1, thread id: 0x%2, "
return CodaGdbAdapter::tr("Process started, PID: 0x%1, thread id: 0x%2, "
"code segment: 0x%3, data segment: 0x%4.")
.arg(session.pid, 0, 16).arg(session.tid, 0, 16)
.arg(session.codeseg, 0, 16).arg(session.dataseg, 0, 16);
}
/* -------------- TcfTrkGdbAdapter:
/* -------------- CodaGdbAdapter:
* Startup-sequence:
* - startAdapter connects both sockets/devices
* - In the TCF Locator Event, gdb is started and the engine is notified
@@ -119,11 +119,11 @@ static inline QString startMsg(const trk::Session &session)
* - Stop all threads once one stops?
* - Breakpoints do not trigger in threads other than the main thread. */
TcfTrkGdbAdapter::TcfTrkGdbAdapter(GdbEngine *engine) :
CodaGdbAdapter::CodaGdbAdapter(GdbEngine *engine) :
AbstractGdbAdapter(engine),
m_running(false),
m_stopReason(0),
m_trkDevice(new TcfTrkDevice(this)),
m_trkDevice(new CodaDevice(this)),
m_gdbAckMode(true),
m_uid(0),
m_verbose(0),
@@ -149,38 +149,38 @@ TcfTrkGdbAdapter::TcfTrkGdbAdapter(GdbEngine *engine) :
connect(debuggerCore()->action(VerboseLog), SIGNAL(valueChanged(QVariant)),
this, SLOT(setVerbose(QVariant)));
connect(m_trkDevice, SIGNAL(error(QString)),
this, SLOT(tcftrkDeviceError(QString)));
this, SLOT(codaDeviceError(QString)));
connect(m_trkDevice, SIGNAL(logMessage(QString)),
this, SLOT(trkLogMessage(QString)));
connect(m_trkDevice, SIGNAL(tcfEvent(tcftrk::TcfTrkEvent)),
this, SLOT(tcftrkEvent(tcftrk::TcfTrkEvent)));
connect(m_trkDevice, SIGNAL(tcfEvent(Coda::CodaEvent)),
this, SLOT(codaEvent(Coda::CodaEvent)));
}
TcfTrkGdbAdapter::~TcfTrkGdbAdapter()
CodaGdbAdapter::~CodaGdbAdapter()
{
cleanup();
logMessage("Shutting down.\n");
}
void TcfTrkGdbAdapter::setVerbose(const QVariant &value)
void CodaGdbAdapter::setVerbose(const QVariant &value)
{
setVerbose(value.toInt());
}
void TcfTrkGdbAdapter::setVerbose(int verbose)
void CodaGdbAdapter::setVerbose(int verbose)
{
if (debug)
qDebug("TcfTrkGdbAdapter::setVerbose %d", verbose);
qDebug("CodaGdbAdapter::setVerbose %d", verbose);
m_verbose = verbose;
m_trkDevice->setVerbose(m_verbose);
}
void TcfTrkGdbAdapter::trkLogMessage(const QString &msg)
void CodaGdbAdapter::trkLogMessage(const QString &msg)
{
logMessage(_("TRK ") + msg);
}
void TcfTrkGdbAdapter::setGdbServerName(const QString &name)
void CodaGdbAdapter::setGdbServerName(const QString &name)
{
m_gdbServerName = name;
}
@@ -201,7 +201,7 @@ static QPair<QString, unsigned short> splitIpAddressSpec(const QString &addressS
return QPair<QString, unsigned short>(address, port);
}
void TcfTrkGdbAdapter::handleTcfTrkRunControlModuleLoadContextSuspendedEvent(const TcfTrkRunControlModuleLoadContextSuspendedEvent &se)
void CodaGdbAdapter::handleCodaRunControlModuleLoadContextSuspendedEvent(const CodaRunControlModuleLoadContextSuspendedEvent &se)
{
m_snapshot.resetMemory();
const ModuleLoadEventInfo &minfo = se.info();
@@ -278,12 +278,12 @@ void TcfTrkGdbAdapter::handleTcfTrkRunControlModuleLoadContextSuspendedEvent(con
qDebug() << "Initial module load suspended: " << m_session.toString();
} else {
// Consecutive module load suspended: (not observed yet): Just continue
m_trkDevice->sendRunControlResumeCommand(TcfTrkCallback(), se.id());
m_trkDevice->sendRunControlResumeCommand(CodaCallback(), se.id());
}
}
}
void TcfTrkGdbAdapter::handleTargetRemote(const GdbResponse &record)
void CodaGdbAdapter::handleTargetRemote(const GdbResponse &record)
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
if (record.resultClass == GdbResultDone) {
@@ -297,29 +297,29 @@ void TcfTrkGdbAdapter::handleTargetRemote(const GdbResponse &record)
}
}
void TcfTrkGdbAdapter::tcftrkEvent(const TcfTrkEvent &e)
void CodaGdbAdapter::codaEvent(const CodaEvent &e)
{
if (debug)
qDebug() << e.toString() << m_session.toString() << m_snapshot.toString();
logMessage(e.toString());
switch (e.type()) {
case TcfTrkEvent::LocatorHello:
m_trkDevice->sendLoggingAddListenerCommand(TcfTrkCallback());
case CodaEvent::LocatorHello:
m_trkDevice->sendLoggingAddListenerCommand(CodaCallback());
startGdb(); // Commands are only accepted after hello
break;
case TcfTrkEvent::RunControlModuleLoadSuspended: // A module was loaded
handleTcfTrkRunControlModuleLoadContextSuspendedEvent(
static_cast<const TcfTrkRunControlModuleLoadContextSuspendedEvent &>(e));
case CodaEvent::RunControlModuleLoadSuspended: // A module was loaded
handleCodaRunControlModuleLoadContextSuspendedEvent(
static_cast<const CodaRunControlModuleLoadContextSuspendedEvent &>(e));
break;
case TcfTrkEvent::RunControlContextAdded: // Thread/process added
foreach(const RunControlContext &rc, static_cast<const TcfTrkRunControlContextAddedEvent &>(e).contexts())
case CodaEvent::RunControlContextAdded: // Thread/process added
foreach(const RunControlContext &rc, static_cast<const CodaRunControlContextAddedEvent &>(e).contexts())
if (rc.type() == RunControlContext::Thread)
addThread(rc.threadId());
break;
case TcfTrkEvent::RunControlContextRemoved: // Thread/process removed
case CodaEvent::RunControlContextRemoved: // Thread/process removed
foreach (const QByteArray &id,
static_cast<const TcfTrkRunControlContextRemovedEvent &>(e).ids())
static_cast<const CodaRunControlContextRemovedEvent &>(e).ids())
switch (RunControlContext::typeFromTcfId(id)) {
case RunControlContext::Thread:
m_snapshot.removeThread(RunControlContext::threadIdFromTcdfId(id));
@@ -329,10 +329,10 @@ void TcfTrkGdbAdapter::tcftrkEvent(const TcfTrkEvent &e)
break;
}
break;
case TcfTrkEvent::RunControlSuspended: {
case CodaEvent::RunControlSuspended: {
// Thread suspended/stopped
const TcfTrkRunControlContextSuspendedEvent &se =
static_cast<const TcfTrkRunControlContextSuspendedEvent &>(e);
const CodaRunControlContextSuspendedEvent &se =
static_cast<const CodaRunControlContextSuspendedEvent &>(e);
const unsigned threadId = RunControlContext::threadIdFromTcdfId(se.id());
const QString reason = QString::fromUtf8(se.reasonID());
const QString message = QString::fromUtf8(se.message()).replace(QLatin1String("\n"), QLatin1String(", "));
@@ -350,12 +350,12 @@ void TcfTrkGdbAdapter::tcftrkEvent(const TcfTrkEvent &e)
|| reason.contains(QLatin1String("panic"), Qt::CaseInsensitive) ?
gdbServerSignalSegfault : gdbServerSignalTrap;
m_trkDevice->sendRegistersGetMRangeCommand(
TcfTrkCallback(this, &TcfTrkGdbAdapter::handleAndReportReadRegistersAfterStop),
CodaCallback(this, &CodaGdbAdapter::handleAndReportReadRegistersAfterStop),
currentThreadContextId(), 0,
Symbian::RegisterCount);
}
break;
case tcftrk::TcfTrkEvent::LoggingWriteEvent: // TODO: Not tested yet.
case Coda::CodaEvent::LoggingWriteEvent: // TODO: Not tested yet.
showMessage(e.toString(), AppOutput);
break;
default:
@@ -363,7 +363,7 @@ void TcfTrkGdbAdapter::tcftrkEvent(const TcfTrkEvent &e)
}
}
void TcfTrkGdbAdapter::startGdb()
void CodaGdbAdapter::startGdb()
{
QStringList gdbArgs;
gdbArgs.append(QLatin1String("--nx")); // Do not read .gdbinit file
@@ -374,7 +374,7 @@ void TcfTrkGdbAdapter::startGdb()
m_engine->handleAdapterStarted();
}
void TcfTrkGdbAdapter::tcftrkDeviceError(const QString &errorString)
void CodaGdbAdapter::codaDeviceError(const QString &errorString)
{
logMessage(errorString);
if (state() == EngineSetupRequested) {
@@ -384,7 +384,7 @@ void TcfTrkGdbAdapter::tcftrkDeviceError(const QString &errorString)
}
}
void TcfTrkGdbAdapter::logMessage(const QString &msg, int channel)
void CodaGdbAdapter::logMessage(const QString &msg, int channel)
{
if (m_verbose || channel != LogDebug)
showMessage(msg, channel);
@@ -395,7 +395,7 @@ void TcfTrkGdbAdapter::logMessage(const QString &msg, int channel)
//
// Gdb
//
void TcfTrkGdbAdapter::handleGdbConnection()
void CodaGdbAdapter::handleGdbConnection()
{
logMessage("HANDLING GDB CONNECTION");
QTC_ASSERT(m_gdbConnection == 0, /**/);
@@ -412,7 +412,7 @@ static inline QString msgGdbPacket(const QString &p)
return QLatin1String("gdb: ") + p;
}
void TcfTrkGdbAdapter::readGdbServerCommand()
void CodaGdbAdapter::readGdbServerCommand()
{
QTC_ASSERT(m_gdbConnection, return);
QByteArray packet = m_gdbConnection->readAll();
@@ -482,7 +482,7 @@ void TcfTrkGdbAdapter::readGdbServerCommand()
}
}
bool TcfTrkGdbAdapter::sendGdbServerPacket(const QByteArray &packet, bool doFlush)
bool CodaGdbAdapter::sendGdbServerPacket(const QByteArray &packet, bool doFlush)
{
if (!m_gdbConnection) {
logMessage(_("Cannot write to gdb: No connection (%1)")
@@ -504,7 +504,7 @@ bool TcfTrkGdbAdapter::sendGdbServerPacket(const QByteArray &packet, bool doFlus
return true;
}
void TcfTrkGdbAdapter::sendGdbServerAck()
void CodaGdbAdapter::sendGdbServerAck()
{
if (!m_gdbAckMode)
return;
@@ -512,7 +512,7 @@ void TcfTrkGdbAdapter::sendGdbServerAck()
sendGdbServerPacket(QByteArray(1, '+'), false);
}
void TcfTrkGdbAdapter::sendGdbServerMessage(const QByteArray &msg, const QByteArray &logNote)
void CodaGdbAdapter::sendGdbServerMessage(const QByteArray &msg, const QByteArray &logNote)
{
trk::byte sum = 0;
for (int i = 0; i != msg.size(); ++i)
@@ -545,7 +545,7 @@ static QByteArray msgStepRangeReceived(unsigned from, unsigned to, bool over)
return rc;
}
void TcfTrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
void CodaGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
{
if (debug)
qDebug("handleGdbServerCommand: %s", cmd.constData());
@@ -689,7 +689,7 @@ void TcfTrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
arg(addrLength.second).arg(addrLength.first, 0, 16).
arg(QString::fromAscii(data.toHex())));
m_trkDevice->sendMemorySetCommand(
TcfTrkCallback(this, &TcfTrkGdbAdapter::handleWriteMemory),
CodaCallback(this, &CodaGdbAdapter::handleWriteMemory),
m_tcfProcessId, addrLength.first, data);
}
@@ -708,7 +708,7 @@ void TcfTrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
} else {
//qDebug() << "Fetching single register";
m_trkDevice->sendRegistersGetMRangeCommand(
TcfTrkCallback(this, &TcfTrkGdbAdapter::handleAndReportReadRegister),
CodaCallback(this, &CodaGdbAdapter::handleAndReportReadRegister),
currentThreadContextId(), registerNumber, 1);
}
}
@@ -724,7 +724,7 @@ void TcfTrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
QByteArray registerValue;
trk::appendInt(&registerValue, trk::BigEndian); // Registers are big endian
m_trkDevice->sendRegistersSetCommand(
TcfTrkCallback(this, &TcfTrkGdbAdapter::handleWriteRegister),
CodaCallback(this, &CodaGdbAdapter::handleWriteRegister),
currentThreadContextId(), regnumValue.first, registerValue,
QVariant(regnumValue.first));
// Note that App TRK refuses to write registers 13 and 14
@@ -894,13 +894,13 @@ void TcfTrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
logMessage(_("Inserting breakpoint at 0x%1, %2")
.arg(addrLen.first, 0, 16).arg(addrLen.second));
// const QByteArray ba = trkBreakpointMessage(addr, len, len == 4);
tcftrk::Breakpoint bp(addrLen.first);
Coda::Breakpoint bp(addrLen.first);
bp.size = addrLen.second;
bp.setContextId(m_session.pid);
// We use the automatic ids calculated from the location
// address instead of the map in snapshot.
m_trkDevice->sendBreakpointsAddCommand(
TcfTrkCallback(this, &TcfTrkGdbAdapter::handleAndReportSetBreakpoint),
CodaCallback(this, &CodaGdbAdapter::handleAndReportSetBreakpoint),
bp);
} else {
logMessage("MISPARSED BREAKPOINT '" + cmd + "'')" , LogError);
@@ -915,8 +915,8 @@ void TcfTrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
const int pos = cmd.lastIndexOf(',');
const uint addr = cmd.mid(3, pos - 3).toUInt(0, 16);
m_trkDevice->sendBreakpointsRemoveCommand(
TcfTrkCallback(this, &TcfTrkGdbAdapter::handleClearBreakpoint),
tcftrk::Breakpoint::idFromLocation(addr));
CodaCallback(this, &CodaGdbAdapter::handleClearBreakpoint),
Coda::Breakpoint::idFromLocation(addr));
}
else if (cmd.startsWith("qPart:") || cmd.startsWith("qXfer:")) {
@@ -955,16 +955,16 @@ void TcfTrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
}
}
void TcfTrkGdbAdapter::sendRunControlTerminateCommand()
void CodaGdbAdapter::sendRunControlTerminateCommand()
{
// Requires id of main thread to terminate.
// Note that calling 'Settings|set|removeExecutable' crashes TCF TRK,
// so, it is apparently not required.
m_trkDevice->sendRunControlTerminateCommand(TcfTrkCallback(this, &TcfTrkGdbAdapter::handleRunControlTerminate),
m_trkDevice->sendRunControlTerminateCommand(CodaCallback(this, &CodaGdbAdapter::handleRunControlTerminate),
mainThreadContextId());
}
void TcfTrkGdbAdapter::handleRunControlTerminate(const tcftrk::TcfTrkCommandResult &)
void CodaGdbAdapter::handleRunControlTerminate(const Coda::CodaCommandResult &)
{
QString msg = QString::fromLatin1("CODA disconnected");
const bool emergencyShutdown = m_gdbProc.state() != QProcess::Running;
@@ -977,7 +977,7 @@ void TcfTrkGdbAdapter::handleRunControlTerminate(const tcftrk::TcfTrkCommandResu
}
}
void TcfTrkGdbAdapter::gdbSetCurrentThread(const QByteArray &cmd, const char *why)
void CodaGdbAdapter::gdbSetCurrentThread(const QByteArray &cmd, const char *why)
{
// Thread ID from Hg/Hc commands: '-1': All, '0': arbitrary, else hex thread id.
const QByteArray id = cmd.mid(2);
@@ -991,12 +991,12 @@ void TcfTrkGdbAdapter::gdbSetCurrentThread(const QByteArray &cmd, const char *wh
sendGdbServerMessage("OK", message);
}
void TcfTrkGdbAdapter::interruptInferior()
void CodaGdbAdapter::interruptInferior()
{
m_trkDevice->sendRunControlSuspendCommand(TcfTrkCallback(), m_tcfProcessId);
m_trkDevice->sendRunControlSuspendCommand(CodaCallback(), m_tcfProcessId);
}
void TcfTrkGdbAdapter::startAdapter()
void CodaGdbAdapter::startAdapter()
{
m_snapshot.fullReset();
m_session.reset();
@@ -1011,13 +1011,13 @@ void TcfTrkGdbAdapter::startAdapter()
if (!m_symbolFile.isEmpty())
m_symbolFileFolder = QFileInfo(m_symbolFile).absolutePath();
QPair<QString, unsigned short> tcfTrkAddress;
QPair<QString, unsigned short> codaAddress;
QSharedPointer<QTcpSocket> tcfTrkSocket;
QSharedPointer<QTcpSocket> codaSocket;
if (parameters.communicationChannel == DebuggerStartParameters::CommunicationChannelTcpIp) {
tcfTrkSocket = QSharedPointer<QTcpSocket>(new QTcpSocket);
m_trkDevice->setDevice(tcfTrkSocket);
m_trkIODevice = tcfTrkSocket;
codaSocket = QSharedPointer<QTcpSocket>(new QTcpSocket);
m_trkDevice->setDevice(codaSocket);
m_trkIODevice = codaSocket;
} else {
QSharedPointer<SymbianUtils::VirtualSerialDevice> serialDevice(new SymbianUtils::VirtualSerialDevice(parameters.remoteChannel));
m_trkDevice->setSerialFrame(true);
@@ -1037,7 +1037,7 @@ void TcfTrkGdbAdapter::startAdapter()
qDebug() << parameters.processArgs;
m_uid = parameters.executableUid;
tcfTrkAddress = QPair<QString, unsigned short>(parameters.serverAddress, parameters.serverPort);
codaAddress = QPair<QString, unsigned short>(parameters.serverAddress, parameters.serverPort);
// m_remoteArguments.clear(); FIXME: Should this be here?
// Unixish gdbs accept only forward slashes
@@ -1045,7 +1045,7 @@ void TcfTrkGdbAdapter::startAdapter()
// Start
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
showMessage(_("TRYING TO START ADAPTER"));
logMessage(QLatin1String("### Starting TcfTrkGdbAdapter"));
logMessage(QLatin1String("### Starting CodaGdbAdapter"));
QTC_ASSERT(m_gdbServer == 0, delete m_gdbServer);
QTC_ASSERT(m_gdbConnection == 0, m_gdbConnection = 0);
@@ -1068,14 +1068,14 @@ void TcfTrkGdbAdapter::startAdapter()
if (parameters.communicationChannel == DebuggerStartParameters::CommunicationChannelTcpIp) {
logMessage(_("Connecting to TCF TRK on %1:%2")
.arg(tcfTrkAddress.first).arg(tcfTrkAddress.second));
tcfTrkSocket->connectToHost(tcfTrkAddress.first, tcfTrkAddress.second);
.arg(codaAddress.first).arg(codaAddress.second));
codaSocket->connectToHost(codaAddress.first, codaAddress.second);
} else {
m_trkDevice->sendSerialPing(false);
}
}
void TcfTrkGdbAdapter::setupInferior()
void CodaGdbAdapter::setupInferior()
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
@@ -1086,12 +1086,12 @@ void TcfTrkGdbAdapter::setupInferior()
libraries.push_back(QString::fromAscii(librariesC[i]));
m_trkDevice->sendProcessStartCommand(
TcfTrkCallback(this, &TcfTrkGdbAdapter::handleCreateProcess),
CodaCallback(this, &CodaGdbAdapter::handleCreateProcess),
m_remoteExecutable, m_uid, m_remoteArguments,
QString(), true, libraries);
}
void TcfTrkGdbAdapter::addThread(unsigned id)
void CodaGdbAdapter::addThread(unsigned id)
{
showMessage(QString::fromLatin1("Thread %1 reported").arg(id), LogMisc);
// Make thread known, register as main if it is the first one.
@@ -1104,13 +1104,13 @@ void TcfTrkGdbAdapter::addThread(unsigned id)
}
// We cannot retrieve register values unless the registers of that
// thread have been retrieved (TCF TRK oddity).
const QByteArray contextId = tcftrk::RunControlContext::tcfId(m_session.pid, id);
m_trkDevice->sendRegistersGetChildrenCommand(TcfTrkCallback(this, &TcfTrkGdbAdapter::handleRegisterChildren),
const QByteArray contextId = Coda::RunControlContext::tcfId(m_session.pid, id);
m_trkDevice->sendRegistersGetChildrenCommand(CodaCallback(this, &CodaGdbAdapter::handleRegisterChildren),
contextId, QVariant(contextId));
}
}
void TcfTrkGdbAdapter::handleCreateProcess(const TcfTrkCommandResult &result)
void CodaGdbAdapter::handleCreateProcess(const CodaCommandResult &result)
{
if (debug)
qDebug() << "ProcessCreated: " << result.toString();
@@ -1135,7 +1135,7 @@ void TcfTrkGdbAdapter::handleCreateProcess(const TcfTrkCommandResult &result)
m_session.dataseg = 0;
}
void TcfTrkGdbAdapter::runEngine()
void CodaGdbAdapter::runEngine()
{
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
m_engine->notifyEngineRunAndInferiorStopOk();
@@ -1147,7 +1147,7 @@ void TcfTrkGdbAdapter::runEngine()
// AbstractGdbAdapter interface implementation
//
void TcfTrkGdbAdapter::write(const QByteArray &data)
void CodaGdbAdapter::write(const QByteArray &data)
{
// Write magic packets directly to TRK.
if (data.startsWith("@#")) {
@@ -1179,7 +1179,7 @@ void TcfTrkGdbAdapter::write(const QByteArray &data)
m_gdbProc.write(data);
}
void TcfTrkGdbAdapter::cleanup()
void CodaGdbAdapter::cleanup()
{
delete m_gdbServer;
m_gdbServer = 0;
@@ -1199,12 +1199,12 @@ void TcfTrkGdbAdapter::cleanup()
} //!m_trkIODevice.isNull()
}
void TcfTrkGdbAdapter::shutdownInferior()
void CodaGdbAdapter::shutdownInferior()
{
m_engine->defaultInferiorShutdown("kill");
}
void TcfTrkGdbAdapter::shutdownAdapter()
void CodaGdbAdapter::shutdownAdapter()
{
if (m_gdbProc.state() == QProcess::Running) {
cleanup();
@@ -1218,18 +1218,18 @@ void TcfTrkGdbAdapter::shutdownAdapter()
}
}
void TcfTrkGdbAdapter::trkReloadRegisters()
void CodaGdbAdapter::trkReloadRegisters()
{
// Take advantage of direct access to cached register values.
m_snapshot.syncRegisters(m_session.tid, m_engine->registerHandler());
}
void TcfTrkGdbAdapter::trkReloadThreads()
void CodaGdbAdapter::trkReloadThreads()
{
m_snapshot.syncThreads(m_engine->threadsHandler());
}
void TcfTrkGdbAdapter::handleWriteRegister(const TcfTrkCommandResult &result)
void CodaGdbAdapter::handleWriteRegister(const CodaCommandResult &result)
{
const int registerNumber = result.cookie.toInt();
if (result) {
@@ -1241,18 +1241,18 @@ void TcfTrkGdbAdapter::handleWriteRegister(const TcfTrkCommandResult &result)
}
}
void TcfTrkGdbAdapter::sendRegistersGetMCommand()
void CodaGdbAdapter::sendRegistersGetMCommand()
{
// Send off a register command, which requires the names to be present.
QTC_ASSERT(!m_trkDevice->registerNames().isEmpty(), return )
m_trkDevice->sendRegistersGetMRangeCommand(
TcfTrkCallback(this, &TcfTrkGdbAdapter::handleAndReportReadRegisters),
CodaCallback(this, &CodaGdbAdapter::handleAndReportReadRegisters),
currentThreadContextId(), 0,
Symbian::RegisterCount);
}
void TcfTrkGdbAdapter::reportRegisters()
void CodaGdbAdapter::reportRegisters()
{
const int threadIndex = m_snapshot.indexOfThread(m_session.tid);
QTC_ASSERT(threadIndex != -1, return);
@@ -1260,7 +1260,7 @@ void TcfTrkGdbAdapter::reportRegisters()
sendGdbServerMessage(thread.gdbReportRegisters(), thread.gdbRegisterLogMessage(m_verbose));
}
void TcfTrkGdbAdapter::handleRegisterChildren(const tcftrk::TcfTrkCommandResult &result)
void CodaGdbAdapter::handleRegisterChildren(const Coda::CodaCommandResult &result)
{
const QByteArray contextId = result.cookie.toByteArray();
if (!result) {
@@ -1271,9 +1271,9 @@ void TcfTrkGdbAdapter::handleRegisterChildren(const tcftrk::TcfTrkCommandResult
// If this is a single 'pid.tid.rGPR' parent entry, recurse to get the actual registers,
// ('pid.tid.rGPR.R0'..). At least 'pid.tid.rGPR' must have been retrieved to be
// able to access the register contents.
QVector<QByteArray> registerNames = tcftrk::TcfTrkDevice::parseRegisterGetChildren(result);
QVector<QByteArray> registerNames = Coda::CodaDevice::parseRegisterGetChildren(result);
if (registerNames.size() == 1) {
m_trkDevice->sendRegistersGetChildrenCommand(TcfTrkCallback(this, &TcfTrkGdbAdapter::handleRegisterChildren),
m_trkDevice->sendRegistersGetChildrenCommand(CodaCallback(this, &CodaGdbAdapter::handleRegisterChildren),
registerNames.front(), result.cookie);
return;
}
@@ -1304,7 +1304,7 @@ void TcfTrkGdbAdapter::handleRegisterChildren(const tcftrk::TcfTrkCommandResult
}
}
void TcfTrkGdbAdapter::handleReadRegisters(const TcfTrkCommandResult &result)
void CodaGdbAdapter::handleReadRegisters(const CodaCommandResult &result)
{
// check for errors
if (!result) {
@@ -1336,13 +1336,13 @@ void TcfTrkGdbAdapter::handleReadRegisters(const TcfTrkCommandResult &result)
qDebug() << "handleReadRegisters: " << m_snapshot.toString();
}
void TcfTrkGdbAdapter::handleAndReportReadRegisters(const TcfTrkCommandResult &result)
void CodaGdbAdapter::handleAndReportReadRegisters(const CodaCommandResult &result)
{
handleReadRegisters(result);
reportRegisters();
}
void TcfTrkGdbAdapter::handleAndReportReadRegister(const TcfTrkCommandResult &result)
void CodaGdbAdapter::handleAndReportReadRegister(const CodaCommandResult &result)
{
handleReadRegisters(result);
const uint registerNumber = result.cookie.toUInt();
@@ -1353,7 +1353,7 @@ void TcfTrkGdbAdapter::handleAndReportReadRegister(const TcfTrkCommandResult &re
thread.gdbSingleRegisterLogMessage(registerNumber));
}
QByteArray TcfTrkGdbAdapter::stopMessage() const
QByteArray CodaGdbAdapter::stopMessage() const
{
QByteArray logMsg = "Stopped with registers in thread 0x";
logMsg += QByteArray::number(m_session.tid, 16);
@@ -1374,7 +1374,7 @@ QByteArray TcfTrkGdbAdapter::stopMessage() const
return logMsg;
}
void TcfTrkGdbAdapter::handleAndReportReadRegistersAfterStop(const TcfTrkCommandResult &result)
void CodaGdbAdapter::handleAndReportReadRegistersAfterStop(const CodaCommandResult &result)
{
handleReadRegisters(result);
handleReadRegisters(result);
@@ -1382,7 +1382,7 @@ void TcfTrkGdbAdapter::handleAndReportReadRegistersAfterStop(const TcfTrkCommand
sendGdbServerMessage(m_snapshot.gdbStopMessage(m_session.tid, m_stopReason, reportThread), stopMessage());
}
void TcfTrkGdbAdapter::handleAndReportSetBreakpoint(const TcfTrkCommandResult &result)
void CodaGdbAdapter::handleAndReportSetBreakpoint(const CodaCommandResult &result)
{
if (result) {
sendGdbServerMessage("OK");
@@ -1392,7 +1392,7 @@ void TcfTrkGdbAdapter::handleAndReportSetBreakpoint(const TcfTrkCommandResult &r
}
}
void TcfTrkGdbAdapter::handleClearBreakpoint(const TcfTrkCommandResult &result)
void CodaGdbAdapter::handleClearBreakpoint(const CodaCommandResult &result)
{
logMessage("CLEAR BREAKPOINT ");
if (!result)
@@ -1400,7 +1400,7 @@ void TcfTrkGdbAdapter::handleClearBreakpoint(const TcfTrkCommandResult &result)
sendGdbServerMessage("OK");
}
void TcfTrkGdbAdapter::readMemory(uint addr, uint len, bool buffered)
void CodaGdbAdapter::readMemory(uint addr, uint len, bool buffered)
{
Q_ASSERT(len < (2 << 16));
@@ -1419,20 +1419,20 @@ static QString msgMemoryReadError(uint addr, uint len = 0)
return _("Memory read error at: 0x%1 %2").arg(addr, 0, 16).arg(lenS);
}
void TcfTrkGdbAdapter::sendMemoryGetCommand(const MemoryRange &range, bool buffered)
void CodaGdbAdapter::sendMemoryGetCommand(const MemoryRange &range, bool buffered)
{
const QVariant cookie = QVariant::fromValue(range);
const TcfTrkCallback cb = buffered ?
TcfTrkCallback(this, &TcfTrkGdbAdapter::handleReadMemoryBuffered) :
TcfTrkCallback(this, &TcfTrkGdbAdapter::handleReadMemoryUnbuffered);
const CodaCallback cb = buffered ?
CodaCallback(this, &CodaGdbAdapter::handleReadMemoryBuffered) :
CodaCallback(this, &CodaGdbAdapter::handleReadMemoryUnbuffered);
m_trkDevice->sendMemoryGetCommand(cb, currentThreadContextId(), range.from, range.size(), cookie);
}
void TcfTrkGdbAdapter::handleReadMemoryBuffered(const TcfTrkCommandResult &result)
void CodaGdbAdapter::handleReadMemoryBuffered(const CodaCommandResult &result)
{
QTC_ASSERT(qVariantCanConvert<MemoryRange>(result.cookie), return);
const QByteArray memory = TcfTrkDevice::parseMemoryGet(result);
const QByteArray memory = CodaDevice::parseMemoryGet(result);
const MemoryRange range = result.cookie.value<MemoryRange>();
const bool error = !result;
@@ -1453,11 +1453,11 @@ void TcfTrkGdbAdapter::handleReadMemoryBuffered(const TcfTrkCommandResult &resul
tryAnswerGdbMemoryRequest(true);
}
void TcfTrkGdbAdapter::handleReadMemoryUnbuffered(const TcfTrkCommandResult &result)
void CodaGdbAdapter::handleReadMemoryUnbuffered(const CodaCommandResult &result)
{
QTC_ASSERT(qVariantCanConvert<MemoryRange>(result.cookie), return);
const QByteArray memory = TcfTrkDevice::parseMemoryGet(result);
const QByteArray memory = CodaDevice::parseMemoryGet(result);
const MemoryRange range = result.cookie.value<MemoryRange>();
const bool error = !result;
@@ -1475,7 +1475,7 @@ void TcfTrkGdbAdapter::handleReadMemoryUnbuffered(const TcfTrkCommandResult &res
tryAnswerGdbMemoryRequest(false);
}
void TcfTrkGdbAdapter::tryAnswerGdbMemoryRequest(bool buffered)
void CodaGdbAdapter::tryAnswerGdbMemoryRequest(bool buffered)
{
//logMessage("TRYING TO ANSWER MEMORY REQUEST ");
MemoryRange wanted = m_snapshot.wantedMemory;
@@ -1537,7 +1537,7 @@ void TcfTrkGdbAdapter::tryAnswerGdbMemoryRequest(bool buffered)
}
}
void TcfTrkGdbAdapter::handleWriteMemory(const TcfTrkCommandResult &result)
void CodaGdbAdapter::handleWriteMemory(const CodaCommandResult &result)
{
if (result) {
sendGdbServerMessage("OK", "Write memory");
@@ -1547,26 +1547,26 @@ void TcfTrkGdbAdapter::handleWriteMemory(const TcfTrkCommandResult &result)
}
}
QByteArray TcfTrkGdbAdapter::mainThreadContextId() const
QByteArray CodaGdbAdapter::mainThreadContextId() const
{
return RunControlContext::tcfId(m_session.pid, m_session.mainTid);
}
QByteArray TcfTrkGdbAdapter::currentThreadContextId() const
QByteArray CodaGdbAdapter::currentThreadContextId() const
{
return RunControlContext::tcfId(m_session.pid, m_session.tid);
}
void TcfTrkGdbAdapter::sendTrkContinue()
void CodaGdbAdapter::sendTrkContinue()
{
// Remove all but main thread as we do not know whether they will exist
// at the next stop.
if (m_snapshot.threadInfo.size() > 1)
m_snapshot.threadInfo.remove(1, m_snapshot.threadInfo.size() - 1);
m_trkDevice->sendRunControlResumeCommand(TcfTrkCallback(), m_tcfProcessId);
m_trkDevice->sendRunControlResumeCommand(CodaCallback(), m_tcfProcessId);
}
void TcfTrkGdbAdapter::sendTrkStepRange()
void CodaGdbAdapter::sendTrkStepRange()
{
uint from = m_snapshot.lineFromAddress;
uint to = m_snapshot.lineToAddress;
@@ -1587,12 +1587,12 @@ void TcfTrkGdbAdapter::sendTrkStepRange()
logMessage(_("Stepping from 0x%1 to 0x%2 (current PC=0x%3), mode %4").
arg(from, 0, 16).arg(to, 0, 16).arg(pc).arg(int(mode)));
m_trkDevice->sendRunControlResumeCommand(
TcfTrkCallback(this, &TcfTrkGdbAdapter::handleStep),
CodaCallback(this, &CodaGdbAdapter::handleStep),
currentThreadContextId(),
mode, 1, from, to);
}
void TcfTrkGdbAdapter::handleStep(const TcfTrkCommandResult &result)
void CodaGdbAdapter::handleStep(const CodaCommandResult &result)
{
if (!result) { // Try fallback with Continue.

View File

@@ -31,8 +31,8 @@
**
**************************************************************************/
#ifndef DEBUGGER_TCFTRKGDBADAPTER_H
#define DEBUGGER_TCFTRKGDBADAPTER_H
#ifndef DEBUGGER_CODAGDBADAPTER_H
#define DEBUGGER_CODAGDBADAPTER_H
#include "abstractgdbadapter.h"
#include "localgdbprocess.h"
@@ -51,11 +51,11 @@ class QTcpSocket;
class QIODevice;
QT_END_NAMESPACE
namespace tcftrk {
struct TcfTrkCommandResult;
class TcfTrkDevice;
class TcfTrkEvent;
class TcfTrkRunControlModuleLoadContextSuspendedEvent;
namespace Coda {
struct CodaCommandResult;
class CodaDevice;
class CodaEvent;
class CodaRunControlModuleLoadContextSuspendedEvent;
}
namespace Debugger {
@@ -66,21 +66,21 @@ struct GdbResult;
///////////////////////////////////////////////////////////////////////
//
// TcfTrkGdbAdapter
// CodaGdbAdapter
//
///////////////////////////////////////////////////////////////////////
class TcfTrkGdbAdapter : public AbstractGdbAdapter
class CodaGdbAdapter : public AbstractGdbAdapter
{
Q_OBJECT
public:
typedef trk::Callback<const GdbResult &> GdbResultCallback;
typedef trk::Callback<const tcftrk::TcfTrkCommandResult &> TcfTrkCallback;
typedef trk::Callback<const Coda::CodaCommandResult &> CodaCallback;
typedef trk::Callback<const GdbResponse &> GdbCallback;
explicit TcfTrkGdbAdapter(GdbEngine *engine);
virtual ~TcfTrkGdbAdapter();
explicit CodaGdbAdapter(GdbEngine *engine);
virtual ~CodaGdbAdapter();
void setGdbServerName(const QString &name);
QString gdbServerName() const { return m_gdbServerName; }
@@ -113,22 +113,22 @@ private:
void shutdownInferior();
void shutdownAdapter();
void sendRunControlTerminateCommand();
void handleRunControlTerminate(const tcftrk::TcfTrkCommandResult &);
void handleRunControlTerminate(const Coda::CodaCommandResult &);
void sendRegistersGetMCommand();
void handleWriteRegister(const tcftrk::TcfTrkCommandResult &result);
void handleWriteRegister(const Coda::CodaCommandResult &result);
void reportRegisters();
void handleReadRegisters(const tcftrk::TcfTrkCommandResult &result);
void handleRegisterChildren(const tcftrk::TcfTrkCommandResult &result);
void handleAndReportReadRegisters(const tcftrk::TcfTrkCommandResult &result);
void handleAndReportReadRegister(const tcftrk::TcfTrkCommandResult &result);
void handleAndReportReadRegistersAfterStop(const tcftrk::TcfTrkCommandResult &result);
void handleReadRegisters(const Coda::CodaCommandResult &result);
void handleRegisterChildren(const Coda::CodaCommandResult &result);
void handleAndReportReadRegisters(const Coda::CodaCommandResult &result);
void handleAndReportReadRegister(const Coda::CodaCommandResult &result);
void handleAndReportReadRegistersAfterStop(const Coda::CodaCommandResult &result);
QByteArray stopMessage() const;
void handleAndReportSetBreakpoint(const tcftrk::TcfTrkCommandResult &result);
void handleClearBreakpoint(const tcftrk::TcfTrkCommandResult &result);
void handleAndReportSetBreakpoint(const Coda::CodaCommandResult &result);
void handleClearBreakpoint(const Coda::CodaCommandResult &result);
void readMemory(uint addr, uint len, bool buffered);
void handleReadMemoryBuffered(const tcftrk::TcfTrkCommandResult &result);
void handleReadMemoryUnbuffered(const tcftrk::TcfTrkCommandResult &result);
void handleWriteMemory(const tcftrk::TcfTrkCommandResult &result);
void handleReadMemoryBuffered(const Coda::CodaCommandResult &result);
void handleReadMemoryUnbuffered(const Coda::CodaCommandResult &result);
void handleWriteMemory(const Coda::CodaCommandResult &result);
void tryAnswerGdbMemoryRequest(bool buffered);
inline void sendMemoryGetCommand(const MemoryRange &range, bool buffered);
void addThread(unsigned id);
@@ -144,7 +144,7 @@ private:
QString m_gdbServerName; // 127.0.0.1:(2222+uid)
bool m_running;
int m_stopReason;
tcftrk::TcfTrkDevice *m_trkDevice;
Coda::CodaDevice *m_trkDevice;
QSharedPointer<QIODevice> m_trkIODevice;
//
@@ -152,14 +152,14 @@ private:
//
Q_SLOT void handleGdbConnection();
Q_SLOT void readGdbServerCommand();
Q_SLOT void tcftrkDeviceError(const QString &);
Q_SLOT void codaDeviceError(const QString &);
void startGdb();
Q_SLOT void tcftrkEvent(const tcftrk::TcfTrkEvent &knownEvent);
void handleTcfTrkRunControlModuleLoadContextSuspendedEvent(const tcftrk::TcfTrkRunControlModuleLoadContextSuspendedEvent &e);
Q_SLOT void codaEvent(const Coda::CodaEvent &knownEvent);
void handleCodaRunControlModuleLoadContextSuspendedEvent(const Coda::CodaRunControlModuleLoadContextSuspendedEvent &e);
inline void sendTrkContinue();
void sendTrkStepRange();
void handleStep(const tcftrk::TcfTrkCommandResult &result);
void handleCreateProcess(const tcftrk::TcfTrkCommandResult &result);
void handleStep(const Coda::CodaCommandResult &result);
void handleCreateProcess(const Coda::CodaCommandResult &result);
void readGdbResponse();
void handleGdbServerCommand(const QByteArray &cmd);
@@ -197,4 +197,4 @@ private:
} // namespace Internal
} // namespace Debugger
#endif // DEBUGGER_TCFTRKGDBADAPTER_H
#endif // DEBUGGER_CODAGDBADAPTER_H

View File

@@ -10,7 +10,7 @@ HEADERS += \
$$PWD/termgdbadapter.h \
$$PWD/remotegdbserveradapter.h \
$$PWD/trkgdbadapter.h \
$$PWD/tcftrkgdbadapter.h \
$$PWD/codagdbadapter.h \
$$PWD/s60debuggerbluetoothstarter.h \
$$PWD/abstractgdbprocess.h \
$$PWD/localgdbprocess.h \
@@ -33,7 +33,7 @@ SOURCES += \
$$PWD/termgdbadapter.cpp \
$$PWD/remotegdbserveradapter.cpp \
$$PWD/trkgdbadapter.cpp \
$$PWD/tcftrkgdbadapter.cpp \
$$PWD/codagdbadapter.cpp \
$$PWD/s60debuggerbluetoothstarter.cpp \
$$PWD/abstractgdbprocess.cpp \
$$PWD/localgdbprocess.cpp \

View File

@@ -44,7 +44,7 @@
#include "remotegdbserveradapter.h"
#include "remoteplaingdbadapter.h"
#include "trkgdbadapter.h"
#include "tcftrkgdbadapter.h"
#include "codagdbadapter.h"
#include "debuggeractions.h"
#include "debuggerconstants.h"
@@ -1798,7 +1798,7 @@ AbstractGdbAdapter *GdbEngine::createAdapter()
case ProjectExplorer::ToolChain_RVCT_ARMV5_GNUPOC:
case ProjectExplorer::ToolChain_GCCE_GNUPOC:
if (sp.debugClient == DebuggerStartParameters::DebugClientCoda)
return new TcfTrkGdbAdapter(this);
return new CodaGdbAdapter(this);
else
return new TrkGdbAdapter(this);
default:

View File

@@ -100,7 +100,7 @@ private:
friend class RemoteGdbServerAdapter;
friend class RemotePlainGdbAdapter;
friend class TrkGdbAdapter;
friend class TcfTrkGdbAdapter;
friend class CodaGdbAdapter;
private: ////////// General Interface //////////

View File

@@ -1673,7 +1673,7 @@ void TrkGdbAdapter::handleCreateProcess(const TrkResult &result)
logMessage(startMsg, LogMisc);
// 26.8.2010: When paging occurs in S^3, bogus starting ROM addresses
// like 0x500000 or 0x40000 are reported. Warn about symbol resolution errors.
// Code duplicated in TcfTrkAdapter. @TODO: Hopefully fixed in future TRK versions.
// Code duplicated in CodaAdapter. @TODO: Hopefully fixed in future TRK versions.
if ((m_session.codeseg & 0xFFFFF) == 0) {
const QString warnMessage = tr("The reported code segment address (0x%1) might be invalid. Symbol resolution or setting breakoints may not work.").
arg(m_session.codeseg, 0, 16);