properly decode messages from gdb

... using fromLocal8Bit instead of fromLatin1.
of course the localized messages pose a "challenge" for the various
workarounds which parse them ...

Task-number: QTCREATORBUG-504
This commit is contained in:
Oswald Buddenhagen
2010-01-04 14:11:07 +01:00
parent 031d6c1690
commit 5fd1e3c454
7 changed files with 17 additions and 14 deletions

View File

@@ -1518,7 +1518,8 @@ void GdbEngine::handleInferiorShutdown(const GdbResponse &response)
} else {
debugMessage(_("INFERIOR SHUTDOWN FAILED"));
setState(InferiorShutdownFailed);
QString msg = m_gdbAdapter->msgInferiorStopFailed(_(response.data.findChild("msg").data()));
QString msg = m_gdbAdapter->msgInferiorStopFailed(
QString::fromLocal8Bit(response.data.findChild("msg").data()));
showMessageBox(QMessageBox::Critical, tr("Inferior shutdown failed"), msg);
}
shutdown(); // re-iterate...
@@ -1531,7 +1532,8 @@ void GdbEngine::handleGdbExit(const GdbResponse &response)
m_commandsDoneCallback = 0;
// don't set state here, this will be handled in handleGdbFinished()
} else {
QString msg = m_gdbAdapter->msgGdbStopFailed(_(response.data.findChild("msg").data()));
QString msg = m_gdbAdapter->msgGdbStopFailed(
QString::fromLocal8Bit(response.data.findChild("msg").data()));
debugMessage(_("GDB WON'T EXIT (%1); KILLING IT").arg(msg));
m_gdbProc.kill();
}
@@ -4229,7 +4231,7 @@ void GdbEngine::handleFetchDisassemblerByLine(const GdbResponse &response)
if (msg == "mi_cmd_disassemble: Invalid line number")
fetchDisassemblerByAddress(ac.agent, true);
else
showStatusMessage(tr("Disassembler failed: %1").arg(_(msg)), 5000);
showStatusMessage(tr("Disassembler failed: %1").arg(QString::fromLocal8Bit(msg)), 5000);
}
}
@@ -4254,7 +4256,7 @@ void GdbEngine::handleFetchDisassemblerByAddress1(const GdbResponse &response)
} else {
// 26^error,msg="Cannot access memory at address 0x801ca308"
QByteArray msg = response.data.findChild("msg").data();
showStatusMessage(tr("Disassembler failed: %1").arg(_(msg)), 5000);
showStatusMessage(tr("Disassembler failed: %1").arg(QString::fromLocal8Bit(msg)), 5000);
}
}
@@ -4268,7 +4270,7 @@ void GdbEngine::handleFetchDisassemblerByAddress0(const GdbResponse &response)
ac.agent->setContents(parseDisassembler(lines));
} else {
QByteArray msg = response.data.findChild("msg").data();
showStatusMessage(tr("Disassembler failed: %1").arg(_(msg)), 5000);
showStatusMessage(tr("Disassembler failed: %1").arg(QString::fromLocal8Bit(msg)), 5000);
}
}