forked from qt-creator/qt-creator
debugger: fix re-initialization of watch item inames
This commit is contained in:
@@ -66,6 +66,8 @@ using namespace Debugger::Internal;
|
|||||||
|
|
||||||
static const QString strNotInScope = QLatin1String("<not in scope>");
|
static const QString strNotInScope = QLatin1String("<not in scope>");
|
||||||
|
|
||||||
|
static int watcherCounter = 0;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// WatchData
|
// WatchData
|
||||||
@@ -922,17 +924,21 @@ void WatchHandler::watchExpression()
|
|||||||
watchExpression(action->data().toString());
|
watchExpression(action->data().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString WatchHandler::watcherName(const QString &exp)
|
||||||
|
{
|
||||||
|
return QLatin1String("watch.") + QString::number(m_watchers[exp]);
|
||||||
|
}
|
||||||
|
|
||||||
void WatchHandler::watchExpression(const QString &exp)
|
void WatchHandler::watchExpression(const QString &exp)
|
||||||
{
|
{
|
||||||
// FIXME: 'exp' can contain illegal characters
|
// FIXME: 'exp' can contain illegal characters
|
||||||
//MODEL_DEBUG("WATCH: " << exp);
|
//MODEL_DEBUG("WATCH: " << exp);
|
||||||
static int counter = 0;
|
m_watchers[exp] = watcherCounter++;
|
||||||
WatchData data;
|
WatchData data;
|
||||||
data.exp = exp;
|
data.exp = exp;
|
||||||
data.name = exp;
|
data.name = exp;
|
||||||
data.iname = QLatin1String("watch.") + QString::number(counter++);
|
data.iname = watcherName(exp);
|
||||||
insertData(data);
|
insertData(data);
|
||||||
m_watchers.append(exp);
|
|
||||||
saveWatchers();
|
saveWatchers();
|
||||||
emit watchModelUpdateRequested();
|
emit watchModelUpdateRequested();
|
||||||
}
|
}
|
||||||
@@ -1017,7 +1023,7 @@ void WatchHandler::removeWatchExpression()
|
|||||||
void WatchHandler::removeWatchExpression(const QString &exp)
|
void WatchHandler::removeWatchExpression(const QString &exp)
|
||||||
{
|
{
|
||||||
MODEL_DEBUG("REMOVE WATCH: " << exp);
|
MODEL_DEBUG("REMOVE WATCH: " << exp);
|
||||||
m_watchers.removeOne(exp);
|
m_watchers.remove(exp);
|
||||||
for (int i = m_completeSet.size(); --i >= 0;) {
|
for (int i = m_completeSet.size(); --i >= 0;) {
|
||||||
const WatchData & data = m_completeSet.at(i);
|
const WatchData & data = m_completeSet.at(i);
|
||||||
if (data.iname.startsWith(QLatin1String("watch.")) && data.exp == exp) {
|
if (data.iname.startsWith(QLatin1String("watch.")) && data.exp == exp) {
|
||||||
@@ -1041,8 +1047,9 @@ void WatchHandler::reinitializeWatchersHelper()
|
|||||||
{
|
{
|
||||||
// copy over all watchers and mark all watchers as incomplete
|
// copy over all watchers and mark all watchers as incomplete
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (const QString &exp, m_watchers) {
|
foreach (const QString &exp, m_watchers.keys()) {
|
||||||
WatchData data;
|
WatchData data;
|
||||||
|
data.iname = watcherName(exp);
|
||||||
data.level = -1;
|
data.level = -1;
|
||||||
data.row = -1;
|
data.row = -1;
|
||||||
data.parentIndex = -1;
|
data.parentIndex = -1;
|
||||||
@@ -1252,15 +1259,16 @@ void WatchHandler::loadWatchers()
|
|||||||
{
|
{
|
||||||
QVariant value;
|
QVariant value;
|
||||||
sessionValueRequested("Watchers", &value);
|
sessionValueRequested("Watchers", &value);
|
||||||
m_watchers = value.toStringList();
|
foreach (const QString &exp, value.toStringList())
|
||||||
|
m_watchers[exp] = watcherCounter++;
|
||||||
//qDebug() << "LOAD WATCHERS: " << m_watchers;
|
//qDebug() << "LOAD WATCHERS: " << m_watchers;
|
||||||
reinitializeWatchersHelper();
|
reinitializeWatchersHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::saveWatchers()
|
void WatchHandler::saveWatchers()
|
||||||
{
|
{
|
||||||
//qDebug() << "SAVE WATCHERS: " << m_watchers;
|
//qDebug() << "SAVE WATCHERS: " << m_watchers.keys();
|
||||||
setSessionValueRequested("Watchers", m_watchers);
|
setSessionValueRequested("Watchers", QVariant(m_watchers.keys()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::saveSessionData()
|
void WatchHandler::saveSessionData()
|
||||||
|
@@ -216,7 +216,8 @@ private:
|
|||||||
QList<WatchData> m_completeSet;
|
QList<WatchData> m_completeSet;
|
||||||
QList<WatchData> m_oldSet;
|
QList<WatchData> m_oldSet;
|
||||||
QList<WatchData> m_displaySet;
|
QList<WatchData> m_displaySet;
|
||||||
QStringList m_watchers;
|
QHash<QString, int> m_watchers;
|
||||||
|
QString watcherName(const QString &exp);
|
||||||
|
|
||||||
void setDisplayedIName(const QString &iname, bool on);
|
void setDisplayedIName(const QString &iname, bool on);
|
||||||
QSet<QString> m_expandedINames; // those expanded in the treeview
|
QSet<QString> m_expandedINames; // those expanded in the treeview
|
||||||
|
Reference in New Issue
Block a user