void WinException::fromGdbMI(const GdbMi &gdbmi) { 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["exceptionInformation1"]; if (ginfo2.isValid()) info2 = ginfo1.data().toULongLong(); } const GdbMi gLineNumber = gdbmi["exceptionLine"]; if (gLineNumber.isValid()) { lineNumber = gLineNumber.toInt(); file = gdbmi["exceptionFile"].data(); } function = gdbmi["exceptionFunction"].data(); }
void WatchItem::parseHelper(const GdbMi &input) { setChildrenUnneeded(); GdbMi mi = input["type"]; if (mi.isValid()) setType(mi.data()); editvalue = input["editvalue"].data(); editformat = DebuggerDisplay(input["editformat"].toInt()); editencoding = DebuggerEncoding(input["editencoding"].data()); mi = input["valueelided"]; if (mi.isValid()) elided = mi.toInt(); mi = input["bitpos"]; if (mi.isValid()) bitpos = mi.toInt(); mi = input["bitsize"]; if (mi.isValid()) bitsize = mi.toInt(); mi = input["origaddr"]; if (mi.isValid()) origaddr = mi.toAddress(); mi = input["address"]; if (mi.isValid()) { address = mi.toAddress(); if (exp.isEmpty()) { if (iname.startsWith("local.") && iname.count('.') == 1) // Solve one common case of adding 'class' in // *(class X*)0xdeadbeef for gdb. exp = name.toLatin1(); else exp = "*(" + gdbQuoteTypes(type) + "*)" + hexAddress(); } } mi = input["value"]; QByteArray enc = input["valueencoded"].data(); if (mi.isValid() || !enc.isEmpty()) { setValue(decodeData(mi.data(), enc)); } else { setValueNeeded(); } mi = input["size"]; if (mi.isValid()) size = mi.toInt(); mi = input["exp"]; if (mi.isValid()) exp = mi.data(); mi = input["valueenabled"]; if (mi.data() == "true") valueEnabled = true; else if (mi.data() == "false") valueEnabled = false; mi = input["valueeditable"]; if (mi.data() == "true") valueEditable = true; else if (mi.data() == "false") valueEditable = false; mi = input["numchild"]; // GDB/MI if (mi.isValid()) setHasChildren(mi.toInt() > 0); mi = input["haschild"]; // native-mixed if (mi.isValid()) setHasChildren(mi.toInt() > 0); mi = input["arraydata"]; if (mi.isValid()) { DebuggerEncoding encoding(input["arrayencoding"].data()); QByteArray childType = input["childtype"].data(); decodeArrayData(this, mi.data(), encoding, childType); } else { const GdbMi children = input["children"]; if (children.isValid()) { bool ok = false; // Try not to repeat data too often. const GdbMi childType = input["childtype"]; const GdbMi childNumChild = input["childnumchild"]; qulonglong addressBase = input["addrbase"].data().toULongLong(&ok, 0); qulonglong addressStep = input["addrstep"].data().toULongLong(&ok, 0); for (int i = 0, n = int(children.children().size()); i != n; ++i) { const GdbMi &subinput = children.children().at(i); WatchItem *child = new WatchItem; if (childType.isValid()) child->setType(childType.data()); if (childNumChild.isValid()) child->setHasChildren(childNumChild.toInt() > 0); GdbMi name = subinput["name"]; QByteArray nn; if (name.isValid()) { nn = name.data(); child->name = QString::fromLatin1(nn); } else { nn.setNum(i); child->name = QString::fromLatin1("[%1]").arg(i); } GdbMi iname = subinput["iname"]; if (iname.isValid()) child->iname = iname.data(); else child->iname = this->iname + '.' + nn; if (addressStep) { child->address = addressBase + i * addressStep; child->exp = "*(" + gdbQuoteTypes(child->type) + "*)" + child->hexAddress(); } QByteArray key = subinput["key"].data(); if (!key.isEmpty()) child->name = decodeData(key, subinput["keyencoded"].data()); child->parseHelper(subinput); appendChild(child); } } } }