Commit 74977e12 authored by Friedemann Kleint's avatar Friedemann Kleint

Debugger: Fix some code scanning issues.

parent 236bb037
......@@ -155,7 +155,7 @@ void GdbEngine::runDebuggingHelperClassic(const WatchData &data0, bool dumpChild
QByteArray processedName = QByteArray::number(dumpChildren) + '-' + data.iname;
if (m_processedNames.contains(processedName)) {
gdbInputAvailable(LogStatus,
_("<Breaking endless loop for " + data.iname + ">"));
_("<Breaking endless loop for " + data.iname + '>'));
data.setAllUnneeded();
data.setValue(_("<unavailable>"));
data.setHasChildren(false);
......@@ -178,7 +178,7 @@ void GdbEngine::runDebuggingHelperClassic(const WatchData &data0, bool dumpChild
if (data.addr.startsWith("0x"))
addr = "(void*)" + data.addr;
else if (data.exp.isEmpty()) // happens e.g. for QAbstractItem
addr = "0";
addr = QByteArray (1, '0');
else
addr = "&(" + data.exp + ')';
......@@ -186,7 +186,7 @@ void GdbEngine::runDebuggingHelperClassic(const WatchData &data0, bool dumpChild
QString cmd;
QTextStream(&cmd) << "call " << "(void*)qDumpObjectData440(" <<
protocol << ",0," << addr << ',' << (dumpChildren ? "1" : "0")
protocol << ",0," << addr << ',' << (dumpChildren ? '1' : '0')
<< ',' << extraArgs.join(QString(_c(','))) << ')';
postCommand(cmd.toLatin1(), WatchUpdate | NonCriticalResponse);
......@@ -465,7 +465,7 @@ void GdbEngine::handleDebuggingHelperValue3Classic(const GdbResponse &response)
data1.type = data.type.left(data.type.size() - 4);
data1.iname = data.iname + '.' + QByteArray::number(i);
data1.addr = list.at(i);
data1.exp = "((" + gdbQuoteTypes(data1.type).toLatin1() + "*)" + data1.addr + ")";
data1.exp = "((" + gdbQuoteTypes(data1.type).toLatin1() + "*)" + data1.addr + ')';
data1.setHasChildren(false);
data1.setValueNeeded();
QByteArray cmd = "qdumpqstring (" + data1.exp + ')';
......@@ -787,7 +787,7 @@ void GdbEngine::handleVarListChildrenHelperClassic(const GdbMi &item,
// A type we derive from? gdb crashes when creating variables here
data.exp = parent.exp;
}
} else if (exp.startsWith("*")) {
} else if (exp.startsWith('*')) {
// A pointer
data.exp = "*(" + parent.exp + ')';
} else if (startsWithDigit(data.name)) {
......
......@@ -3310,7 +3310,7 @@ void GdbEngine::handleChildren(const WatchData &data0, const GdbMi &item,
//qDebug() << "CHILD TEMPLATE:" << childtemplate.toString();
int i = 0;
foreach (GdbMi child, children.children()) {
foreach (const GdbMi &child, children.children()) {
WatchData data1 = childtemplate;
GdbMi name = child.findChild("name");
if (name.isValid())
......
......@@ -68,7 +68,7 @@ void GdbEngine::updateLocalsPython(const QByteArray &varList)
QByteArray watchers;
if (!m_toolTipExpression.isEmpty())
watchers += m_toolTipExpression.toLatin1()
+ "#" + tooltipINameForExpression(m_toolTipExpression.toLatin1());
+ '#' + tooltipINameForExpression(m_toolTipExpression.toLatin1());
QHash<QByteArray, int> watcherNames = handler->watcherNames();
QHashIterator<QByteArray, int> it(watcherNames);
......
......@@ -94,7 +94,8 @@ static QByteArray dumpRegister(uint n, uint value)
ba += '#';
ba += QByteArray::number(n);
}
ba += "=" + hexxNumber(value);
ba += '=';
ba += hexxNumber(value);
return ba;
}
......@@ -537,7 +538,7 @@ void TrkGdbAdapter::sendGdbServerAck()
if (!m_gdbAckMode)
return;
logMessage("gdb: <- +");
sendGdbServerPacket("+", false);
sendGdbServerPacket(QByteArray(1, '+'), false);
}
void TrkGdbAdapter::sendGdbServerMessage(const QByteArray &msg, const QByteArray &logNote)
......@@ -552,7 +553,7 @@ void TrkGdbAdapter::sendGdbServerMessage(const QByteArray &msg, const QByteArray
//logMessage(QString("Packet checksum: %1").arg(sum));
QByteArray packet;
packet.append("$");
packet.append('$');
packet.append(msg);
packet.append('#');
packet.append(checkSum);
......@@ -608,7 +609,7 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
sendGdbServerMessage("OK", "extended mode enabled");
}
else if (cmd.startsWith("?")) {
else if (cmd.startsWith('?')) {
logMessage(msgGdbPacket(QLatin1String("Query halted")));
// Indicate the reason the target halted.
// The reply is the same as for step and continue.
......@@ -634,7 +635,7 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
sendTrkMessage(0x18, TrkCallback(), ba);
}
else if (cmd.startsWith("C")) {
else if (cmd.startsWith('C')) {
logMessage(msgGdbPacket(QLatin1String("Continue with signal")));
// C sig[;addr] Continue with signal sig (hex signal number)
//Reply: See section D.3 Stop Reply Packets, for the reply specifications.
......@@ -647,7 +648,7 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
sendTrkMessage(0x18, TrkCB(handleSignalContinue), ba, signalNumber);
}
else if (cmd.startsWith("D")) {
else if (cmd.startsWith('D')) {
sendGdbServerAck();
sendGdbServerMessage("OK", "shutting down");
}
......@@ -704,7 +705,7 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
trkDeleteProcessMessage(), "Delete process");
}
else if (cmd.startsWith("m")) {
else if (cmd.startsWith('m')) {
logMessage(msgGdbPacket(QLatin1String("Read memory")));
// m addr,length
sendGdbServerAck();
......@@ -728,7 +729,7 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
}
}
else if (cmd.startsWith("p")) {
else if (cmd.startsWith('p')) {
logMessage(msgGdbPacket(QLatin1String("read register")));
// 0xf == current instruction pointer?
//sendGdbServerMessage("0000", "current IP");
......@@ -760,7 +761,7 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
}
}
else if (cmd.startsWith("P")) {
else if (cmd.startsWith('P')) {
logMessage(msgGdbPacket(QLatin1String("write register")));
// $Pe=70f96678#d3
sendGdbServerAck();
......@@ -782,8 +783,8 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
// 1: attached to an existing process
// 0: created a new process
sendGdbServerAck();
sendGdbServerMessage("0", "new process created");
//sendGdbServerMessage("1", "attached to existing process");
sendGdbServerMessage(QByteArray(1, '0'), "new process created");
//sendGdbServerMessage('1', "attached to existing process");
//sendGdbServerMessage("E01", "new process created");
}
......@@ -823,7 +824,7 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
// Name=hexname,TextSeg=textaddr[,DataSeg=dataaddr]
sendGdbServerAck();
if (!m_session.libraries.isEmpty()) {
QByteArray response = "m";
QByteArray response(1, 'm');
// FIXME: Limit packet length by using qsDllInfo packages?
for (int i = 0; i != m_session.libraries.size(); ++i) {
if (i)
......@@ -835,14 +836,14 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
}
sendGdbServerMessage(response, "library information transferred");
} else {
sendGdbServerMessage("l", "library information transfer finished");
sendGdbServerMessage(QByteArray(1, 'l'), "library information transfer finished");
}
}
else if (cmd == "qsDllInfo") {
// That's a following query package
sendGdbServerAck();
sendGdbServerMessage("l", "library information transfer finished");
sendGdbServerMessage(QByteArray(1, 'l'), "library information transfer finished");
}
else if (cmd == "qPacketInfo") {
......@@ -881,20 +882,20 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
// That's the _first_ query package.
sendGdbServerAck();
if (!m_session.threads.isEmpty()) {
QByteArray response = "m";
QByteArray response(1, 'm');
// FIXME: Limit packet length by using qsThreadInfo packages?
qDebug() << "CURRENT THREAD: " << m_session.tid;
response += hexNumber(m_session.tid);
sendGdbServerMessage(response, "thread information transferred");
} else {
sendGdbServerMessage("l", "thread information transfer finished");
sendGdbServerMessage(QByteArray(1, 'l'), "thread information transfer finished");
}
}
else if (cmd == "qsThreadInfo") {
// That's a following query package
sendGdbServerAck();
sendGdbServerMessage("l", "thread information transfer finished");
sendGdbServerMessage(QByteArray(1, 'l'), "thread information transfer finished");
}
else if (cmd.startsWith("qXfer:libraries:read")) {
......
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