Commit 403c344c authored by hjk's avatar hjk
Browse files

debugger: add a 'swapendian' 'tool' to convert endianness of memory dumps

parent c2ea5e7b
......@@ -396,7 +396,8 @@ void Adapter::handleGdbResponse(const QByteArray &response)
else if (response == "!") {
sendGdbAckMessage();
sendGdbMessage("OK", "extended mode enabled");
sendGdbMessage("", "extended mode not enabled");
//sendGdbMessage("OK", "extended mode enabled");
}
else if (response.startsWith("?")) {
......@@ -645,6 +646,16 @@ void Adapter::handleGdbResponse(const QByteArray &response)
// // vCont[;action[:thread-id]]...'
//}
else if (response.startsWith("vKill")) {
// kill
sendGdbAckMessage();
QByteArray ba;
appendByte(&ba, 0); // Sub-command: Delete Process
appendInt(&ba, m_session.pid);
sendTrkMessage(0x41, 0, ba, "Delete process"); // Delete Item
sendGdbMessageAfterSync("", "process killed");
}
else {
logMessage("FIXME unknown: " + response);
}
......@@ -886,7 +897,8 @@ void Adapter::handleResult(const TrkResult &result)
// uint tid = extractInt(data + 8); // ThreadID: 4 bytes
//logMessage(prefix << " ADDR: " << addr << " PID: " << pid << " TID: " << tid);
sendTrkAck(result.token);
sendGdbMessage("S11", "Target stopped");
//sendGdbMessage("S11", "Target stopped");
sendGdbMessage("S05", "Target stopped");
break;
}
case 0x91: { // Notify Exception (obsolete)
......
......@@ -10,6 +10,7 @@ trkservername="TRKSERVER-${userid}";
gdbserverip=127.0.0.1
gdbserverport=$[2222 + ${userid}]
memorydump=TrkDump-78-6a-40-00.bin
memorydump=TrkDump-78-6a-40-00-BigEndian.bin
fuser -n tcp -k ${gdbserverport}
rm /tmp/${trkservername}
......
#include <QtCore>
int main(int argc, char *argv[])
{
QFile file1(argv[1]);
file1.open(QIODevice::ReadOnly);
QByteArray ba = file1.readAll();
file1.close();
for (int i = 0; i < ba.size(); i += 4) {
char c = ba[i]; ba[i] = ba[i + 3]; ba[i + 3] = c;
c = ba[i + 1]; ba[i + 1] = ba[i + 2]; ba[i + 2] = c;
}
QFile file2(argv[2]);
file2.open(QIODevice::WriteOnly);
file2.write(ba);
file2.close();
}
TEMPLATE = app
QT = core
HEADERS += \
SOURCES += \
swapendian.cpp
TEMPLATE = subdirs
SUBDIRS = trkserver adapter
SUBDIRS = trkserver adapter swapendian
trkserver.file = trkserver.pro
adapter.file = adapter.pro
swapendian.file = swapendian.pro
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