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
8d54298c
Commit
8d54298c
authored
Jul 20, 2010
by
hjk
Browse files
debugger: handle shutting down engines from SnapshotWindow <Del> or context menu
parent
cc131beb
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/debuggerengine.cpp
View file @
8d54298c
...
...
@@ -1411,7 +1411,7 @@ void DebuggerEngine::quitDebugger()
showMessage
(
"QUIT DEBUGGER REQUESTED"
);
d
->
m_targetState
=
DebuggerFinished
;
if
(
state
()
==
InferiorStopOk
)
{
d
->
do
ShutdownInferior
();
d
->
queue
ShutdownInferior
();
}
else
if
(
state
()
==
InferiorRunOk
)
{
d
->
doInterruptInferior
();
}
else
{
...
...
src/plugins/debugger/debuggerplugin.cpp
View file @
8d54298c
...
...
@@ -1112,7 +1112,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
m_sessionEngine
=
new
SessionEngine
;
// Snapshot
m_snapshotHandler
=
new
SnapshotHandler
(
m_sessionEngine
)
;
m_snapshotHandler
=
new
SnapshotHandler
;
m_snapshotWindow
->
setModel
(
m_snapshotHandler
->
model
());
// Debug mode setup
...
...
src/plugins/debugger/snapshothandler.cpp
View file @
8d54298c
...
...
@@ -116,9 +116,8 @@ QDebug operator<<(QDebug d, const SnapshotData &f)
//
////////////////////////////////////////////////////////////////////////
SnapshotHandler
::
SnapshotHandler
(
SessionEngine
*
engine
)
:
m_engine
(
engine
),
m_positionIcon
(
QIcon
(
":/debugger/images/location_16.png"
)),
SnapshotHandler
::
SnapshotHandler
()
:
m_positionIcon
(
QIcon
(
":/debugger/images/location_16.png"
)),
m_emptyIcon
(
QIcon
(
":/debugger/images/debugger_empty_14.png"
))
{
m_currentIndex
=
-
1
;
...
...
@@ -223,28 +222,25 @@ bool SnapshotHandler::setData
}
if
(
index
.
isValid
()
&&
role
==
RequestActivateSnapshotRole
)
{
m_currentIndex
=
index
.
row
();
qDebug
()
<<
"ACTIVATING INDEX: "
<<
m_currentIndex
<<
" OF "
<<
size
();
//qDebug() << "ACTIVATING INDEX: " << m_currentIndex << " OF " << size();
DebuggerPlugin
::
displayDebugger
(
m_snapshots
.
at
(
m_currentIndex
));
reset
();
return
true
;
}
if
(
index
.
isValid
()
&&
role
==
RequestRemoveSnapshotRole
)
{
DebuggerEngine
*
engine
=
engineAt
(
index
.
row
());
//qDebug() << "REMOVING " << engine;
QTC_ASSERT
(
engine
,
return
false
);
engine
->
quitDebugger
();
return
true
;
}
return
false
;
}
#if 0
// See http://sourceware.org/bugzilla/show_bug.cgi?id=11241.
setState(EngineSetupRequested);
postCommand("set stack-cache off");
QMessageBox *mb = showMessageBox(QMessageBox::Critical,
tr("Snapshot Reloading"),
tr("In order to load snapshots the debugged process needs "
"to be stopped. Continuation will not be possible afterwards.\n"
"Do you want to stop the debugged process and load the selected "
"snapshot?"), QMessageBox::Ok | QMessageBox::Cancel);
if (mb->exec() == QMessageBox::Cancel)
#endif
void
SnapshotHandler
::
removeAll
()
...
...
src/plugins/debugger/snapshothandler.h
View file @
8d54298c
...
...
@@ -38,11 +38,9 @@
namespace
Debugger
{
class
DebuggerRunControl
;
class
DebuggerStartParameters
;
namespace
Internal
{
class
SessionEngine
;
class
DebuggerEngine
;
...
...
@@ -58,7 +56,7 @@ class SnapshotHandler : public QAbstractTableModel
Q_OBJECT
public:
explicit
SnapshotHandler
(
SessionEngine
*
engine
);
explicit
SnapshotHandler
();
~
SnapshotHandler
();
// Called from SnapshotHandler after a new snapshot has been added
...
...
@@ -82,7 +80,6 @@ private:
DebuggerEngine
*
engineAt
(
int
i
)
const
;
void
removeSnapshot
(
int
index
);
SessionEngine
*
m_engine
;
int
m_currentIndex
;
QList
<
QPointer
<
DebuggerRunControl
>
>
m_snapshots
;
const
QVariant
m_positionIcon
;
...
...
src/plugins/debugger/snapshotwindow.cpp
View file @
8d54298c
...
...
@@ -93,24 +93,8 @@ void SnapshotWindow::rowActivated(const QModelIndex &index)
void
SnapshotWindow
::
removeSnapshots
(
const
QModelIndexList
&
indexes
)
{
QTC_ASSERT
(
!
indexes
.
isEmpty
(),
return
);
QList
<
int
>
list
;
foreach
(
const
QModelIndex
&
idx
,
indexes
)
list
.
append
(
idx
.
row
());
removeSnapshots
(
list
);
}
void
SnapshotWindow
::
removeSnapshots
(
QList
<
int
>
list
)
{
if
(
list
.
empty
())
return
;
const
int
firstRow
=
list
.
front
();
qSort
(
list
.
begin
(),
list
.
end
());
for
(
int
i
=
list
.
size
();
--
i
>=
0
;
)
model
()
->
setData
(
QModelIndex
(),
list
.
at
(
i
),
RequestRemoveSnapshotRole
);
const
int
row
=
qMin
(
firstRow
,
model
()
->
rowCount
()
-
1
);
if
(
row
>=
0
)
setCurrentIndex
(
model
()
->
index
(
row
,
0
));
model
()
->
setData
(
idx
,
QVariant
(),
RequestRemoveSnapshotRole
);
}
void
SnapshotWindow
::
keyPressEvent
(
QKeyEvent
*
ev
)
...
...
@@ -137,6 +121,11 @@ void SnapshotWindow::contextMenuEvent(QContextMenuEvent *ev)
menu
.
addSeparator
();
QAction
*
actRemove
=
menu
.
addAction
(
tr
(
"Remove Snapshot"
));
actRemove
->
setEnabled
(
idx
.
isValid
());
menu
.
addSeparator
();
QAction
*
actAdjust
=
menu
.
addAction
(
tr
(
"Adjust Column Widths to Contents"
));
QAction
*
actAlwaysAdjust
=
...
...
@@ -152,6 +141,8 @@ void SnapshotWindow::contextMenuEvent(QContextMenuEvent *ev)
if
(
act
==
actCreate
)
model
()
->
setData
(
idx
,
idx
.
row
(),
RequestMakeSnapshotRole
);
else
if
(
act
==
actRemove
)
model
()
->
setData
(
idx
,
idx
.
row
(),
RequestRemoveSnapshotRole
);
else
if
(
act
==
actAdjust
)
resizeColumnsToContents
();
else
if
(
act
==
actAlwaysAdjust
)
...
...
src/plugins/debugger/snapshotwindow.h
View file @
8d54298c
...
...
@@ -60,7 +60,6 @@ private:
void
keyPressEvent
(
QKeyEvent
*
ev
);
void
contextMenuEvent
(
QContextMenuEvent
*
ev
);
void
removeSnapshots
(
const
QModelIndexList
&
list
);
void
removeSnapshots
(
QList
<
int
>
rows
);
bool
m_alwaysResizeColumnsToContents
;
};
...
...
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