Debugger: Fix memory editing.

Typing characters > 127 caused signedness problems
(causing large uints to be passed to the debuggers).

Reviewed-by: hjk
This commit is contained in:
Friedemann Kleint
2011-04-19 12:56:23 +02:00
committed by con
parent 3fcc88fc84
commit 7ee4034ddc
2 changed files with 6 additions and 3 deletions

View File

@@ -333,8 +333,10 @@ QByteArray cdbWriteMemoryCommand(quint64 addr, const QByteArray &data)
str.setIntegerBase(16);
str << "f " << addr << " L" << data.size();
const int count = data.size();
for (int i = 0 ; i < count ; i++ )
str << ' ' << int(data.at(i));
for (int i = 0 ; i < count ; i++ ) {
const unsigned char uc = (unsigned char)data.at(i);
str << ' ' << unsigned(uc);
}
return cmd;
}

View File

@@ -3954,7 +3954,8 @@ void GdbEngine::changeMemory(MemoryAgent *agent, QObject *token,
QByteArray cmd = "-data-write-memory " + QByteArray::number(addr) + " d 1";
foreach (char c, data) {
cmd.append(' ');
cmd.append(QByteArray::number(uint(c)));
const unsigned char uc = (unsigned char)c;
cmd.append(QByteArray::number(uint(uc)));
}
postCommand(cmd, NeedsStop, CB(handleChangeMemory),
QVariant::fromValue(MemoryAgentCookie(agent, token, addr)));