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
Tobias Hunger
qt-creator
Commits
fa8cf20d
Commit
fa8cf20d
authored
Jul 13, 2010
by
hjk
Browse files
debugger: remove finished engines from snapshot list
parent
4f4167a3
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/debuggerengine.cpp
View file @
fa8cf20d
...
...
@@ -461,7 +461,7 @@ void DebuggerEngine::handleCommand(int role, const QVariant &value)
break
;
case
RequestExecExitRole
:
d
->
do
ShutdownInferior
();
d
->
queue
ShutdownInferior
();
break
;
case
RequestMakeSnapshotRole
:
...
...
@@ -654,8 +654,8 @@ void DebuggerEngine::setRegisterValue(int regnr, const QString &value)
void
DebuggerEngine
::
showMessage
(
const
QString
&
msg
,
int
channel
,
int
timeout
)
const
{
//
if (msg.size() && msg.at(0).isUpper() && msg.at(1).isUpper())
//
qDebug() << qPrintable(msg) << "IN STATE" << state();
if
(
msg
.
size
()
&&
msg
.
at
(
0
).
isUpper
()
&&
msg
.
at
(
1
).
isUpper
())
qDebug
()
<<
qPrintable
(
msg
)
<<
"IN STATE"
<<
state
();
d
->
m_runControl
->
showMessage
(
msg
,
channel
);
plugin
()
->
showMessage
(
msg
,
channel
,
timeout
);
}
...
...
src/plugins/debugger/debuggerplugin.cpp
View file @
fa8cf20d
...
...
@@ -2694,6 +2694,7 @@ void DebuggerPlugin::runControlStarted(DebuggerRunControl *runControl)
void
DebuggerPlugin
::
runControlFinished
(
DebuggerRunControl
*
runControl
)
{
Q_UNUSED
(
runControl
);
d
->
m_sessionEngine
->
m_snapshotHandler
->
removeSnapshot
(
runControl
);
d
->
disconnectEngine
();
}
...
...
src/plugins/debugger/snapshothandler.cpp
View file @
fa8cf20d
...
...
@@ -127,14 +127,19 @@ SnapshotHandler::SnapshotHandler(SessionEngine *engine)
SnapshotHandler
::~
SnapshotHandler
()
{
for
(
int
i
=
m_snapshots
.
size
();
--
i
>=
0
;
)
{
QString
file
=
engineAt
(
i
)
->
startParameters
().
coreFile
;
QFile
::
remove
(
file
);
if
(
DebuggerEngine
*
engine
=
engineAt
(
i
))
{
QString
fileName
=
engine
->
startParameters
().
coreFile
;
if
(
!
fileName
.
isEmpty
())
QFile
::
remove
(
fileName
);
}
}
}
DebuggerEngine
*
SnapshotHandler
::
engineAt
(
int
i
)
const
{
return
m_snapshots
.
at
(
i
)
->
engine
();
DebuggerEngine
*
engine
=
m_snapshots
.
at
(
i
)
->
engine
();
QTC_ASSERT
(
engine
,
qDebug
()
<<
"ENGINE AT "
<<
i
<<
"DELETED"
);
return
engine
;
}
int
SnapshotHandler
::
rowCount
(
const
QModelIndex
&
parent
)
const
...
...
@@ -154,6 +159,13 @@ QVariant SnapshotHandler::data(const QModelIndex &index, int role) const
return
QVariant
();
const
DebuggerEngine
*
engine
=
engineAt
(
index
.
row
());
if
(
role
==
SnapshotCapabilityRole
)
return
engine
&&
(
engine
->
debuggerCapabilities
()
&
SnapshotCapability
);
if
(
!
engine
)
return
QLatin1String
(
"<finished>"
);
const
DebuggerStartParameters
&
sp
=
engine
->
startParameters
();
if
(
role
==
Qt
::
DisplayRole
)
{
...
...
@@ -166,9 +178,6 @@ QVariant SnapshotHandler::data(const QModelIndex &index, int role) const
return
QVariant
();
}
if
(
role
==
SnapshotCapabilityRole
)
return
engine
->
debuggerCapabilities
()
&
SnapshotCapability
;
if
(
role
==
Qt
::
ToolTipRole
)
{
//: Tooltip for variable
//return snapshot.toToolTip();
...
...
@@ -207,7 +216,9 @@ bool SnapshotHandler::setData
{
Q_UNUSED
(
value
);
if
(
index
.
isValid
()
&&
role
==
RequestMakeSnapshotRole
)
{
engineAt
(
index
.
row
())
->
makeSnapshot
();
DebuggerEngine
*
engine
=
engineAt
(
index
.
row
());
QTC_ASSERT
(
engine
,
return
false
);
engine
->
makeSnapshot
();
return
true
;
}
if
(
index
.
isValid
()
&&
role
==
RequestActivateSnapshotRole
)
{
...
...
@@ -245,14 +256,26 @@ void SnapshotHandler::removeAll()
void
SnapshotHandler
::
appendSnapshot
(
DebuggerRunControl
*
rc
)
{
//return; // FIXME
m_snapshots
.
append
(
rc
);
m_currentIndex
=
size
()
-
1
;
reset
();
}
void
SnapshotHandler
::
removeSnapshot
(
DebuggerRunControl
*
rc
)
{
int
index
=
m_snapshots
.
indexOf
(
rc
);
QTC_ASSERT
(
index
!=
-
1
,
return
);
removeSnapshot
(
index
);
}
void
SnapshotHandler
::
removeSnapshot
(
int
index
)
{
QFile
::
remove
(
engineAt
(
index
)
->
startParameters
().
coreFile
);
const
DebuggerEngine
*
engine
=
engineAt
(
index
);
QTC_ASSERT
(
engine
,
return
);
QString
fileName
=
engine
->
startParameters
().
coreFile
;
if
(
!
fileName
.
isEmpty
())
QFile
::
remove
(
fileName
);
m_snapshots
.
removeAt
(
index
);
if
(
index
==
m_currentIndex
)
m_currentIndex
=
-
1
;
...
...
src/plugins/debugger/snapshothandler.h
View file @
fa8cf20d
...
...
@@ -33,7 +33,7 @@
#include
"stackframe.h"
#include
<QtCore/QAbstractItemModel>
#include
<QtCore/Q
DateTime
>
#include
<QtCore/Q
Pointer
>
namespace
Debugger
{
...
...
@@ -63,10 +63,10 @@ public:
// Called from SnapshotHandler after a new snapshot has been added
void
removeAll
();
void
removeSnapshot
(
int
index
);
QAbstractItemModel
*
model
()
{
return
this
;
}
int
currentIndex
()
const
{
return
m_currentIndex
;
}
void
appendSnapshot
(
DebuggerRunControl
*
rc
);
void
removeSnapshot
(
DebuggerRunControl
*
rc
);
void
setCurrentIndex
(
int
index
);
int
size
()
const
{
return
m_snapshots
.
size
();
}
...
...
@@ -80,10 +80,11 @@ private:
Qt
::
ItemFlags
flags
(
const
QModelIndex
&
index
)
const
;
Q_SLOT
void
resetModel
()
{
reset
();
}
DebuggerEngine
*
engineAt
(
int
i
)
const
;
void
removeSnapshot
(
int
index
);
SessionEngine
*
m_engine
;
int
m_currentIndex
;
QList
<
DebuggerRunControl
*
>
m_snapshots
;
QList
<
QPointer
<
DebuggerRunControl
>
>
m_snapshots
;
const
QVariant
m_positionIcon
;
const
QVariant
m_emptyIcon
;
};
...
...
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