forked from qt-creator/qt-creator
debugger: adjust loading/saving of watched expressions to recent changes
This commit is contained in:
@@ -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 = ""
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -719,6 +719,8 @@ class SessionEngine : public DebuggerEngine
|
||||
public:
|
||||
SessionEngine() : DebuggerEngine(DebuggerStartParameters()) {}
|
||||
|
||||
bool isSessionEngine() const { return true; }
|
||||
|
||||
void loadSessionData()
|
||||
{
|
||||
breakHandler()->loadSessionData();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user