Skip to content
GitLab
Menu
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
91e6c14f
Commit
91e6c14f
authored
Dec 10, 2010
by
hjk
Browse files
debugger: find better separation between runcontrol and engine
parent
18986b8c
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/debuggercore.h
View file @
91e6c14f
...
...
@@ -54,7 +54,6 @@ class SavedAction;
namespace
Debugger
{
class
DebuggerEngine
;
class
DebuggerRunControl
;
class
DebuggerStartParameters
;
namespace
Internal
{
...
...
@@ -101,8 +100,8 @@ public:
virtual
void
removeLocationMark
()
=
0
;
virtual
bool
isReverseDebugging
()
const
=
0
;
virtual
void
runControlStarted
(
Debugger
RunControl
*
runControl
)
=
0
;
virtual
void
runControlFinished
(
Debugger
RunControl
*
runControl
)
=
0
;
virtual
void
runControlStarted
(
Debugger
Engine
*
engine
)
=
0
;
virtual
void
runControlFinished
(
Debugger
Engine
*
engine
)
=
0
;
virtual
void
displayDebugger
(
DebuggerEngine
*
engine
,
bool
updateEngine
)
=
0
;
virtual
DebuggerLanguages
activeLanguages
()
const
=
0
;
virtual
void
synchronizeBreakpoints
()
=
0
;
...
...
src/plugins/debugger/debuggerengine.h
View file @
91e6c14f
...
...
@@ -333,9 +333,9 @@ protected:
virtual
void
shutdownInferior
()
=
0
;
virtual
void
shutdownEngine
()
=
0
;
protected:
DebuggerRunControl
*
runControl
()
const
;
DebuggerRunControl
*
runControl
()
const
;
// FIXME: Protect.
protected:
static
QString
msgWatchpointTriggered
(
BreakpointId
id
,
int
number
,
quint64
address
);
static
QString
msgWatchpointTriggered
(
BreakpointId
id
,
...
...
src/plugins/debugger/debuggerplugin.cpp
View file @
91e6c14f
...
...
@@ -980,20 +980,16 @@ public slots:
{
showMessage
(
"ATTEMPT SYNC"
,
LogDebug
);
for
(
int
i
=
0
,
n
=
m_snapshotHandler
->
size
();
i
!=
n
;
++
i
)
{
if
(
DebuggerRunControl
*
runControl
=
m_snapshotHandler
->
at
(
i
))
{
DebuggerEngine
*
engine
=
runControl
->
engine
();
if
(
DebuggerEngine
*
engine
=
m_snapshotHandler
->
at
(
i
))
engine
->
attemptBreakpointSynchronization
();
}
}
}
void
synchronizeWatchers
()
{
for
(
int
i
=
0
,
n
=
m_snapshotHandler
->
size
();
i
!=
n
;
++
i
)
{
if
(
DebuggerRunControl
*
runControl
=
m_snapshotHandler
->
at
(
i
))
{
DebuggerEngine
*
engine
=
runControl
->
engine
();
if
(
DebuggerEngine
*
engine
=
m_snapshotHandler
->
at
(
i
))
engine
->
watchHandler
()
->
updateWatchers
();
}
}
}
...
...
@@ -1043,8 +1039,8 @@ public slots:
bool
hasSnapshots
()
const
{
return
m_snapshotHandler
->
size
();
}
void
createNewDock
(
QWidget
*
widget
);
void
runControlStarted
(
Debugger
RunControl
*
runControl
);
void
runControlFinished
(
Debugger
RunControl
*
runControl
);
void
runControlStarted
(
Debugger
Engine
*
engine
);
void
runControlFinished
(
Debugger
Engine
*
engine
);
DebuggerLanguages
activeLanguages
()
const
;
QString
gdbBinaryForToolChain
(
int
toolChain
)
const
;
void
remoteCommand
(
const
QStringList
&
options
,
const
QStringList
&
);
...
...
@@ -1477,11 +1473,11 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
}
for
(
int
i
=
0
,
n
=
m_snapshotHandler
->
size
();
i
!=
n
;
++
i
)
{
// Run controls might be deleted during exit.
if
(
DebuggerRunControl
*
runControl
=
m_snapshotHandler
->
at
(
i
))
{
if
(
DebuggerEngine
*
engine
=
m_snapshotHandler
->
at
(
i
))
{
DebuggerRunControl
*
runControl
=
engine
->
runControl
();
RunConfiguration
*
rc
=
runControl
->
runConfiguration
();
if
(
rc
==
activeRc
)
{
m_snapshotHandler
->
setCurrentIndex
(
i
);
DebuggerEngine
*
engine
=
runControl
->
engine
();
updateState
(
engine
);
return
;
}
...
...
@@ -2387,7 +2383,7 @@ void DebuggerPluginPrivate::aboutToUnloadSession()
// with command-line debugging startup.
// FIXME ABC: Still wanted? Iterate?
//if (d->m_engine && state() != DebuggerNotReady
// &&
runControl
()->sp().startMode == StartInternal)
// &&
engine
()->sp().startMode == StartInternal)
// d->m_engine->shutdown();
}
...
...
@@ -2578,22 +2574,21 @@ void DebuggerPluginPrivate::createNewDock(QWidget *widget)
dockWidget
->
show
();
}
void
DebuggerPluginPrivate
::
runControlStarted
(
Debugger
RunControl
*
runControl
)
void
DebuggerPluginPrivate
::
runControlStarted
(
Debugger
Engine
*
engine
)
{
activateDebugMode
();
DebuggerEngine
*
engine
=
runControl
->
engine
();
const
QString
message
=
tr
(
"Starting debugger '%1' for tool chain '%2'..."
)
.
arg
(
engine
->
objectName
())
.
arg
(
engine
->
startParameters
().
toolChainName
());
showMessage
(
message
,
StatusBar
);
showMessage
(
m_debuggerSettings
->
dump
(),
LogDebug
);
m_snapshotHandler
->
appendSnapshot
(
runControl
);
m_snapshotHandler
->
appendSnapshot
(
engine
);
connectEngine
(
engine
);
}
void
DebuggerPluginPrivate
::
runControlFinished
(
Debugger
RunControl
*
runControl
)
void
DebuggerPluginPrivate
::
runControlFinished
(
Debugger
Engine
*
engine
)
{
m_snapshotHandler
->
removeSnapshot
(
runControl
);
m_snapshotHandler
->
removeSnapshot
(
engine
);
if
(
m_snapshotHandler
->
size
()
==
0
)
{
// Last engine quits.
disconnectEngine
();
...
...
src/plugins/debugger/debuggerrunner.cpp
View file @
91e6c14f
...
...
@@ -656,7 +656,7 @@ void DebuggerRunControl::start()
return
;
}
debuggerCore
()
->
runControlStarted
(
this
);
debuggerCore
()
->
runControlStarted
(
engine
()
);
// We might get a synchronous startFailed() notification on Windows,
// when launching the process fails. Emit a proper finished() sequence.
...
...
@@ -684,7 +684,7 @@ void DebuggerRunControl::handleFinished()
emit
addToOutputWindowInline
(
this
,
tr
(
"Debugging has finished"
),
false
);
if
(
engine
())
engine
()
->
handleFinished
();
debuggerCore
()
->
runControlFinished
(
this
);
debuggerCore
()
->
runControlFinished
(
engine
()
);
}
void
DebuggerRunControl
::
showMessage
(
const
QString
&
msg
,
int
channel
)
...
...
src/plugins/debugger/snapshothandler.cpp
View file @
91e6c14f
...
...
@@ -123,21 +123,14 @@ SnapshotHandler::SnapshotHandler()
SnapshotHandler
::~
SnapshotHandler
()
{
for
(
int
i
=
m_snapshots
.
size
();
--
i
>=
0
;
)
{
if
(
DebuggerEngine
*
engine
=
engineA
t
(
i
))
{
const
DebuggerStartParameters
&
sp
=
engine
->
startParameters
();
if
(
DebuggerEngine
*
engine
=
a
t
(
i
))
{
const
DebuggerStartParameters
&
sp
=
engine
->
startParameters
();
if
(
sp
.
isSnapshot
&&
!
sp
.
coreFile
.
isEmpty
())
QFile
::
remove
(
sp
.
coreFile
);
}
}
}
DebuggerEngine
*
SnapshotHandler
::
engineAt
(
int
i
)
const
{
DebuggerEngine
*
engine
=
m_snapshots
.
at
(
i
)
->
engine
();
QTC_ASSERT
(
engine
,
qDebug
()
<<
"ENGINE AT "
<<
i
<<
"DELETED"
);
return
engine
;
}
int
SnapshotHandler
::
rowCount
(
const
QModelIndex
&
parent
)
const
{
// Since the stack is not a tree, row count is 0 for any valid parent
...
...
@@ -154,7 +147,7 @@ QVariant SnapshotHandler::data(const QModelIndex &index, int role) const
if
(
!
index
.
isValid
()
||
index
.
row
()
>=
m_snapshots
.
size
())
return
QVariant
();
const
DebuggerEngine
*
engine
=
engineA
t
(
index
.
row
());
const
DebuggerEngine
*
engine
=
a
t
(
index
.
row
());
if
(
role
==
SnapshotCapabilityRole
)
return
engine
&&
(
engine
->
debuggerCapabilities
()
&
SnapshotCapability
);
...
...
@@ -213,20 +206,20 @@ void SnapshotHandler::activateSnapshot(int index)
{
m_currentIndex
=
index
;
//qDebug() << "ACTIVATING INDEX: " << m_currentIndex << " OF " << size();
debuggerCore
()
->
displayDebugger
(
engineA
t
(
index
),
true
);
debuggerCore
()
->
displayDebugger
(
a
t
(
index
),
true
);
reset
();
}
void
SnapshotHandler
::
createSnapshot
(
int
index
)
{
DebuggerEngine
*
engine
=
engineA
t
(
index
);
DebuggerEngine
*
engine
=
a
t
(
index
);
QTC_ASSERT
(
engine
,
return
);
engine
->
createSnapshot
();
}
void
SnapshotHandler
::
removeSnapshot
(
int
index
)
{
DebuggerEngine
*
engine
=
engineA
t
(
index
);
DebuggerEngine
*
engine
=
a
t
(
index
);
//qDebug() << "REMOVING " << engine;
QTC_ASSERT
(
engine
,
return
);
#if 0
...
...
@@ -254,17 +247,17 @@ void SnapshotHandler::removeAll()
reset
();
}
void
SnapshotHandler
::
appendSnapshot
(
Debugger
RunControl
*
rc
)
void
SnapshotHandler
::
appendSnapshot
(
Debugger
Engine
*
engine
)
{
m_snapshots
.
append
(
rc
);
m_snapshots
.
append
(
engine
);
m_currentIndex
=
size
()
-
1
;
reset
();
}
void
SnapshotHandler
::
removeSnapshot
(
Debugger
RunControl
*
rc
)
void
SnapshotHandler
::
removeSnapshot
(
Debugger
Engine
*
engine
)
{
// Could be that the run controls died before it was appended.
int
index
=
m_snapshots
.
indexOf
(
rc
);
int
index
=
m_snapshots
.
indexOf
(
engine
);
if
(
index
!=
-
1
)
removeSnapshot
(
index
);
}
...
...
@@ -275,22 +268,10 @@ void SnapshotHandler::setCurrentIndex(int index)
reset
();
}
Debugger
RunControl
*
SnapshotHandler
::
at
(
int
i
)
const
Debugger
Engine
*
SnapshotHandler
::
at
(
int
i
)
const
{
return
m_snapshots
.
at
(
i
).
data
();
}
QList
<
DebuggerRunControl
*>
SnapshotHandler
::
runControls
()
const
{
// Return unique list of run controls
QList
<
DebuggerRunControl
*>
rc
;
rc
.
reserve
(
m_snapshots
.
size
());
foreach
(
const
QPointer
<
DebuggerRunControl
>
&
runControlPtr
,
m_snapshots
)
if
(
DebuggerRunControl
*
runControl
=
runControlPtr
)
if
(
!
rc
.
contains
(
runControl
))
rc
.
push_back
(
runControl
);
return
rc
;
}
}
// namespace Internal
}
// namespace Debugger
src/plugins/debugger/snapshothandler.h
View file @
91e6c14f
...
...
@@ -35,7 +35,6 @@
namespace
Debugger
{
class
DebuggerRunControl
;
class
DebuggerEngine
;
namespace
Internal
{
...
...
@@ -59,12 +58,11 @@ public:
void
removeAll
();
QAbstractItemModel
*
model
()
{
return
this
;
}
int
currentIndex
()
const
{
return
m_currentIndex
;
}
void
appendSnapshot
(
Debugger
RunControl
*
rc
);
void
removeSnapshot
(
Debugger
RunControl
*
rc
);
void
appendSnapshot
(
Debugger
Engine
*
engine
);
void
removeSnapshot
(
Debugger
Engine
*
engine
);
void
setCurrentIndex
(
int
index
);
int
size
()
const
{
return
m_snapshots
.
size
();
}
DebuggerRunControl
*
at
(
int
index
)
const
;
QList
<
DebuggerRunControl
*>
runControls
()
const
;
DebuggerEngine
*
at
(
int
index
)
const
;
void
createSnapshot
(
int
index
);
void
activateSnapshot
(
int
index
);
...
...
@@ -78,10 +76,9 @@ private:
QVariant
headerData
(
int
section
,
Qt
::
Orientation
orientation
,
int
role
)
const
;
Qt
::
ItemFlags
flags
(
const
QModelIndex
&
index
)
const
;
Q_SLOT
void
resetModel
()
{
reset
();
}
DebuggerEngine
*
engineAt
(
int
i
)
const
;
int
m_currentIndex
;
QList
<
QPointer
<
Debugger
RunControl
>
>
m_snapshots
;
QList
<
QPointer
<
Debugger
Engine
>
>
m_snapshots
;
const
QVariant
m_positionIcon
;
const
QVariant
m_emptyIcon
;
};
...
...
src/plugins/debugger/snapshotwindow.cpp
View file @
91e6c14f
...
...
@@ -32,7 +32,7 @@
#include "debuggeractions.h"
#include "debuggercore.h"
#include "debugger
run
ne
r
.h"
#include "debugger
engi
ne.h"
#include <utils/qtcassert.h>
#include <utils/savedaction.h>
...
...
@@ -136,7 +136,7 @@ void SnapshotWindow::contextMenuEvent(QContextMenuEvent *ev)
void
SnapshotWindow
::
removeSnapshot
(
int
i
)
{
m_snapshotHandler
->
at
(
i
)
->
stop
();
m_snapshotHandler
->
at
(
i
)
->
quitDebugger
();
}
void
SnapshotWindow
::
resizeColumnsToContents
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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