Commit 9b8b8ba9 authored by hjk's avatar hjk Committed by David Schulz

Debugger: Replace GdbMi::findChild() with an operator[]

Less noise.

Change-Id: I8e533c97207ff5b9c79182c4fb99993f1992154f
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent 7ac0cb62
......@@ -1821,14 +1821,14 @@ void CdbEngine::handlePid(const CdbExtensionCommandPtr &reply)
static Register parseRegister(const GdbMi &gdbmiReg)
{
Register reg;
reg.name = gdbmiReg.findChild("name").data();
const GdbMi description = gdbmiReg.findChild("description");
reg.name = gdbmiReg["name"].data();
const GdbMi description = gdbmiReg["description"];
if (description.type() != GdbMi::Invalid) {
reg.name += " (";
reg.name += description.data();
reg.name += ')';
}
reg.value = gdbmiReg.findChild("value").data();
reg.value = gdbmiReg["value"].data();
return reg;
}
......@@ -1842,11 +1842,11 @@ void CdbEngine::handleModules(const CdbExtensionCommandPtr &reply)
modules.reserve(value.childCount());
foreach (const GdbMi &gdbmiModule, value.children()) {
Module module;
module.moduleName = QString::fromLatin1(gdbmiModule.findChild("name").data());
module.modulePath = QString::fromLatin1(gdbmiModule.findChild("image").data());
module.startAddress = gdbmiModule.findChild("start").data().toULongLong(0, 0);
module.endAddress = gdbmiModule.findChild("end").data().toULongLong(0, 0);
if (gdbmiModule.findChild("deferred").type() == GdbMi::Invalid)
module.moduleName = QString::fromLatin1(gdbmiModule["name"].data());
module.modulePath = QString::fromLatin1(gdbmiModule["image"].data());
module.startAddress = gdbmiModule["start"].data().toULongLong(0, 0);
module.endAddress = gdbmiModule["end"].data().toULongLong(0, 0);
if (gdbmiModule["deferred"].type() == GdbMi::Invalid)
module.symbolsRead = Module::ReadOk;
modules.push_back(module);
}
......@@ -1902,8 +1902,8 @@ void CdbEngine::handleLocals(const CdbExtensionCommandPtr &reply)
// Courtesy of GDB engine
foreach (const GdbMi &child, root.children()) {
WatchData dummy;
dummy.iname = child.findChild("iname").data();
dummy.name = QLatin1String(child.findChild("name").data());
dummy.iname = child["iname"].data();
dummy.name = QLatin1String(child["name"].data());
parseWatchData(watchHandler()->expandedINames(), dummy, child, &watchData);
}
// Fix the names of watch data.
......@@ -2023,7 +2023,7 @@ unsigned CdbEngine::examineStopReason(const GdbMi &stopReason,
rc |= StopShutdownInProgress;
if (debug)
qDebug("%s", stopReason.toString(true, 4).constData());
const QByteArray reason = stopReason.findChild("reason").data();
const QByteArray reason = stopReason["reason"].data();
if (reason.isEmpty()) {
*message = tr("Malformed stop response received.");
rc |= StopReportParseError|StopNotifyStop;
......@@ -2036,12 +2036,12 @@ unsigned CdbEngine::examineStopReason(const GdbMi &stopReason,
rc |= StopReportLog;
return rc;
}
const int threadId = stopReason.findChild("threadId").data().toInt();
const int threadId = stopReason["threadId"].data().toInt();
if (reason == "breakpoint") {
// Note: Internal breakpoints (run to line) are reported with id=0.
// Step out creates temporary breakpoints with id 10000.
int number = 0;
BreakpointModelId id = cdbIdToBreakpointModelId(stopReason.findChild("breakpointId"));
BreakpointModelId id = cdbIdToBreakpointModelId(stopReason["breakpointId"]);
if (id.isValid()) {
if (breakHandler()->engineBreakpointIds(this).contains(id)) {
const BreakpointResponse parameters = breakHandler()->response(id);
......@@ -2211,7 +2211,7 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
// Re-fetch stack again.
postCommandSequence(CommandListStack);
} else {
const GdbMi stack = stopReason.findChild("stack");
const GdbMi stack = stopReason["stack"];
if (stack.isValid()) {
switch (parseStackTrace(stack, sourceStepInto)) {
case ParseStackStepInto: // Hit on a frame while step into, see parseStackTrace().
......@@ -2222,16 +2222,16 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
return;
}
} else {
showMessage(QString::fromLatin1(stopReason.findChild("stackerror").data()), LogError);
showMessage(QString::fromLatin1(stopReason["stackerror"].data()), LogError);
}
}
const GdbMi threads = stopReason.findChild("threads");
const GdbMi threads = stopReason["threads"];
if (threads.isValid()) {
threadsHandler()->updateThreads(threads);
if (forcedThreadId.isValid())
threadsHandler()->setCurrentThread(forcedThreadId);
} else {
showMessage(QString::fromLatin1(stopReason.findChild("threaderror").data()), LogError);
showMessage(QString::fromLatin1(stopReason["threaderror"].data()), LogError);
}
// Fire off remaining commands asynchronously
if (!m_pendingBreakpointMap.isEmpty())
......@@ -2839,15 +2839,15 @@ static StackFrames parseFrames(const GdbMi &gdbmi, bool *incomplete = 0)
}
StackFrame frame;
frame.level = i;
const GdbMi fullName = frameMi.findChild("fullname");
const GdbMi fullName = frameMi["fullname"];
if (fullName.isValid()) {
frame.file = QFile::decodeName(fullName.data());
frame.line = frameMi.findChild("line").data().toInt();
frame.line = frameMi["line"].data().toInt();
frame.usable = false; // To be decided after source path mapping.
}
frame.function = QLatin1String(frameMi.findChild("func").data());
frame.from = QLatin1String(frameMi.findChild("from").data());
frame.address = frameMi.findChild("addr").data().toULongLong(0, 16);
frame.function = QLatin1String(frameMi["func"].data());
frame.from = QLatin1String(frameMi["from"].data());
frame.address = frameMi["addr"].data().toULongLong(0, 16);
rc.push_back(frame);
}
return rc;
......
......@@ -298,7 +298,7 @@ static inline bool parseThread(QByteArray line, ThreadData *thread, bool *curren
// Helper to retrieve an int child from GDBMI
static inline bool gdbmiChildToInt(const GdbMi &parent, const char *childName, int *target)
{
const GdbMi childBA = parent.findChild(childName);
const GdbMi childBA = parent[childName];
if (childBA.isValid()) {
bool ok;
const int v = childBA.data().toInt(&ok);
......@@ -313,7 +313,7 @@ static inline bool gdbmiChildToInt(const GdbMi &parent, const char *childName, i
// Helper to retrieve an bool child from GDBMI
static inline bool gdbmiChildToBool(const GdbMi &parent, const char *childName, bool *target)
{
const GdbMi childBA = parent.findChild(childName);
const GdbMi childBA = parent[childName];
if (childBA.isValid()) {
*target = childBA.data() == "true";
return true;
......@@ -331,16 +331,16 @@ void parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r,
gdbmiChildToBool(gdbmi, "deferred", &(r->pending));
r->id = BreakpointResponseId();
// Might not be valid if there is not id
r->id = cdbIdToBreakpointResponseId(gdbmi.findChild("id"));
const GdbMi moduleG = gdbmi.findChild("module");
r->id = cdbIdToBreakpointResponseId(gdbmi["id"]);
const GdbMi moduleG = gdbmi["module"];
if (moduleG.isValid())
r->module = QString::fromLocal8Bit(moduleG.data());
if (expression) {
const GdbMi expressionG = gdbmi.findChild("expression");
const GdbMi expressionG = gdbmi["expression"];
if (expressionG.isValid())
*expression = QString::fromLocal8Bit(expressionG.data());
}
const GdbMi addressG = gdbmi.findChild("address");
const GdbMi addressG = gdbmi["address"];
if (addressG.isValid())
r->address = addressG.data().toULongLong(0, 0);
if (gdbmiChildToInt(gdbmi, "passcount", &(r->ignoreCount)))
......@@ -410,23 +410,23 @@ WinException::WinException() :
void WinException::fromGdbMI(const GdbMi &gdbmi)
{
exceptionCode = gdbmi.findChild("exceptionCode").data().toUInt();
exceptionFlags = gdbmi.findChild("exceptionFlags").data().toUInt();
exceptionAddress = gdbmi.findChild("exceptionAddress").data().toULongLong();
firstChance = gdbmi.findChild("firstChance").data() != "0";
const GdbMi ginfo1 = gdbmi.findChild("exceptionInformation0");
exceptionCode = gdbmi["exceptionCode"].data().toUInt();
exceptionFlags = gdbmi["exceptionFlags"].data().toUInt();
exceptionAddress = gdbmi["exceptionAddress"].data().toULongLong();
firstChance = gdbmi["firstChance"].data() != "0";
const GdbMi ginfo1 = gdbmi["exceptionInformation0"];
if (ginfo1.isValid()) {
info1 = ginfo1.data().toULongLong();
const GdbMi ginfo2 = gdbmi.findChild("exceptionInformation1");
const GdbMi ginfo2 = gdbmi["exceptionInformation1"];
if (ginfo2.isValid())
info2 = ginfo1.data().toULongLong();
}
const GdbMi gLineNumber = gdbmi.findChild("exceptionLine");
const GdbMi gLineNumber = gdbmi["exceptionLine"];
if (gLineNumber.isValid()) {
lineNumber = gLineNumber.data().toInt();
file = gdbmi.findChild("exceptionFile").data();
file = gdbmi["exceptionFile"].data();
}
function = gdbmi.findChild("exceptionFunction").data();
function = gdbmi["exceptionFunction"].data();
}
QString WinException::toString(bool includeLocation) const
......
......@@ -331,9 +331,9 @@ void GdbMi::fromStringMultiple(const QByteArray &ba)
parseTuple_helper(from, to);
}
GdbMi GdbMi::findChild(const char *name) const
GdbMi GdbMi::operator[](const char *name) const
{
for (int i = 0; i < m_children.size(); ++i)
for (int i = 0, n = m_children.size(); i < n; ++i)
if (m_children.at(i).m_name == name)
return m_children.at(i);
return GdbMi();
......
......@@ -119,7 +119,7 @@ public:
const GdbMi &childAt(int index) const { return m_children[index]; }
GdbMi &childAt(int index) { return m_children[index]; }
GdbMi findChild(const char *name) const;
GdbMi operator[](const char *name) const;
QByteArray toString(bool multiline = false, int indent = 0) const;
qulonglong toAddress() const;
......
......@@ -65,7 +65,7 @@ void GdbAbstractPlainEngine::handleFileExecAndSymbols(const GdbResponse &respons
if (response.resultClass == GdbResultDone) {
handleInferiorPrepared();
} else {
QByteArray ba = response.data.findChild("msg").data();
QByteArray ba = response.data["msg"].data();
QString msg = fromLocalEncoding(ba);
// Extend the message a bit in unknown cases.
if (!ba.endsWith("File format not recognized"))
......@@ -92,7 +92,7 @@ void GdbAbstractPlainEngine::handleExecRun(const GdbResponse &response)
if (debuggerCore()->boolSetting(EnableReverseDebugging))
postCommand("target record");
} else {
QString msg = fromLocalEncoding(response.data.findChild("msg").data());
QString msg = fromLocalEncoding(response.data["msg"].data());
//QTC_CHECK(status() == InferiorRunOk);
//interruptInferior();
showMessage(msg);
......
......@@ -96,13 +96,13 @@ void GdbAttachEngine::handleAttach(const GdbResponse &response)
handleInferiorPrepared();
break;
case GdbResultError:
if (response.data.findChild("msg").data() == "ptrace: Operation not permitted.") {
if (response.data["msg"].data() == "ptrace: Operation not permitted.") {
notifyInferiorSetupFailed(DumperHelper::msgPtraceError(startParameters().startMode));
break;
}
// if msg != "ptrace: ..." fall through
default:
QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
QString msg = QString::fromLocal8Bit(response.data["msg"].data());
notifyInferiorSetupFailed(msg);
}
}
......
......@@ -271,7 +271,7 @@ static QByteArray qClassName(const QByteArray &qtNamespace, const char *classNam
static double getDumperVersion(const GdbMi &contents)
{
const GdbMi dumperVersionG = contents.findChild("dumperversion");
const GdbMi dumperVersionG = contents["dumperversion"];
if (dumperVersionG.type() != GdbMi::Invalid) {
bool ok;
const double v = QString::fromLatin1(dumperVersionG.data()).toDouble(&ok);
......@@ -302,10 +302,10 @@ bool DumperHelper::parseQuery(const GdbMi &contents)
qDebug() << "parseQuery" << contents.toString(true, 2);
// Common info, dumper version, etc
QByteArray ns = contents.findChild("namespace").data();
QByteArray ns = contents["namespace"].data();
setQtNamespace(ns);
int qtv = 0;
const GdbMi qtversion = contents.findChild("qtversion");
const GdbMi qtversion = contents["qtversion"];
if (qtversion.children().size() == 3) {
qtv = (qtversion.childAt(0).data().toInt() << 16)
+ (qtversion.childAt(1).data().toInt() << 8)
......@@ -314,7 +314,7 @@ bool DumperHelper::parseQuery(const GdbMi &contents)
m_qtVersion = qtv;
// Get list of helpers
QByteArrayList availableSimpleDebuggingHelpers;
foreach (const GdbMi &item, contents.findChild("dumpers").children())
foreach (const GdbMi &item, contents["dumpers"].children())
availableSimpleDebuggingHelpers.append(item.data());
// Parse types
......@@ -326,7 +326,7 @@ bool DumperHelper::parseQuery(const GdbMi &contents)
m_dumperVersion = getDumperVersion(contents);
// Parse sizes
foreach (const GdbMi &sizesList, contents.findChild("sizes").children()) {
foreach (const GdbMi &sizesList, contents["sizes"].children()) {
const int childCount = sizesList.childCount();
if (childCount > 1) {
const int size = sizesList.childAt(0).data().toInt();
......@@ -335,7 +335,7 @@ bool DumperHelper::parseQuery(const GdbMi &contents)
}
}
// Parse expressions
foreach (const GdbMi &exprList, contents.findChild("expressions").children())
foreach (const GdbMi &exprList, contents["expressions"].children())
if (exprList.childCount() == 2)
m_expressionCache.insert(exprList.childAt(0).data(),
exprList.childAt(1).data());
......@@ -1011,8 +1011,8 @@ void GdbEngine::handleDebuggingHelperValue2Classic(const GdbResponse &response)
return;
}
data.updateType(response.data.findChild("type"));
data.updateDisplayedType(response.data.findChild("displaytype"));
data.updateType(response.data["type"]);
data.updateDisplayedType(response.data["displaytype"]);
QList<WatchData> list;
parseWatchData(watchHandler()->expandedINames(), data, contents, &list);
//for (int i = 0; i != list.size(); ++i)
......@@ -1198,9 +1198,9 @@ void GdbEngine::handleStackListArgumentsClassic(const GdbResponse &response)
// is ok.
m_currentFunctionArgs.clear();
if (response.resultClass == GdbResultDone) {
const GdbMi list = response.data.findChild("stack-args");
const GdbMi frame = list.findChild("frame");
const GdbMi args = frame.findChild("args");
const GdbMi list = response.data["stack-args"];
const GdbMi frame = list["frame"];
const GdbMi args = frame["args"];
m_currentFunctionArgs = args.children();
} else {
// Seems to occur on "RedHat 4 based Linux" gdb 7.0.1:
......@@ -1215,7 +1215,7 @@ void GdbEngine::handleStackListLocalsClassic(const GdbResponse &response)
// stage 2/2
// There could be shadowed variables
QList<GdbMi> locals = response.data.findChild("locals").children();
QList<GdbMi> locals = response.data["locals"].children();
locals += m_currentFunctionArgs;
QMap<QByteArray, int> seen;
// If desired, retrieve list of uninitialized variables looking at
......@@ -1346,7 +1346,7 @@ void GdbEngine::handleQueryDebuggingHelperClassic(const GdbResponse &response)
void GdbEngine::handleDebuggingHelperVersionCheckClassic(const GdbResponse &response)
{
if (response.resultClass == GdbResultDone) {
QString value = _(response.data.findChild("value").data());
QString value = _(response.data["value"].data());
QString debuggeeQtVersion = value.section(QLatin1Char('"'), 1, 1);
QString dumperQtVersion = QLatin1String(m_dumperHelper.qtVersionString());
if (debuggeeQtVersion.isEmpty()) {
......@@ -1375,8 +1375,8 @@ void GdbEngine::handleVarListChildrenHelperClassic(const GdbMi &item,
{
//qDebug() << "VAR_LIST_CHILDREN: PARENT" << parent.toString();
//qDebug() << "VAR_LIST_CHILDREN: ITEM" << item.toString();
QByteArray exp = item.findChild("exp").data();
QByteArray name = item.findChild("name").data();
QByteArray exp = item["exp"].data();
QByteArray name = item["name"].data();
if (isAccessSpecifier(exp)) {
// Suppress 'private'/'protected'/'public' level.
WatchData data;
......@@ -1393,15 +1393,15 @@ void GdbEngine::handleVarListChildrenHelperClassic(const GdbMi &item,
postCommand(cmd, Discardable,
CB(handleVarListChildrenClassic), QVariant::fromValue(data));
} else if (!startsWithDigit(QLatin1String(exp))
&& item.findChild("numchild").data() == "0") {
&& item["numchild"].data() == "0") {
// Happens for structs without data, e.g. interfaces.
WatchData data;
data.name = _(exp);
data.iname = parent.iname + '.' + data.name.toLatin1();
data.variable = name;
data.updateType(item.findChild("type"));
data.updateType(item["type"]);
data.updateValue(item);
data.updateAddress(item.findChild("addr"));
data.updateAddress(item["addr"]);
data.setHasChildren(false);
insertData(data);
} else if (parent.iname.endsWith('.')) {
......@@ -1423,10 +1423,10 @@ void GdbEngine::handleVarListChildrenHelperClassic(const GdbMi &item,
data.iname = parent.iname + '.' + exp;
data.variable = name;
data.sortId = sortId;
data.updateType(item.findChild("type"));
data.updateType(item["type"]);
data.updateValue(item);
data.updateAddress(item.findChild("addr"));
data.updateChildCount(item.findChild("numchild"));
data.updateAddress(item["addr"]);
data.updateChildCount(item["numchild"]);
if (!watchHandler()->isExpandedIName(data.iname))
data.setChildrenUnneeded();
......@@ -1481,7 +1481,7 @@ void GdbEngine::handleVarListChildrenClassic(const GdbResponse &response)
return;
if (response.resultClass == GdbResultDone) {
//qDebug() << "VAR_LIST_CHILDREN: PARENT" << data.toString();
QList<GdbMi> children = response.data.findChild("children").children();
QList<GdbMi> children = response.data["children"].children();
if (children.isEmpty()) {
// happens e.g. if no debug information is present or
......@@ -1509,7 +1509,7 @@ void GdbEngine::handleVarListChildrenClassic(const GdbResponse &response)
handleVarListChildrenHelperClassic(children.at(i), data, i);
}
} else {
data.setError(QString::fromLocal8Bit(response.data.findChild("msg").data()));
data.setError(QString::fromLocal8Bit(response.data["msg"].data()));
}
}
......@@ -1523,7 +1523,7 @@ void GdbEngine::handleEvaluateExpressionClassic(const GdbResponse &response)
//else
data.updateValue(response.data);
} else {
data.setError(QString::fromLocal8Bit(response.data.findChild("msg").data()));
data.setError(QString::fromLocal8Bit(response.data["msg"].data()));
}
//qDebug() << "HANDLE EVALUATE EXPRESSION:" << data.toString();
insertData(data);
......
......@@ -190,7 +190,7 @@ void GdbCoreEngine::handleTargetCore(const GdbResponse &response)
}
QString msg = tr("Attach to core \"%1\" failed:\n")
.arg(startParameters().coreFile)
+ QString::fromLocal8Bit(response.data.findChild("msg").data());
+ QString::fromLocal8Bit(response.data["msg"].data());
notifyInferiorSetupFailed(msg);
}
......
This diff is collapsed.
......@@ -148,7 +148,7 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
}
GdbMi all;
all.fromStringMultiple(out);
GdbMi data = all.findChild("data");
GdbMi data = all["data"];
WatchHandler *handler = watchHandler();
QList<WatchData> list;
......@@ -161,23 +161,23 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
foreach (const GdbMi &child, data.children()) {
WatchData dummy;
dummy.iname = child.findChild("iname").data();
GdbMi wname = child.findChild("wname");
dummy.iname = child["iname"].data();
GdbMi wname = child["wname"];
if (wname.isValid()) {
// Happens (only) for watched expressions. They are encoded as
// base64 encoded 8 bit data, without quotes
dummy.name = decodeData(wname.data(), Base64Encoded8Bit);
dummy.exp = dummy.name.toUtf8();
} else {
dummy.name = _(child.findChild("name").data());
dummy.name = _(child["name"].data());
}
parseWatchData(handler->expandedINames(), dummy, child, &list);
}
const GdbMi typeInfo = all.findChild("typeinfo");
const GdbMi typeInfo = all["typeinfo"];
if (typeInfo.type() == GdbMi::List) {
foreach (const GdbMi &s, typeInfo.children()) {
const GdbMi name = s.findChild("name");
const GdbMi size = s.findChild("size");
const GdbMi name = s["name"];
const GdbMi size = s["size"];
if (name.isValid() && size.isValid())
m_typeInfoCache.insert(QByteArray::fromBase64(name.data()),
TypeInfo(size.data().toUInt()));
......
......@@ -246,7 +246,7 @@ void GdbRemoteServerEngine::handleFileExecAndSymbols(const GdbResponse &response
if (response.resultClass == GdbResultDone) {
callTargetRemote();
} else {
QByteArray reason = response.data.findChild("msg").data();
QByteArray reason = response.data["msg"].data();
QString msg = tr("Reading debug information failed:\n");
msg += QString::fromLocal8Bit(reason);
if (reason.endsWith("No such file or directory.")) {
......@@ -300,7 +300,7 @@ void GdbRemoteServerEngine::handleTargetRemote(const GdbResponse &response)
} else {
// 16^error,msg="hd:5555: Connection timed out."
QString msg = msgConnectRemoteServerFailed(
QString::fromLocal8Bit(response.data.findChild("msg").data()));
QString::fromLocal8Bit(response.data["msg"].data()));
notifyInferiorSetupFailed(msg);
}
}
......@@ -320,7 +320,7 @@ void GdbRemoteServerEngine::handleTargetExtendedRemote(const GdbResponse &respon
postCommand("attach " + QByteArray::number(m_targetPid), CB(handleTargetExtendedAttach));
} else {
QString msg = msgConnectRemoteServerFailed(
QString::fromLocal8Bit(response.data.findChild("msg").data()));
QString::fromLocal8Bit(response.data["msg"].data()));
notifyInferiorSetupFailed(msg);
}
}
......@@ -333,7 +333,7 @@ void GdbRemoteServerEngine::handleTargetExtendedAttach(const GdbResponse &respon
handleInferiorPrepared();
} else {
QString msg = msgConnectRemoteServerFailed(
QString::fromLocal8Bit(response.data.findChild("msg").data()));
QString::fromLocal8Bit(response.data["msg"].data()));
notifyInferiorSetupFailed(msg);
}
}
......@@ -361,7 +361,7 @@ void GdbRemoteServerEngine::handleTargetQnx(const GdbResponse &response)
} else {
// 16^error,msg="hd:5555: Connection timed out."
QString msg = msgConnectRemoteServerFailed(
QString::fromLocal8Bit(response.data.findChild("msg").data()));
QString::fromLocal8Bit(response.data["msg"].data()));
notifyInferiorSetupFailed(msg);
}
}
......@@ -378,13 +378,13 @@ void GdbRemoteServerEngine::handleAttach(const GdbResponse &response)
break;
}
case GdbResultError:
if (response.data.findChild("msg").data() == "ptrace: Operation not permitted.") {
if (response.data["msg"].data() == "ptrace: Operation not permitted.") {
notifyInferiorSetupFailed(DumperHelper::msgPtraceError(startParameters().startMode));
break;
}
// if msg != "ptrace: ..." fall through
default:
QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
QString msg = QString::fromLocal8Bit(response.data["msg"].data());
notifyInferiorSetupFailed(msg);
}
}
......@@ -418,7 +418,7 @@ void GdbRemoteServerEngine::handleExecRun(const GdbResponse &response)
showMessage(_("INFERIOR STARTED"));
showMessage(msgInferiorSetupOk(), StatusBar);
} else {
QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
QString msg = QString::fromLocal8Bit(response.data["msg"].data());
showMessage(msg);
notifyEngineRunFailed();
}
......
......@@ -168,11 +168,11 @@ void GdbTermEngine::handleStubAttached(const GdbResponse &response)
handleInferiorPrepared();
break;
case GdbResultError:
if (response.data.findChild("msg").data() == "ptrace: Operation not permitted.") {
if (response.data["msg"].data() == "ptrace: Operation not permitted.") {
notifyInferiorSetupFailed(DumperHelper::msgPtraceError(startParameters().startMode));
break;
}
notifyInferiorSetupFailed(QString::fromLocal8Bit(response.data.findChild("msg").data()));
notifyInferiorSetupFailed(QString::fromLocal8Bit(response.data["msg"].data()));
break;
default:
notifyInferiorSetupFailed(QString::fromLatin1("Invalid response %1").arg(response.resultClass));
......
......@@ -411,36 +411,36 @@ void LldbEngine::attemptBreakpointSynchronization()
void LldbEngine::updateBreakpointData(const GdbMi &bkpt, bool added)
{
BreakHandler *handler = breakHandler();
BreakpointModelId id = BreakpointModelId(bkpt.findChild("modelid").data());
BreakpointModelId id = BreakpointModelId(bkpt["modelid"].data());
BreakpointResponse response = handler->response(id);
BreakpointResponseId rid = BreakpointResponseId(bkpt.findChild("lldbid").data());
BreakpointResponseId rid = BreakpointResponseId(bkpt["lldbid"].data());
if (added)
response.id = rid;
QTC_CHECK(response.id == rid);
response.address = 0;
response.enabled = bkpt.findChild("enabled").data().toInt();
response.ignoreCount = bkpt.findChild("ignorecount").data().toInt();
response.condition = bkpt.findChild("condition").data();
response.hitCount = bkpt.findChild("hitcount").data().toInt();
response.enabled = bkpt["enabled"].data().toInt();
response.ignoreCount = bkpt["ignorecount"].data().toInt();
response.condition = bkpt["condition"].data();
response.hitCount = bkpt["hitcount"].data().toInt();
if (added) {
// Added.
GdbMi locations = bkpt.findChild("locations");
GdbMi locations = bkpt["locations"];
const int numChild = locations.children().size();
if (numChild > 1) {
foreach (const GdbMi &location, locations.children()) {
BreakpointResponse sub;
sub.id = BreakpointResponseId(rid.majorPart(),
location.findChild("subid").data().toUShort());
location["subid"].data().toUShort());
sub.type = response.type;
sub.address = location.findChild("addr").toAddress();
sub.functionName = QString::fromUtf8(location.findChild("func").data());
sub.address = location["addr"].toAddress();
sub.functionName = QString::fromUtf8(location["func"].data());
handler->insertSubBreakpoint(id, sub);
}
} else if (numChild == 1) {
const GdbMi location = locations.childAt(0);
response.address = location.findChild("addr").toAddress();
response.functionName = QString::fromUtf8(location.findChild("func").data());
response.address = location["addr"].toAddress();
response.functionName = QString::fromUtf8(location["func"].data());
} else {
QTC_CHECK(false);
}
......@@ -459,11 +459,11 @@ void LldbEngine::refreshDisassembly(const GdbMi &lines)
foreach (const GdbMi &line, lines.children()) {
DisassemblerLine dl;