diff --git a/src/plugins/debugger/cdb/cdbstackframecontext.cpp b/src/plugins/debugger/cdb/cdbstackframecontext.cpp index 2128fc8ceabcb4548bcab8b1fe72843cb50a77eb..a3b3ac1d5397c366a08f43730052b75abfb98d01 100644 --- a/src/plugins/debugger/cdb/cdbstackframecontext.cpp +++ b/src/plugins/debugger/cdb/cdbstackframecontext.cpp @@ -49,7 +49,7 @@ typedef QList<WatchData> WatchDataList; inline bool truePredicate(const WatchData & /* whatever */) { return true; } inline bool falsePredicate(const WatchData & /* whatever */) { return false; } inline bool isDumperPredicate(const WatchData &wd) -{ return wd.source == OwnerDumper; } +{ return (wd.source & CdbStackFrameContext::SourceMask) == OwnerDumper; } static inline void debugWatchDataList(const QList<WatchData> &l, const char *why = 0) { @@ -155,14 +155,14 @@ bool WatchHandleDumperInserter::expandPointerToDumpable(const WatchData &wd, QSt derefedWd.setAddress(hexAddrS); derefedWd.name = QString(QLatin1Char('*')); derefedWd.iname = wd.iname + QLatin1String(".*"); - derefedWd.source = OwnerDumper; + derefedWd.source = OwnerDumper | CdbStackFrameContext::ChildrenKnownBit; const CdbDumperHelper::DumpResult dr = m_dumper->dumpType(derefedWd, true, OwnerDumper, &m_dumperResult, errorMessage); if (dr != CdbDumperHelper::DumpOk) break; // Insert the pointer item with 1 additional child + its dumper results // Note: formal arguments might already be expanded in the symbol group. WatchData ptrWd = wd; - ptrWd.source = OwnerDumper; + ptrWd.source = OwnerDumper | CdbStackFrameContext::ChildrenKnownBit; ptrWd.setHasChildren(true); ptrWd.setChildrenUnneeded(); m_wh->insertData(ptrWd); @@ -200,6 +200,9 @@ static inline void fixDumperResult(const WatchData &source, } if (size == 1) return; + // If the model queries the expanding item by pretending childrenNeeded=1, + // refuse the request as the children are already known + returned.source |= CdbStackFrameContext::ChildrenKnownBit; // Fix the children: If the address is missing, we cannot query any further. const QList<WatchData>::iterator wend = result->end(); QList<WatchData>::iterator it = result->begin(); @@ -230,7 +233,7 @@ WatchHandleDumperInserter &WatchHandleDumperInserter::operator=(WatchData &wd) return *this; } // Expanded by internal dumper? : ok - if (wd.source == OwnerSymbolGroupDumper) { + if ((wd.source & CdbStackFrameContext::SourceMask) == OwnerSymbolGroupDumper) { m_wh->insertData(wd); return *this; } @@ -312,7 +315,15 @@ bool CdbStackFrameContext::completeData(const WatchData &incompleteLocal, } // Expand artifical dumper items - if (incompleteLocal.source == OwnerDumper) { + if ((incompleteLocal.source & CdbStackFrameContext::SourceMask) == OwnerDumper) { + // If the model queries the expanding item by pretending childrenNeeded=1, + // refuse the request if the children are already known + if (incompleteLocal.state == WatchData::ChildrenNeeded && (incompleteLocal.source & CdbStackFrameContext::ChildrenKnownBit)) { + WatchData local = incompleteLocal; + local.setChildrenUnneeded(); + wh->insertData(local); + return true; + } QList<WatchData> dumperResult; const CdbDumperHelper::DumpResult dr = m_dumper->dumpType(incompleteLocal, true, OwnerDumper, &dumperResult, errorMessage); if (dr == CdbDumperHelper::DumpOk) { diff --git a/src/plugins/debugger/cdb/cdbstackframecontext.h b/src/plugins/debugger/cdb/cdbstackframecontext.h index f9ba79c9f8309f844ccba6b7a8a21d02e36034f7..011d804517632806dbfb958b03721685a0ecc028 100644 --- a/src/plugins/debugger/cdb/cdbstackframecontext.h +++ b/src/plugins/debugger/cdb/cdbstackframecontext.h @@ -49,6 +49,9 @@ class CdbStackFrameContext { Q_DISABLE_COPY(CdbStackFrameContext) public: + // Mask bits for the source field of watch data. + enum { SourceMask = 0xFF, ChildrenKnownBit = 0x0100 }; + explicit CdbStackFrameContext(const QSharedPointer<CdbDumperHelper> &dumper, CdbSymbolGroupContext *symbolContext); ~CdbStackFrameContext();