Commit 7ee4034d authored by Friedemann Kleint's avatar Friedemann Kleint Committed by con
Browse files

Debugger: Fix memory editing.

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

Reviewed-by: hjk
parent 3fcc88fc
......@@ -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;
}
......
......@@ -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)));
......
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