Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
5285379f
Commit
5285379f
authored
Dec 17, 2008
by
hjk
Browse files
make watchers persistent in the session
parent
04c4a0ec
Changes
5
Hide whitespace changes
Inline
Side-by-side
bin/gdbmacros/gdbmacros.cpp
View file @
5285379f
...
...
@@ -2157,6 +2157,7 @@ static void qDumpStdMap(QDumper &d)
// HACK: we need a properly const qualified version of the
// std::pair used. We extract it from the allocator parameter
// (#4, "std::allocator<std::pair<key, value> >")
// as it is there, and, equally importantly, in an order that
// gdb accepts when fed with it.
char
*
pairType
=
(
char
*
)(
d
.
templateParameters
[
3
])
+
16
;
...
...
src/plugins/debugger/debuggermanager.cpp
View file @
5285379f
...
...
@@ -250,6 +250,10 @@ void DebuggerManager::init()
this
,
SLOT
(
watchExpression
(
QString
)));
connect
(
watchersView
,
SIGNAL
(
requestRemoveWatchExpression
(
QString
)),
this
,
SLOT
(
removeWatchExpression
(
QString
)));
connect
(
m_watchHandler
,
SIGNAL
(
sessionValueRequested
(
QString
,
QVariant
*
)),
this
,
SIGNAL
(
sessionValueRequested
(
QString
,
QVariant
*
)));
connect
(
m_watchHandler
,
SIGNAL
(
setSessionValueRequested
(
QString
,
QVariant
)),
this
,
SIGNAL
(
setSessionValueRequested
(
QString
,
QVariant
)));
// Tooltip
QTreeView
*
tooltipView
=
qobject_cast
<
QTreeView
*>
(
m_tooltipWindow
);
...
...
@@ -948,6 +952,7 @@ void DebuggerManager::aboutToSaveSession()
void
DebuggerManager
::
loadSessionData
()
{
m_breakHandler
->
loadSessionData
();
m_watchHandler
->
loadSessionData
();
QVariant
value
;
querySessionValue
(
QLatin1String
(
"UseFastStart"
),
&
value
);
...
...
@@ -964,6 +969,7 @@ void DebuggerManager::loadSessionData()
void
DebuggerManager
::
saveSessionData
()
{
m_breakHandler
->
saveSessionData
();
m_watchHandler
->
saveSessionData
();
setSessionValue
(
QLatin1String
(
"UseFastStart"
),
m_useFastStartAction
->
isChecked
());
...
...
src/plugins/debugger/watchhandler.cpp
View file @
5285379f
...
...
@@ -888,6 +888,8 @@ void WatchHandler::watchExpression(const QString &exp)
data
.
name
=
exp
;
data
.
iname
=
"watch."
+
exp
;
insertData
(
data
);
m_watchers
.
append
(
exp
);
saveWatchers
();
emit
watchModelUpdateRequested
();
}
...
...
@@ -965,7 +967,9 @@ void WatchHandler::showEditValue(const WatchData &data)
void
WatchHandler
::
removeWatchExpression
(
const
QString
&
iname
)
{
MODEL_DEBUG
(
"REMOVE WATCH: "
<<
iname
);
(
void
)
takeData
(
iname
);
WatchData
data
=
takeData
(
iname
);
m_watchers
.
removeOne
(
data
.
iname
);
saveWatchers
();
emit
watchModelUpdateRequested
();
}
...
...
@@ -973,19 +977,26 @@ void WatchHandler::reinitializeWatchers()
{
m_completeSet
=
initialSet
();
m_incompleteSet
.
clear
();
reinitializeWatchersHelper
();
}
void
WatchHandler
::
reinitializeWatchersHelper
()
{
// copy over all watchers and mark all watchers as incomplete
for
(
int
i
=
0
,
n
=
m_oldSet
.
size
();
i
<
n
;
++
i
)
{
WatchData
data
=
m_oldSet
.
at
(
i
);
if
(
data
.
isWatcher
())
{
data
.
level
=
-
1
;
data
.
row
=
-
1
;
data
.
parentIndex
=
-
1
;
data
.
variable
.
clear
();
data
.
setAllNeeded
();
data
.
valuedisabled
=
false
;
insertData
(
data
);
// properly handles "neededChildren"
}
int
i
=
0
;
foreach
(
const
QString
&
exp
,
m_watchers
)
{
WatchData
data
;
data
.
level
=
-
1
;
data
.
row
=
-
1
;
data
.
parentIndex
=
-
1
;
data
.
variable
.
clear
();
data
.
setAllNeeded
();
data
.
valuedisabled
=
false
;
data
.
iname
=
"watch."
+
QString
::
number
(
i
);
data
.
name
=
exp
;
data
.
exp
=
exp
;
insertData
(
data
);
++
i
;
}
}
...
...
@@ -1180,3 +1191,29 @@ bool WatchHandler::checkIndex(int id) const
}
return
true
;
}
void
WatchHandler
::
loadWatchers
()
{
QVariant
value
;
sessionValueRequested
(
"Watchers"
,
&
value
);
m_watchers
=
value
.
toStringList
();
qDebug
()
<<
"LOAD WATCHERS: "
<<
m_watchers
;
reinitializeWatchersHelper
();
}
void
WatchHandler
::
saveWatchers
()
{
qDebug
()
<<
"SAVE WATCHERS: "
<<
m_watchers
;
setSessionValueRequested
(
"Watchers"
,
m_watchers
);
}
void
WatchHandler
::
saveSessionData
()
{
saveWatchers
();
}
void
WatchHandler
::
loadSessionData
()
{
loadWatchers
();
rebuildModel
();
}
src/plugins/debugger/watchhandler.h
View file @
5285379f
...
...
@@ -186,13 +186,23 @@ public:
WatchData
*
findData
(
const
QString
&
iname
);
void
loadSessionData
();
void
saveSessionData
();
signals:
void
watchModelUpdateRequested
();
void
sessionValueRequested
(
const
QString
&
name
,
QVariant
*
value
);
void
setSessionValueRequested
(
const
QString
&
name
,
const
QVariant
&
value
);
private:
void
reinitializeWatchersHelper
();
WatchData
takeData
(
const
QString
&
iname
);
QString
toString
()
const
;
void
loadWatchers
();
void
saveWatchers
();
bool
m_expandPointers
;
bool
m_inChange
;
...
...
@@ -203,6 +213,7 @@ private:
QList
<
WatchData
>
m_completeSet
;
QList
<
WatchData
>
m_oldSet
;
QList
<
WatchData
>
m_displaySet
;
QStringList
m_watchers
;
void
setDisplayedIName
(
const
QString
&
iname
,
bool
on
);
QSet
<
QString
>
m_expandedINames
;
// those expanded in the treeview
...
...
tests/manual/gdbdebugger/simple/app.cpp
View file @
5285379f
...
...
@@ -116,7 +116,7 @@ private:
void
testArray
()
{
QString
x
[
4
];
QString
x
[
20
];
x
[
0
]
=
"a"
;
x
[
1
]
=
"b"
;
x
[
2
]
=
"c"
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment