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__"):
|
if key.startswith("qdump__"):
|
||||||
name = key[7:]
|
name = key[7:]
|
||||||
qqDumpers[name] = value
|
qqDumpers[name] = value
|
||||||
|
qqFormats[name] = qqFormats.get(name, "");
|
||||||
elif key.startswith("qform__"):
|
elif key.startswith("qform__"):
|
||||||
name = key[7:]
|
name = key[7:]
|
||||||
formats = ""
|
formats = ""
|
||||||
|
|||||||
@@ -979,12 +979,14 @@ void BreakHandler::setAllPending()
|
|||||||
|
|
||||||
void BreakHandler::saveSessionData()
|
void BreakHandler::saveSessionData()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine->isSessionEngine(), return);
|
||||||
saveBreakpoints();
|
saveBreakpoints();
|
||||||
updateMarkers();
|
updateMarkers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakHandler::loadSessionData()
|
void BreakHandler::loadSessionData()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine->isSessionEngine(), return);
|
||||||
loadBreakpoints();
|
loadBreakpoints();
|
||||||
updateMarkers();
|
updateMarkers();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -515,6 +515,7 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
|
|||||||
QTC_ASSERT(sessionTemplate != this, startFailed(); return);
|
QTC_ASSERT(sessionTemplate != this, startFailed(); return);
|
||||||
|
|
||||||
breakHandler()->initializeFromTemplate(sessionTemplate->breakHandler());
|
breakHandler()->initializeFromTemplate(sessionTemplate->breakHandler());
|
||||||
|
watchHandler()->initializeFromTemplate(sessionTemplate->watchHandler());
|
||||||
|
|
||||||
d->m_runControl = runControl;
|
d->m_runControl = runControl;
|
||||||
|
|
||||||
@@ -699,7 +700,6 @@ void DebuggerEngine::addToWatchWindow()
|
|||||||
if (exp.isEmpty())
|
if (exp.isEmpty())
|
||||||
return;
|
return;
|
||||||
watchHandler()->watchExpression(exp);
|
watchHandler()->watchExpression(exp);
|
||||||
plugin()->updateState(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called from RunControl.
|
// Called from RunControl.
|
||||||
@@ -713,6 +713,7 @@ void DebuggerEngine::handleFinished()
|
|||||||
DebuggerEngine *sessionTemplate = plugin()->sessionTemplate();
|
DebuggerEngine *sessionTemplate = plugin()->sessionTemplate();
|
||||||
QTC_ASSERT(sessionTemplate != this, /**/);
|
QTC_ASSERT(sessionTemplate != this, /**/);
|
||||||
breakHandler()->storeToTemplate(sessionTemplate->breakHandler());
|
breakHandler()->storeToTemplate(sessionTemplate->breakHandler());
|
||||||
|
watchHandler()->storeToTemplate(sessionTemplate->watchHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
const DebuggerStartParameters &DebuggerEngine::startParameters() const
|
const DebuggerStartParameters &DebuggerEngine::startParameters() const
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ public:
|
|||||||
virtual unsigned debuggerCapabilities() const { return 0; }
|
virtual unsigned debuggerCapabilities() const { return 0; }
|
||||||
|
|
||||||
virtual bool isSynchroneous() const { return false; }
|
virtual bool isSynchroneous() const { return false; }
|
||||||
|
virtual bool isSessionEngine() const { return false; }
|
||||||
virtual QString qtNamespace() const { return QString(); }
|
virtual QString qtNamespace() const { return QString(); }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|||||||
@@ -719,6 +719,8 @@ class SessionEngine : public DebuggerEngine
|
|||||||
public:
|
public:
|
||||||
SessionEngine() : DebuggerEngine(DebuggerStartParameters()) {}
|
SessionEngine() : DebuggerEngine(DebuggerStartParameters()) {}
|
||||||
|
|
||||||
|
bool isSessionEngine() const { return true; }
|
||||||
|
|
||||||
void loadSessionData()
|
void loadSessionData()
|
||||||
{
|
{
|
||||||
breakHandler()->loadSessionData();
|
breakHandler()->loadSessionData();
|
||||||
|
|||||||
@@ -1532,12 +1532,14 @@ void GdbEngine::handleHasPython(const GdbResponse &response)
|
|||||||
foreach (const GdbMi &dumper, dumpers.children()) {
|
foreach (const GdbMi &dumper, dumpers.children()) {
|
||||||
QString type = _(dumper.findChild("type").data());
|
QString type = _(dumper.findChild("type").data());
|
||||||
QStringList formats(tr("Raw structure"));
|
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);
|
watchHandler()->addTypeFormats(type, formats);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_hasPython = false;
|
m_hasPython = false;
|
||||||
if (m_gdbAdapter->dumperHandling() == AbstractGdbAdapter::DumperLoadedByGdbPreload
|
if (m_gdbAdapter->dumperHandling()
|
||||||
|
== AbstractGdbAdapter::DumperLoadedByGdbPreload
|
||||||
&& checkDebuggingHelpersClassic()) {
|
&& checkDebuggingHelpersClassic()) {
|
||||||
QByteArray cmd = "set environment ";
|
QByteArray cmd = "set environment ";
|
||||||
cmd += Debugger::Constants::Internal::LD_PRELOAD_ENV_VAR;
|
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");
|
int pos = type.indexOf("::Q");
|
||||||
if (pos >= 0 && type.count(':') == 2)
|
if (pos >= 0 && type.count(':') == 2)
|
||||||
type = type.mid(pos + 2);
|
type = type.mid(pos + 2);
|
||||||
|
pos = type.indexOf('<');
|
||||||
|
if (pos >= 0)
|
||||||
|
type = type.left(pos);
|
||||||
return m_handler->m_reportedTypeFormats.value(type);
|
return m_handler->m_reportedTypeFormats.value(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1083,7 +1086,6 @@ void WatchModel::formatRequests(QByteArray *out, const WatchItem *item) const
|
|||||||
WatchHandler::WatchHandler(DebuggerEngine *engine)
|
WatchHandler::WatchHandler(DebuggerEngine *engine)
|
||||||
{
|
{
|
||||||
m_engine = engine;
|
m_engine = engine;
|
||||||
m_expandPointers = true;
|
|
||||||
m_inChange = false;
|
m_inChange = false;
|
||||||
|
|
||||||
m_return = new WatchModel(this, ReturnWatch);
|
m_return = new WatchModel(this, ReturnWatch);
|
||||||
@@ -1235,11 +1237,10 @@ void WatchHandler::watchExpression(const QString &exp)
|
|||||||
if (exp.isEmpty() || exp == watcherEditPlaceHolder())
|
if (exp.isEmpty() || exp == watcherEditPlaceHolder())
|
||||||
data.setAllUnneeded();
|
data.setAllUnneeded();
|
||||||
data.iname = watcherName(data.exp);
|
data.iname = watcherName(data.exp);
|
||||||
if (m_engine && m_engine->isSynchroneous())
|
if (m_engine->isSynchroneous() && !m_engine->isSessionEngine())
|
||||||
m_engine->updateWatchData(data);
|
m_engine->updateWatchData(data);
|
||||||
else
|
else
|
||||||
insertData(data);
|
insertData(data);
|
||||||
m_engine->updateWatchData(data);
|
|
||||||
updateWatchersWindow();
|
updateWatchersWindow();
|
||||||
saveWatchers();
|
saveWatchers();
|
||||||
emitAllChanged();
|
emitAllChanged();
|
||||||
@@ -1351,8 +1352,8 @@ void WatchHandler::removeWatchExpression(const QString &exp0)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateWatchersWindow();
|
|
||||||
emitAllChanged();
|
emitAllChanged();
|
||||||
|
updateWatchersWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::updateWatchersWindow()
|
void WatchHandler::updateWatchersWindow()
|
||||||
@@ -1434,14 +1435,17 @@ void WatchHandler::saveTypeFormats()
|
|||||||
|
|
||||||
void WatchHandler::saveSessionData()
|
void WatchHandler::saveSessionData()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine->isSessionEngine(), return);
|
||||||
saveWatchers();
|
saveWatchers();
|
||||||
saveTypeFormats();
|
saveTypeFormats();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::loadSessionData()
|
void WatchHandler::loadSessionData()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine->isSessionEngine(), return);
|
||||||
loadWatchers();
|
loadWatchers();
|
||||||
loadTypeFormats();
|
loadTypeFormats();
|
||||||
|
|
||||||
foreach (const QByteArray &exp, m_watcherNames.keys()) {
|
foreach (const QByteArray &exp, m_watcherNames.keys()) {
|
||||||
WatchData data;
|
WatchData data;
|
||||||
data.iname = watcherName(exp);
|
data.iname = watcherName(exp);
|
||||||
@@ -1450,8 +1454,24 @@ void WatchHandler::loadSessionData()
|
|||||||
data.exp = exp;
|
data.exp = exp;
|
||||||
insertData(data);
|
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
|
WatchModel *WatchHandler::model(WatchType type) const
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|||||||
@@ -156,6 +156,9 @@ public:
|
|||||||
void loadSessionData();
|
void loadSessionData();
|
||||||
void saveSessionData();
|
void saveSessionData();
|
||||||
|
|
||||||
|
void initializeFromTemplate(WatchHandler *other);
|
||||||
|
void storeToTemplate(WatchHandler *other);
|
||||||
|
|
||||||
bool isExpandedIName(const QByteArray &iname) const
|
bool isExpandedIName(const QByteArray &iname) const
|
||||||
{ return m_expandedINames.contains(iname); }
|
{ return m_expandedINames.contains(iname); }
|
||||||
QSet<QByteArray> expandedINames() const
|
QSet<QByteArray> expandedINames() const
|
||||||
@@ -184,7 +187,6 @@ private:
|
|||||||
void setFormat(const QString &type, int format);
|
void setFormat(const QString &type, int format);
|
||||||
void updateWatchersWindow();
|
void updateWatchersWindow();
|
||||||
|
|
||||||
bool m_expandPointers;
|
|
||||||
bool m_inChange;
|
bool m_inChange;
|
||||||
|
|
||||||
// QWidgets and QProcesses taking care of special displays.
|
// QWidgets and QProcesses taking care of special displays.
|
||||||
|
|||||||
@@ -1347,7 +1347,7 @@ QVariant testQVariant3()
|
|||||||
return QVariant("xxx");
|
return QVariant("xxx");
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<int> testQVector()
|
void testQVector()
|
||||||
{
|
{
|
||||||
QVector<int> big(10000);
|
QVector<int> big(10000);
|
||||||
|
|
||||||
@@ -1367,8 +1367,6 @@ QVector<int> testQVector()
|
|||||||
QVector<bool> vec;
|
QVector<bool> vec;
|
||||||
vec.append(true);
|
vec.append(true);
|
||||||
vec.append(false);
|
vec.append(false);
|
||||||
|
|
||||||
return big;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QList<int> > testQVectorOfQList()
|
QVector<QList<int> > testQVectorOfQList()
|
||||||
|
|||||||
Reference in New Issue
Block a user