diff --git a/share/qtcreator/gdbmacros/dumper.py b/share/qtcreator/gdbmacros/dumper.py index 2be8128bd955331bc1eb64ac341a374b5857f717..6ebbd61f4831c36424602f12cf80b660a7c5bde9 100644 --- a/share/qtcreator/gdbmacros/dumper.py +++ b/share/qtcreator/gdbmacros/dumper.py @@ -795,6 +795,7 @@ class SetupCommand(gdb.Command): if key.startswith("qdump__"): name = key[7:] qqDumpers[name] = value + qqFormats[name] = qqFormats.get(name, ""); elif key.startswith("qform__"): name = key[7:] formats = "" diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index 9c2ce4fc91017f789da0a1b76f6ddb98c6219bfc..1758f0f1447e21491a4cff7165728bb421532700 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -979,12 +979,14 @@ void BreakHandler::setAllPending() void BreakHandler::saveSessionData() { + QTC_ASSERT(m_engine->isSessionEngine(), return); saveBreakpoints(); updateMarkers(); } void BreakHandler::loadSessionData() { + QTC_ASSERT(m_engine->isSessionEngine(), return); loadBreakpoints(); updateMarkers(); } diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index aed2dd474b0b78147ef5fe0db6a08e04c06fba05..8e6afda85811024bb44283360d5d8279f310cf48 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -515,6 +515,7 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) QTC_ASSERT(sessionTemplate != this, startFailed(); return); breakHandler()->initializeFromTemplate(sessionTemplate->breakHandler()); + watchHandler()->initializeFromTemplate(sessionTemplate->watchHandler()); d->m_runControl = runControl; @@ -699,7 +700,6 @@ void DebuggerEngine::addToWatchWindow() if (exp.isEmpty()) return; watchHandler()->watchExpression(exp); - plugin()->updateState(this); } // Called from RunControl. @@ -713,6 +713,7 @@ void DebuggerEngine::handleFinished() DebuggerEngine *sessionTemplate = plugin()->sessionTemplate(); QTC_ASSERT(sessionTemplate != this, /**/); breakHandler()->storeToTemplate(sessionTemplate->breakHandler()); + watchHandler()->storeToTemplate(sessionTemplate->watchHandler()); } const DebuggerStartParameters &DebuggerEngine::startParameters() const diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index ad7172736368a8da9784925755b0979bc4c967e8..8462d318ff4ba0a565907d111ea9ca2a7a387c89 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -181,6 +181,7 @@ public: virtual unsigned debuggerCapabilities() const { return 0; } virtual bool isSynchroneous() const { return false; } + virtual bool isSessionEngine() const { return false; } virtual QString qtNamespace() const { return QString(); } public slots: diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index fd47e63794453cf228a9b6a9fa129cfcaa2cce37..146e27e391822f6f1355aa493f4575eb86b0033c 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -719,6 +719,8 @@ class SessionEngine : public DebuggerEngine public: SessionEngine() : DebuggerEngine(DebuggerStartParameters()) {} + bool isSessionEngine() const { return true; } + void loadSessionData() { breakHandler()->loadSessionData(); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index b63d3632fb35fb2312ccbb7d020675c564958b42..c8a0ad106d705d6db5c5b7acfee02df1fe81a191 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1532,12 +1532,14 @@ void GdbEngine::handleHasPython(const GdbResponse &response) foreach (const GdbMi &dumper, dumpers.children()) { QString type = _(dumper.findChild("type").data()); QStringList formats(tr("Raw structure")); - formats.append(_(dumper.findChild("formats").data()).split(_(","))); + QString reported = _(dumper.findChild("formats").data()); + formats.append(reported.split(_(","), QString::SkipEmptyParts)); watchHandler()->addTypeFormats(type, formats); } } else { m_hasPython = false; - if (m_gdbAdapter->dumperHandling() == AbstractGdbAdapter::DumperLoadedByGdbPreload + if (m_gdbAdapter->dumperHandling() + == AbstractGdbAdapter::DumperLoadedByGdbPreload && checkDebuggingHelpersClassic()) { QByteArray cmd = "set environment "; cmd += Debugger::Constants::Internal::LD_PRELOAD_ENV_VAR; diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index ddf6f9e0238fb3738b25134bc4424bf9f8346864..4f4e174fdd08fad6b6316747a735476fc192f327 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -667,6 +667,9 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const int pos = type.indexOf("::Q"); if (pos >= 0 && type.count(':') == 2) type = type.mid(pos + 2); + pos = type.indexOf('<'); + if (pos >= 0) + type = type.left(pos); return m_handler->m_reportedTypeFormats.value(type); } @@ -1083,7 +1086,6 @@ void WatchModel::formatRequests(QByteArray *out, const WatchItem *item) const WatchHandler::WatchHandler(DebuggerEngine *engine) { m_engine = engine; - m_expandPointers = true; m_inChange = false; m_return = new WatchModel(this, ReturnWatch); @@ -1235,11 +1237,10 @@ void WatchHandler::watchExpression(const QString &exp) if (exp.isEmpty() || exp == watcherEditPlaceHolder()) data.setAllUnneeded(); data.iname = watcherName(data.exp); - if (m_engine && m_engine->isSynchroneous()) + if (m_engine->isSynchroneous() && !m_engine->isSessionEngine()) m_engine->updateWatchData(data); else insertData(data); - m_engine->updateWatchData(data); updateWatchersWindow(); saveWatchers(); emitAllChanged(); @@ -1351,8 +1352,8 @@ void WatchHandler::removeWatchExpression(const QString &exp0) break; } } - updateWatchersWindow(); emitAllChanged(); + updateWatchersWindow(); } void WatchHandler::updateWatchersWindow() @@ -1434,14 +1435,17 @@ void WatchHandler::saveTypeFormats() void WatchHandler::saveSessionData() { + QTC_ASSERT(m_engine->isSessionEngine(), return); saveWatchers(); saveTypeFormats(); } void WatchHandler::loadSessionData() { + QTC_ASSERT(m_engine->isSessionEngine(), return); loadWatchers(); loadTypeFormats(); + foreach (const QByteArray &exp, m_watcherNames.keys()) { WatchData data; data.iname = watcherName(exp); @@ -1450,8 +1454,24 @@ void WatchHandler::loadSessionData() data.exp = exp; insertData(data); } + updateWatchersWindow(); } +void WatchHandler::initializeFromTemplate(WatchHandler *other) +{ + m_watcherNames = other->m_watcherNames; + m_typeFormats = other->m_typeFormats; + m_individualFormats = other->m_individualFormats; +} + +void WatchHandler::storeToTemplate(WatchHandler *other) +{ + other->m_watcherNames = m_watcherNames; + other->m_typeFormats = m_typeFormats; + other->m_individualFormats = m_individualFormats; +} + + WatchModel *WatchHandler::model(WatchType type) const { switch (type) { diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index 0ba82d25d6ed31360feee70374481b7a8088fec3..145a67c8cc7274a283962de3cf10fa5978a6171e 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -156,6 +156,9 @@ public: void loadSessionData(); void saveSessionData(); + void initializeFromTemplate(WatchHandler *other); + void storeToTemplate(WatchHandler *other); + bool isExpandedIName(const QByteArray &iname) const { return m_expandedINames.contains(iname); } QSet<QByteArray> expandedINames() const @@ -184,7 +187,6 @@ private: void setFormat(const QString &type, int format); void updateWatchersWindow(); - bool m_expandPointers; bool m_inChange; // QWidgets and QProcesses taking care of special displays. diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp index a9cef8c01795b29d0ddf6ee063798fca7eb19153..50c73cb9e356bd16039e59e5110e6ee886147364 100644 --- a/tests/manual/gdbdebugger/simple/app.cpp +++ b/tests/manual/gdbdebugger/simple/app.cpp @@ -1347,7 +1347,7 @@ QVariant testQVariant3() return QVariant("xxx"); } -QVector<int> testQVector() +void testQVector() { QVector<int> big(10000); @@ -1367,8 +1367,6 @@ QVector<int> testQVector() QVector<bool> vec; vec.append(true); vec.append(false); - - return big; } QVector<QList<int> > testQVectorOfQList()