void LldbEngine::updateBreakpointData(const GdbMi &bkpt, bool added) { BreakHandler *handler = breakHandler(); BreakpointResponseId rid = BreakpointResponseId(bkpt["lldbid"].data()); BreakpointModelId id = BreakpointModelId(bkpt["modelid"].data()); Breakpoint bp = handler->breakpointById(id); if (!bp.isValid()) bp = handler->findBreakpointByResponseId(rid); BreakpointResponse response = bp.response(); if (added) response.id = rid; QTC_CHECK(response.id == rid); response.address = 0; response.enabled = bkpt["enabled"].toInt(); response.ignoreCount = bkpt["ignorecount"].toInt(); response.condition = QByteArray::fromHex(bkpt["condition"].data()); response.hitCount = bkpt["hitcount"].toInt(); response.fileName = bkpt["file"].toUtf8(); response.lineNumber = bkpt["line"].toInt(); GdbMi locations = bkpt["locations"]; const int numChild = int(locations.children().size()); if (numChild > 1) { foreach (const GdbMi &location, locations.children()) { const int locid = location["locid"].toInt(); BreakpointResponse sub; sub.id = BreakpointResponseId(rid.majorPart(), locid); sub.type = response.type; sub.address = location["addr"].toAddress(); sub.functionName = location["func"].toUtf8(); sub.fileName = location["file"].toUtf8(); sub.lineNumber = location["line"].toInt(); bp.insertSubBreakpoint(sub); } } else if (numChild == 1) {
void LldbEngine::handleResponse(const QByteArray &response) { GdbMi all; all.fromStringMultiple(response); foreach (const GdbMi &item, all.children()) { const QByteArray name = item.name(); if (name == "all") { updateLocalsView(item); watchHandler()->notifyUpdateFinished(); } else if (name == "dumpers") { watchHandler()->addDumpers(item); setupInferiorStage2(); } else if (name == "stack") refreshStack(item); else if (name == "registers") refreshRegisters(item); else if (name == "threads") refreshThreads(item); else if (name == "current-thread") refreshCurrentThread(item); else if (name == "typeinfo") refreshTypeInfo(item); else if (name == "state") refreshState(item); else if (name == "location") refreshLocation(item); else if (name == "modules") refreshModules(item); else if (name == "symbols") refreshSymbols(item); else if (name == "breakpoint-added") refreshAddedBreakpoint(item); else if (name == "breakpoint-changed") refreshChangedBreakpoint(item); else if (name == "breakpoint-removed") refreshRemovedBreakpoint(item); else if (name == "output") refreshOutput(item); else if (name == "disassembly") refreshDisassembly(item); else if (name == "memory") refreshMemory(item); else if (name == "full-backtrace") showFullBacktrace(item); else if (name == "continuation") handleContinuation(item); else if (name == "statusmessage") { QString msg = QString::fromUtf8(item.data()); if (msg.size()) msg[0] = msg.at(0).toUpper(); showStatusMessage(msg); } } }
void PdbEngine::handleListSymbols(const PdbResponse &response) { GdbMi out; out.fromString(response.data.trimmed()); Symbols symbols; QString moduleName = response.cookie.toString(); foreach (const GdbMi &item, out.children()) { Symbol symbol; symbol.name = _(item.findChild("name").data()); symbols.append(symbol); } debuggerCore()->showModuleSymbols(moduleName, symbols); }
void PdbEngine::refreshModules(const GdbMi &modules) { ModulesHandler *handler = modulesHandler(); handler->beginUpdateAll(); foreach (const GdbMi &item, modules.children()) { Module module; module.moduleName = _(item["name"].data()); QString path = _(item["value"].data()); int pos = path.indexOf(_("' from '")); if (pos != -1) { path = path.mid(pos + 8); if (path.size() >= 2) path.chop(2); } else if (path.startsWith(_("<module '")) && path.endsWith(_("' (built-in)>"))) { path = _("(builtin)"); } module.modulePath = path; handler->updateModule(module); } handler->endUpdateAll(); }
void PdbEngine::handleListModules(const PdbResponse &response) { GdbMi out; out.fromString(response.data.trimmed()); Modules modules; foreach (const GdbMi &item, out.children()) { Module module; module.moduleName = _(item.findChild("name").data()); QString path = _(item.findChild("value").data()); int pos = path.indexOf(_("' from '")); if (pos != -1) { path = path.mid(pos + 8); if (path.size() >= 2) path.chop(2); } else if (path.startsWith(_("<module '")) && path.endsWith(_("' (built-in)>"))) { path = _("(builtin)"); } module.modulePath = path; modules.append(module); } modulesHandler()->setModules(modules); }
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); } } } }