From 9c5a56a38bc41a28e5a92ace243342ab0073207a Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 12 Mar 2015 08:37:33 +0100 Subject: [PATCH] Cdb: Reduce usage of deprecated WatchData. Change-Id: Ie3d3355e51761cea7e0284bbb3e0177d5a443f36 Reviewed-by: Christian Stenger --- src/plugins/debugger/cdb/cdbengine.cpp | 52 ++++++++------------------ src/plugins/debugger/cdb/cdbengine.h | 1 - 2 files changed, 16 insertions(+), 37 deletions(-) diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 8726650cb6f..0c7ef6663a5 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -347,7 +347,6 @@ void CdbEngine::init() m_watchPointX = m_watchPointY = 0; m_ignoreCdbOutput = false; m_autoBreakPointCorrection = false; - m_watchInameToName.clear(); m_wow64State = wow64Uninitialized; m_outputBuffer.clear(); @@ -986,14 +985,10 @@ void CdbEngine::updateWatchData(const WatchData &dataIn) return; // New watch item? - if (isWatchIName(dataIn.iname) && dataIn.isValueNeeded()) { + if (dataIn.isWatcher() && dataIn.isValueNeeded()) { QByteArray args; ByteArrayInputStream str(args); str << dataIn.iname << " \"" << dataIn.exp << '"'; - // Store the name since the CDB extension library - // does not maintain the names of watches. - if (!dataIn.name.isEmpty() && dataIn.name != QLatin1String(dataIn.exp)) - m_watchInameToName.insert(dataIn.iname, dataIn.name); postExtensionCommand("addwatch", args, 0, [this, dataIn](const CdbResponse &r) { handleAddWatch(r, dataIn); }); return; @@ -1866,40 +1861,25 @@ void CdbEngine::handleLocals(const CdbResponse &response, bool newFrame) if (response.success) { if (boolSetting(VerboseLog)) showMessage(QLatin1String("Locals: ") + QString::fromLatin1(response.extensionReply), LogDebug); - QList watchData; WatchHandler *handler = watchHandler(); + GdbMi all; + all.fromString(response.extensionReply); + QTC_ASSERT(all.type() == GdbMi::List, return); + + QSet toDelete; if (newFrame) { - watchData.append(*handler->findData("local")); - watchData.append(*handler->findData("watch")); + foreach (WatchItem *item, handler->model()->treeLevelItems(2)) + toDelete.insert(item->d.iname); } - GdbMi root; - root.fromString(response.extensionReply); - QTC_ASSERT(root.type() == GdbMi::List, return); - if (debugLocals) - qDebug() << root.toString(true, 4); - // Courtesy of GDB engine - foreach (const GdbMi &child, root.children()) { - WatchData dummy; - dummy.iname = child["iname"].data(); - dummy.name = QLatin1String(child["name"].data()); - parseWatchData(dummy, child, &watchData); - } - // Fix the names of watch data. - for (int i =0; i < watchData.size(); ++i) { - if (watchData.at(i).iname.startsWith('w')) { - const QHash::const_iterator it - = m_watchInameToName.find(watchData.at(i).iname); - if (it != m_watchInameToName.constEnd()) - watchData[i].name = it.value(); - } - } - handler->insertDataList(watchData); - if (debugLocals) { - QDebug nsp = qDebug().nospace(); - nsp << "Obtained " << watchData.size() << " items:\n"; - foreach (const WatchData &wd, watchData) - nsp << wd.toString() <<'\n'; + + foreach (const GdbMi &child, all.children()) { + WatchItem *item = new WatchItem(child); + handler->insertItem(item); + toDelete.remove(item->d.iname); } + + handler->purgeOutdatedItems(toDelete); + if (newFrame) { emit stackFrameCompleted(); DebuggerToolTipManager::updateEngine(this); diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h index 540bfd740bb..76ecd6a472c 100644 --- a/src/plugins/debugger/cdb/cdbengine.h +++ b/src/plugins/debugger/cdb/cdbengine.h @@ -293,7 +293,6 @@ private: bool m_autoBreakPointCorrection; QHash m_fileNameModuleHash; QMultiHash m_symbolAddressCache; - QHash m_watchInameToName; bool m_ignoreCdbOutput; QVariantList m_customSpecialStopData; QList m_sourcePathMappings;