forked from qt-creator/qt-creator
Compile new watch model for CDB.
This commit is contained in:
@@ -813,23 +813,15 @@ bool CdbDebugEnginePrivate::updateLocals(int frameIndex,
|
|||||||
WatchHandler *wh,
|
WatchHandler *wh,
|
||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
wh->reinitializeWatchers();
|
wh->beginCycle();
|
||||||
|
|
||||||
QList<WatchData> incompletes = wh->takeCurrentIncompletes();
|
|
||||||
if (debugCDB)
|
if (debugCDB)
|
||||||
qDebug() << Q_FUNC_INFO << "\n " << frameIndex << formatWatchList(incompletes);
|
qDebug() << Q_FUNC_INFO << "\n " << frameIndex;
|
||||||
|
|
||||||
m_engine->filterEvaluateWatchers(&incompletes, wh);
|
|
||||||
if (!incompletes.empty()) {
|
|
||||||
const QString msg = QLatin1String("Warning: Locals left in incomplete list: ") + formatWatchList(incompletes);
|
|
||||||
m_engine->warning(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (CdbStackFrameContext *sgc = getStackFrameContext(frameIndex, errorMessage))
|
if (CdbStackFrameContext *sgc = getStackFrameContext(frameIndex, errorMessage))
|
||||||
success = sgc->populateModelInitially(wh, errorMessage);
|
success = sgc->populateModelInitially(wh, errorMessage);
|
||||||
|
|
||||||
wh->rebuildModel();
|
wh->endCycle();
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -850,40 +842,7 @@ void CdbDebugEngine::evaluateWatcher(WatchData *wd)
|
|||||||
wd->setChildCount(0);
|
wd->setChildCount(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbDebugEngine::filterEvaluateWatchers(QList<WatchData> *wd, WatchHandler *wh)
|
void CdbDebugEngine::updateWatchData(const WatchData &incomplete)
|
||||||
{
|
|
||||||
typedef QList<WatchData> WatchList;
|
|
||||||
if (wd->empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Filter out actual watchers. Ignore the "<Edit>" top level place holders
|
|
||||||
SyntaxSetter syntaxSetter(m_d->m_cif.debugControl, DEBUG_EXPR_CPLUSPLUS);
|
|
||||||
const QString watcherPrefix = QLatin1String("watch.");
|
|
||||||
const QChar lessThan = QLatin1Char('<');
|
|
||||||
const QChar greaterThan = QLatin1Char('>');
|
|
||||||
bool placeHolderSeen = false;
|
|
||||||
for (WatchList::iterator it = wd->begin(); it != wd->end(); ) {
|
|
||||||
if (it->iname.startsWith(watcherPrefix)) {
|
|
||||||
const bool isPlaceHolder = it->exp.startsWith(lessThan) && it->exp.endsWith(greaterThan);
|
|
||||||
if (isPlaceHolder) {
|
|
||||||
if (!placeHolderSeen) { // Max one place holder
|
|
||||||
it->setChildCount(0);
|
|
||||||
it->setAllUnneeded();
|
|
||||||
wh->insertData(*it);
|
|
||||||
placeHolderSeen = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
evaluateWatcher(&(*it));
|
|
||||||
wh->insertData(*it);
|
|
||||||
}
|
|
||||||
it = wd->erase(it);
|
|
||||||
} else {
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CdbDebugEngine::updateWatchModel()
|
|
||||||
{
|
{
|
||||||
// Stack trace exists and evaluation funcs can only be called
|
// Stack trace exists and evaluation funcs can only be called
|
||||||
// when running
|
// when running
|
||||||
@@ -892,27 +851,27 @@ void CdbDebugEngine::updateWatchModel()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WatchHandler *watchHandler = m_d->m_debuggerManagerAccess->watchHandler();
|
||||||
|
if (incomplete.iname.startsWith(QLatin1String("watch."))) {
|
||||||
|
WatchData watchData = incomplete;
|
||||||
|
evaluateWatcher(&watchData);
|
||||||
|
watchHandler->insertData(watchData);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const int frameIndex = m_d->m_debuggerManagerAccess->stackHandler()->currentIndex();
|
const int frameIndex = m_d->m_debuggerManagerAccess->stackHandler()->currentIndex();
|
||||||
|
|
||||||
WatchHandler *watchHandler = m_d->m_debuggerManagerAccess->watchHandler();
|
|
||||||
WatchList incomplete = watchHandler->takeCurrentIncompletes();
|
|
||||||
if (incomplete.empty())
|
|
||||||
return;
|
|
||||||
if (debugCDB)
|
if (debugCDB)
|
||||||
qDebug() << Q_FUNC_INFO << "\n fi=" << frameIndex << formatWatchList(incomplete);
|
qDebug() << Q_FUNC_INFO << "\n fi=" << frameIndex << incomplete.iname;
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
do {
|
do {
|
||||||
// Filter out actual watchers
|
|
||||||
filterEvaluateWatchers(&incomplete, watchHandler);
|
|
||||||
// Do locals. We might get called while running when someone enters watchers
|
|
||||||
if (!incomplete.empty()) {
|
|
||||||
CdbStackFrameContext *sg = m_d->m_currentStackTrace->frameContextAt(frameIndex, &errorMessage);
|
CdbStackFrameContext *sg = m_d->m_currentStackTrace->frameContextAt(frameIndex, &errorMessage);
|
||||||
if (!sg || !sg->completeModel(incomplete, watchHandler, &errorMessage))
|
if (!sg)
|
||||||
|
break;
|
||||||
|
if (!sg->completeData(incomplete, watchHandler, &errorMessage))
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
watchHandler->rebuildModel();
|
|
||||||
success = true;
|
success = true;
|
||||||
} while (false);
|
} while (false);
|
||||||
if (!success)
|
if (!success)
|
||||||
@@ -1132,10 +1091,10 @@ void CdbDebugEngine::assignValueInDebugger(const QString &expr, const QString &v
|
|||||||
break;
|
break;
|
||||||
// Update view
|
// Update view
|
||||||
WatchHandler *watchHandler = m_d->m_debuggerManagerAccess->watchHandler();
|
WatchHandler *watchHandler = m_d->m_debuggerManagerAccess->watchHandler();
|
||||||
if (WatchData *fwd = watchHandler->findData(expr)) {
|
if (WatchData *fwd = watchHandler->findItem(expr)) {
|
||||||
fwd->setValue(newValue);
|
fwd->setValue(newValue);
|
||||||
watchHandler->insertData(*fwd);
|
watchHandler->insertData(*fwd);
|
||||||
watchHandler->rebuildModel();
|
watchHandler->updateWatchers();
|
||||||
}
|
}
|
||||||
success = true;
|
success = true;
|
||||||
} while (false);
|
} while (false);
|
||||||
@@ -1233,8 +1192,8 @@ void CdbDebugEngine::activateFrame(int frameIndex)
|
|||||||
const StackFrame &frame = stackHandler->currentFrame();
|
const StackFrame &frame = stackHandler->currentFrame();
|
||||||
if (!frame.isUsable()) {
|
if (!frame.isUsable()) {
|
||||||
// Clean out model
|
// Clean out model
|
||||||
watchHandler->reinitializeWatchers();
|
watchHandler->beginCycle();
|
||||||
watchHandler->rebuildModel();
|
watchHandler->endCycle();
|
||||||
errorMessage = QString::fromLatin1("%1: file %2 unusable.").
|
errorMessage = QString::fromLatin1("%1: file %2 unusable.").
|
||||||
arg(QLatin1String(Q_FUNC_INFO), frame.file);
|
arg(QLatin1String(Q_FUNC_INFO), frame.file);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ private:
|
|||||||
bool executeDebuggerCommand(const QString &command, QString *errorMessage);
|
bool executeDebuggerCommand(const QString &command, QString *errorMessage);
|
||||||
bool evaluateExpression(const QString &expression, QString *value, QString *type, QString *errorMessage);
|
bool evaluateExpression(const QString &expression, QString *value, QString *type, QString *errorMessage);
|
||||||
void evaluateWatcher(WatchData *wd);
|
void evaluateWatcher(WatchData *wd);
|
||||||
void filterEvaluateWatchers(QList<WatchData> *wd, WatchHandler *wh);
|
|
||||||
QString editorToolTip(const QString &exp, const QString &function);
|
QString editorToolTip(const QString &exp, const QString &function);
|
||||||
|
|
||||||
CdbDebugEnginePrivate *m_d;
|
CdbDebugEnginePrivate *m_d;
|
||||||
|
|||||||
@@ -145,38 +145,29 @@ bool CdbStackFrameContext::populateModelInitially(WatchHandler *wh, QString *err
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CdbStackFrameContext::completeModel(const QList<WatchData> &incompleteLocals,
|
bool CdbStackFrameContext::completeData(const WatchData &incompleteLocal,
|
||||||
WatchHandler *wh,
|
WatchHandler *wh,
|
||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
if (debug) {
|
if (debug)
|
||||||
QDebug nsp = qDebug().nospace();
|
qDebug() << ">completeData " << incompleteLocal.iname;
|
||||||
nsp << ">completeModel ";
|
|
||||||
foreach (const WatchData &wd, incompleteLocals)
|
|
||||||
nsp << wd.iname << ' ';
|
|
||||||
nsp << '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_useDumpers) {
|
if (!m_useDumpers) {
|
||||||
return CdbSymbolGroupContext::completeModel(m_symbolContext, incompleteLocals,
|
return CdbSymbolGroupContext::completeData(m_symbolContext, incompleteLocal,
|
||||||
WatchHandlerModelInserter(wh),
|
WatchHandlerModelInserter(wh),
|
||||||
errorMessage);
|
errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expand dumper items
|
// Expand dumper items (not implemented)
|
||||||
int handledDumpers = 0;
|
if (incompleteLocal.source == OwnerDumper) {
|
||||||
foreach (const WatchData &cwd, incompleteLocals) {
|
WatchData wd = incompleteLocal;
|
||||||
if (cwd.source == OwnerDumper) { // You already know that.
|
|
||||||
WatchData wd = cwd;
|
|
||||||
wd.setAllUnneeded();
|
wd.setAllUnneeded();
|
||||||
wh->insertData(wd);
|
wh->insertData(wd);
|
||||||
handledDumpers++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (handledDumpers == incompleteLocals.size())
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Expand symbol group items
|
// Expand symbol group items
|
||||||
return CdbSymbolGroupContext::completeModel(m_symbolContext, incompleteLocals,
|
return CdbSymbolGroupContext::completeData(m_symbolContext, incompleteLocal,
|
||||||
WatchHandlerSorterInserter(wh, m_dumper),
|
WatchHandlerSorterInserter(wh, m_dumper),
|
||||||
errorMessage);
|
errorMessage);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
bool populateModelInitially(WatchHandler *wh, QString *errorMessage);
|
bool populateModelInitially(WatchHandler *wh, QString *errorMessage);
|
||||||
|
|
||||||
bool completeModel(const QList<WatchData> &incompleteLocals,
|
bool completeData(const WatchData &incompleteLocal,
|
||||||
WatchHandler *wh,
|
WatchHandler *wh,
|
||||||
QString *errorMessage);
|
QString *errorMessage);
|
||||||
|
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ public:
|
|||||||
OutputIterator it, QString *errorMessage);
|
OutputIterator it, QString *errorMessage);
|
||||||
|
|
||||||
template <class OutputIterator>
|
template <class OutputIterator>
|
||||||
static bool completeModel(CdbSymbolGroupContext *sg,
|
static bool completeData (CdbSymbolGroupContext *sg,
|
||||||
const QList<WatchData> &incompleteLocals,
|
WatchData incompleteLocal,
|
||||||
OutputIterator it,
|
OutputIterator it,
|
||||||
QString *errorMessage);
|
QString *errorMessage);
|
||||||
|
|
||||||
|
|||||||
@@ -192,28 +192,24 @@ bool CdbSymbolGroupContext::populateModelInitially(CdbSymbolGroupContext *sg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class OutputIterator>
|
template <class OutputIterator>
|
||||||
bool CdbSymbolGroupContext::completeModel(CdbSymbolGroupContext *sg,
|
bool CdbSymbolGroupContext::completeData(CdbSymbolGroupContext *sg,
|
||||||
const QList<WatchData> &incompleteLocals,
|
WatchData incompleteLocal,
|
||||||
OutputIterator it,
|
OutputIterator it,
|
||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
if (debugSgRecursion)
|
if (debugSgRecursion)
|
||||||
qDebug().nospace() << "###>" << Q_FUNC_INFO << ' ' << incompleteLocals.size() << '\n';
|
qDebug().nospace() << "###>" << Q_FUNC_INFO << ' ' << incompleteLocal.iname << '\n';
|
||||||
// The view reinserts any node being expanded with flag 'ChildrenNeeded'.
|
const bool contextExpanded = sg->isExpanded(incompleteLocal.iname);
|
||||||
// Recurse down one level in context unless this is already the case.
|
|
||||||
foreach(WatchData wd, incompleteLocals) {
|
|
||||||
const bool contextExpanded = sg->isExpanded(wd.iname);
|
|
||||||
if (debugSgRecursion)
|
if (debugSgRecursion)
|
||||||
qDebug() << " " << wd.iname << "CE=" << contextExpanded;
|
qDebug() << " " << incompleteLocal.iname << "CE=" << contextExpanded;
|
||||||
if (contextExpanded) { // You know that already.
|
if (contextExpanded) { // TODO: Legacy, should not be required any more
|
||||||
wd.setChildrenUnneeded();
|
incompleteLocal.setChildrenUnneeded();
|
||||||
*it = wd;
|
*it = incompleteLocal;
|
||||||
++it;
|
++it;
|
||||||
} else {
|
} else {
|
||||||
if (!insertSymbolRecursion(wd, sg, it, 1, 0, errorMessage))
|
if (!insertSymbolRecursion(incompleteLocal, sg, it, 1, 0, errorMessage))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user