diff --git a/tests/manual/trk/README b/tests/manual/trk/README index 9428873eabf3510bc1f240d5dc1f961d46835284..e925e06510f216f7dd2a3fc68353c8a38b4f5af8 100644 --- a/tests/manual/trk/README +++ b/tests/manual/trk/README @@ -1,2 +1,21 @@ Run ./run.sh in one terminal. -Run ./gdb-symbian in a second terminal. +Run ./welsh-gdb or ./symbianelf-gdb in a second terminal. +Note that welsh-gdb does not handle 'set remote noack-packet on' + +The following items "work": + +- "stop" at E32Main +- manual relocation on the gdb side using + add-symbol-file filebrowseapp.sym 0x786A4000 +- disassembly at stopped location +- p <functionname> +- p $pc +- one level of 'bt' + +To do: + +- figure out why the result of the qOffsets query is not honoured + _or_ how to have gdb doing the relocation automatically +- setting breakpoints by filename:line +- signaling of stopped/single step end. SIGTRAP? SIGSTOP? +- run it against the red brick diff --git a/tests/manual/trk/adapter.cpp b/tests/manual/trk/adapter.cpp index e6acd6ecc3654b30cf3deab84ffa398b659b3fe6..4f9ef0c34725b3db24358fe3856661ff6d5377f1 100644 --- a/tests/manual/trk/adapter.cpp +++ b/tests/manual/trk/adapter.cpp @@ -196,7 +196,6 @@ private: void handleCpuType(const TrkResult &result); void handleCreateProcess(const TrkResult &result); - void handleSetBreakpoint(const TrkResult &result); void handleClearBreakpoint(const TrkResult &result); void handleSignalContinue(const TrkResult &result); void handleWaitForFinished(const TrkResult &result); @@ -208,11 +207,11 @@ private: void handleAndReportCreateProcess(const TrkResult &result); void handleAndReportReadRegisters(const TrkResult &result); QByteArray memoryReadLogMessage(uint addr, uint len, const QByteArray &ba) const; + void handleAndReportSetBreakpoint(const TrkResult &result); void handleReadMemory(const TrkResult &result); void reportReadMemory(const TrkResult &result); void reportToGdb(const TrkResult &result); - void setTrkBreakpoint(const Breakpoint &bp); void clearTrkBreakpoint(const Breakpoint &bp); void handleResult(const TrkResult &data); void readMemory(uint addr, uint len); @@ -702,7 +701,7 @@ void Adapter::handleGdbResponse(const QByteArray &response) else sendGdbMessage( "PacketSize=7cf;" - "QPassSignals+;" + //"QPassSignals+;" "qXfer:libraries:read+;" //"qXfer:auxv:read+;" "qXfer:features:read+"); @@ -744,6 +743,16 @@ void Adapter::handleGdbResponse(const QByteArray &response) m_gdbAckMode = false; } + else if (response.startsWith("QPassSignals")) { + // list of signals to pass directly to inferior + // $QPassSignals:e;10;14;17;1a;1b;1c;21;24;25;4c;#8f + // happens only if "QPassSignals+;" is qSupported + sendGdbAckMessage(); + // FIXME: use the parameters + sendGdbMessage("OK", "passing signals accepted"); + } + + else if (response == "s") { sendGdbAckMessage(); QByteArray ba; @@ -778,6 +787,42 @@ void Adapter::handleGdbResponse(const QByteArray &response) sendGdbMessageAfterSync("", "process killed"); } + else if (response.startsWith("Z0,")) { + // $z0,786a4ccc,4#99 + int pos = response.lastIndexOf(','); + bool ok = false; + uint addr = response.mid(3, pos - 1).toInt(&ok, 16); + uint len = response.mid(pos + 1).toInt(&ok, 16); + + //---IDE------------------------------------------------------ + // Command: 0x1B Set Break + //BreakType: 0x82 + // Options: 0x00 + // Address: 0x78674340 (2020033344) i.e + 0x00000340 + // Length: 0x00000001 (1) + // Count: 0x00000000 (0) + //ProcessID: 0x000001b5 (437) + // ThreadID: 0xffffffff (-1) + // [1B 09 82 00 78 67 43 40 00 00 00 01 00 00 00 00 + // 00 00 01 B5 FF FF FF FF] + QByteArray ba; + appendByte(&ba, 0x82); // unused option + appendByte(&ba, true /*bp.mode == ArmMode*/ ? 0x00 : 0x01); + appendInt(&ba, addr); + appendInt(&ba, len); + appendInt(&ba, 0x00000001); + appendInt(&ba, m_session.pid); + appendInt(&ba, 0xFFFFFFFF); + + sendTrkMessage(0x1B, CB(handleAndReportSetBreakpoint), ba); + //m_session.toekn + + //---TRK------------------------------------------------------ + // Command: 0x80 Acknowledge + // Error: 0x00 + // [80 09 00 00 00 00 0A] + } + else { logMessage("FIXME unknown: " + response); } @@ -1312,38 +1357,7 @@ void Adapter::reportReadMemory(const TrkResult &result) } } -void Adapter::setTrkBreakpoint(const Breakpoint &bp) -{ - //---IDE------------------------------------------------------ - // Command: 0x1B Set Break - //BreakType: 0x82 - // Options: 0x00 - // Address: 0x78674340 (2020033344) i.e + 0x00000340 - // Length: 0x00000001 (1) - // Count: 0x00000000 (0) - //ProcessID: 0x000001b5 (437) - // ThreadID: 0xffffffff (-1) - // [1B 09 82 00 78 67 43 40 00 00 00 01 00 00 00 00 - // 00 00 01 B5 FF FF FF FF] - QByteArray ba; - appendByte(&ba, 0x82); - appendByte(&ba, bp.mode == ArmMode ? 0x00 : 0x01); - appendInt(&ba, m_session.codeseg + bp.offset); - appendInt(&ba, 0x00000001); - appendInt(&ba, 0x00000001); - appendInt(&ba, m_session.pid); - appendInt(&ba, 0xFFFFFFFF); - - sendTrkMessage(0x1B, CB(handleSetBreakpoint), ba); - //m_session.toekn - - //---TRK------------------------------------------------------ - // Command: 0x80 Acknowledge - // Error: 0x00 - // [80 09 00 00 00 00 0A] -} - -void Adapter::handleSetBreakpoint(const TrkResult &result) +void Adapter::handleAndReportSetBreakpoint(const TrkResult &result) { //---TRK------------------------------------------------------ // Command: 0x80 Acknowledge @@ -1352,6 +1366,7 @@ void Adapter::handleSetBreakpoint(const TrkResult &result) uint bpnr = extractInt(result.data.data()); logMessage("SET BREAKPOINT " + bpnr + stringFromArray(result.data.data())); + sendGdbMessage("OK"); } void Adapter::clearTrkBreakpoint(const Breakpoint &bp) diff --git a/tests/manual/trk/trklauncher.pro b/tests/manual/trk/trklauncher.pro index 4ef8aab8994af833f6fa55cfeaf1a235c86ba803..dcdb955e50cd2c8e50cb9710a245c660fc3e1561 100644 --- a/tests/manual/trk/trklauncher.pro +++ b/tests/manual/trk/trklauncher.pro @@ -1,7 +1,5 @@ TEMPLATE = app -QT = core \ - network -QT -= gui +QT = core network include($$PWD/trklauncher.pri) DEFINES += DEBUG_TRK=1 win32:CONFIG += console diff --git a/tests/manual/trk/trkserver.cpp b/tests/manual/trk/trkserver.cpp index 6deae2ea576d30de098fefb8ae1091a7e5aac4eb..292a298de84ba4c8e7e367048f91fc869e993f29 100644 --- a/tests/manual/trk/trkserver.cpp +++ b/tests/manual/trk/trkserver.cpp @@ -406,7 +406,6 @@ void TrkServer::handleAdapterMessage(const TrkResult &result) } case 0x41: { // Delete Item writeToAdapter(0x80, result.token, data); - // A Process? // Command: 0xA1 Notify Deleted //[A1 02 00 00 00 00 00 00 00 00 01 B5] @@ -418,12 +417,18 @@ void TrkServer::handleAdapterMessage(const TrkResult &result) writeToAdapter(0xA1, nextNotificationToken(), note); break; } - default: + case 0x1B: { // Set Break + static int breakpointNumber = 10; // Trk does that + appendInt(&data, breakpointNumber++); + writeToAdapter(0x80, result.token, data); + break; + } + default: { data[0] = 0x10; // Command not supported writeToAdapter(0xff, result.token, data); break; + } } - } byte TrkServer::nextNotificationToken()