forked from qt-creator/qt-creator
Cdb: Reduce usage of deprecated WatchData.
Change-Id: Ie3d3355e51761cea7e0284bbb3e0177d5a443f36 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -347,7 +347,6 @@ void CdbEngine::init()
|
|||||||
m_watchPointX = m_watchPointY = 0;
|
m_watchPointX = m_watchPointY = 0;
|
||||||
m_ignoreCdbOutput = false;
|
m_ignoreCdbOutput = false;
|
||||||
m_autoBreakPointCorrection = false;
|
m_autoBreakPointCorrection = false;
|
||||||
m_watchInameToName.clear();
|
|
||||||
m_wow64State = wow64Uninitialized;
|
m_wow64State = wow64Uninitialized;
|
||||||
|
|
||||||
m_outputBuffer.clear();
|
m_outputBuffer.clear();
|
||||||
@@ -986,14 +985,10 @@ void CdbEngine::updateWatchData(const WatchData &dataIn)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// New watch item?
|
// New watch item?
|
||||||
if (isWatchIName(dataIn.iname) && dataIn.isValueNeeded()) {
|
if (dataIn.isWatcher() && dataIn.isValueNeeded()) {
|
||||||
QByteArray args;
|
QByteArray args;
|
||||||
ByteArrayInputStream str(args);
|
ByteArrayInputStream str(args);
|
||||||
str << dataIn.iname << " \"" << dataIn.exp << '"';
|
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,
|
postExtensionCommand("addwatch", args, 0,
|
||||||
[this, dataIn](const CdbResponse &r) { handleAddWatch(r, dataIn); });
|
[this, dataIn](const CdbResponse &r) { handleAddWatch(r, dataIn); });
|
||||||
return;
|
return;
|
||||||
@@ -1866,40 +1861,25 @@ void CdbEngine::handleLocals(const CdbResponse &response, bool newFrame)
|
|||||||
if (response.success) {
|
if (response.success) {
|
||||||
if (boolSetting(VerboseLog))
|
if (boolSetting(VerboseLog))
|
||||||
showMessage(QLatin1String("Locals: ") + QString::fromLatin1(response.extensionReply), LogDebug);
|
showMessage(QLatin1String("Locals: ") + QString::fromLatin1(response.extensionReply), LogDebug);
|
||||||
QList<WatchData> watchData;
|
|
||||||
WatchHandler *handler = watchHandler();
|
WatchHandler *handler = watchHandler();
|
||||||
|
GdbMi all;
|
||||||
|
all.fromString(response.extensionReply);
|
||||||
|
QTC_ASSERT(all.type() == GdbMi::List, return);
|
||||||
|
|
||||||
|
QSet<QByteArray> toDelete;
|
||||||
if (newFrame) {
|
if (newFrame) {
|
||||||
watchData.append(*handler->findData("local"));
|
foreach (WatchItem *item, handler->model()->treeLevelItems<WatchItem *>(2))
|
||||||
watchData.append(*handler->findData("watch"));
|
toDelete.insert(item->d.iname);
|
||||||
}
|
}
|
||||||
GdbMi root;
|
|
||||||
root.fromString(response.extensionReply);
|
foreach (const GdbMi &child, all.children()) {
|
||||||
QTC_ASSERT(root.type() == GdbMi::List, return);
|
WatchItem *item = new WatchItem(child);
|
||||||
if (debugLocals)
|
handler->insertItem(item);
|
||||||
qDebug() << root.toString(true, 4);
|
toDelete.remove(item->d.iname);
|
||||||
// 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<QByteArray, QString>::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';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handler->purgeOutdatedItems(toDelete);
|
||||||
|
|
||||||
if (newFrame) {
|
if (newFrame) {
|
||||||
emit stackFrameCompleted();
|
emit stackFrameCompleted();
|
||||||
DebuggerToolTipManager::updateEngine(this);
|
DebuggerToolTipManager::updateEngine(this);
|
||||||
|
|||||||
@@ -293,7 +293,6 @@ private:
|
|||||||
bool m_autoBreakPointCorrection;
|
bool m_autoBreakPointCorrection;
|
||||||
QHash<QString, QString> m_fileNameModuleHash;
|
QHash<QString, QString> m_fileNameModuleHash;
|
||||||
QMultiHash<QString, quint64> m_symbolAddressCache;
|
QMultiHash<QString, quint64> m_symbolAddressCache;
|
||||||
QHash<QByteArray, QString> m_watchInameToName;
|
|
||||||
bool m_ignoreCdbOutput;
|
bool m_ignoreCdbOutput;
|
||||||
QVariantList m_customSpecialStopData;
|
QVariantList m_customSpecialStopData;
|
||||||
QList<SourcePathMapping> m_sourcePathMappings;
|
QList<SourcePathMapping> m_sourcePathMappings;
|
||||||
|
|||||||
Reference in New Issue
Block a user