forked from qt-creator/qt-creator
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:
@@ -85,7 +85,7 @@ void AttachGdbAdapter::handleAttach(const GdbResponse &response)
|
||||
emit inferiorPrepared();
|
||||
m_engine->updateAll();
|
||||
} else {
|
||||
QString msg = __(response.data.findChild("msg").data());
|
||||
QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
|
||||
emit inferiorStartFailed(msg);
|
||||
}
|
||||
}
|
||||
|
@@ -108,7 +108,7 @@ void CoreGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
|
||||
showStatusMessage(tr("Symbols found."));
|
||||
} else {
|
||||
QString msg = tr("Loading symbols from \"%1\" failed:\n").arg(m_executable)
|
||||
+ __(response.data.findChild("msg").data());
|
||||
+ QString::fromLocal8Bit(response.data.findChild("msg").data());
|
||||
showMessageBox(QMessageBox::Warning, tr("Error Loading Symbols"), msg);
|
||||
}
|
||||
loadCoreFile();
|
||||
@@ -160,7 +160,7 @@ void CoreGdbAdapter::handleTargetCore(const GdbResponse &response)
|
||||
m_engine->updateAll();
|
||||
} else {
|
||||
QString msg = tr("Attach to core \"%1\" failed:\n").arg(startParameters().coreFile)
|
||||
+ __(response.data.findChild("msg").data());
|
||||
+ QString::fromLocal8Bit(response.data.findChild("msg").data());
|
||||
emit inferiorStartFailed(msg);
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -121,7 +121,7 @@ void PlainGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
|
||||
emit inferiorPrepared();
|
||||
} else {
|
||||
QString msg = tr("Starting executable failed:\n") +
|
||||
__(response.data.findChild("msg").data());
|
||||
QString::fromLocal8Bit(response.data.findChild("msg").data());
|
||||
emit inferiorStartFailed(msg);
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ void PlainGdbAdapter::handleExecRun(const GdbResponse &response)
|
||||
showStatusMessage(msgInferiorStarted());
|
||||
} else {
|
||||
QTC_ASSERT(state() == InferiorRunningRequested, qDebug() << state());
|
||||
const QByteArray &msg = response.data.findChild("msg").data();
|
||||
const QString &msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
|
||||
//QTC_ASSERT(status() == InferiorRunning, /**/);
|
||||
//interruptInferior();
|
||||
emit inferiorStartFailed(msg);
|
||||
|
@@ -203,7 +203,7 @@ void RemoteGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
|
||||
CB(handleTargetRemote));
|
||||
} else {
|
||||
QString msg = tr("Starting remote executable failed:\n");
|
||||
msg += __(response.data.findChild("msg").data());
|
||||
msg += QString::fromLocal8Bit(response.data.findChild("msg").data());
|
||||
emit inferiorStartFailed(msg);
|
||||
}
|
||||
}
|
||||
@@ -219,7 +219,8 @@ void RemoteGdbAdapter::handleTargetRemote(const GdbResponse &record)
|
||||
emit inferiorPrepared();
|
||||
} else {
|
||||
// 16^error,msg="hd:5555: Connection timed out."
|
||||
QString msg = msgConnectRemoteServerFailed(__(record.data.findChild("msg").data()));
|
||||
QString msg = msgConnectRemoteServerFailed(
|
||||
QString::fromLocal8Bit(record.data.findChild("msg").data()));
|
||||
emit inferiorStartFailed(msg);
|
||||
}
|
||||
}
|
||||
|
@@ -143,7 +143,7 @@ void TermGdbAdapter::handleStubAttached(const GdbResponse &response)
|
||||
m_engine->postCommand(_("-stack-list-frames 0 0"), CB(handleEntryPoint));
|
||||
#endif
|
||||
} else if (response.resultClass == GdbResultError) {
|
||||
QString msg = _(response.data.findChild("msg").data());
|
||||
QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
|
||||
emit inferiorStartFailed(msg);
|
||||
}
|
||||
}
|
||||
|
@@ -1628,7 +1628,7 @@ void TrkGdbAdapter::handleTargetRemote(const GdbResponse &record)
|
||||
emit inferiorPrepared();
|
||||
} else {
|
||||
QString msg = tr("Connecting to TRK server adapter failed:\n")
|
||||
+ _(record.data.findChild("msg").data());
|
||||
+ QString::fromLocal8Bit(record.data.findChild("msg").data());
|
||||
emit inferiorStartFailed(msg);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user