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
96561a38
Commit
96561a38
authored
Jul 21, 2010
by
hjk
Browse files
debugger: enable debugging of multiple projects at the same time
parent
990dba75
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/debuggerplugin.cpp
View file @
96561a38
...
...
@@ -96,6 +96,7 @@
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <texteditor/basetexteditor.h>
...
...
@@ -940,6 +941,7 @@ public slots:
DebuggerState
state
()
const
{
return
m_state
;
}
void
updateState
(
DebuggerEngine
*
engine
);
void
onCurrentProjectChanged
(
ProjectExplorer
::
Project
*
project
);
void
resetLocation
();
void
gotoLocation
(
const
QString
&
file
,
int
line
,
bool
setMarker
);
...
...
@@ -1617,9 +1619,35 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
setInitialState
();
connectEngine
(
m_sessionEngine
,
false
);
connect
(
sessionManager
(),
SIGNAL
(
startupProjectChanged
(
ProjectExplorer
::
Project
*
)),
SLOT
(
onCurrentProjectChanged
(
ProjectExplorer
::
Project
*
)));
return
true
;
}
void
DebuggerPluginPrivate
::
onCurrentProjectChanged
(
ProjectExplorer
::
Project
*
project
)
{
QTC_ASSERT
(
project
,
return
);
ProjectExplorer
::
Target
*
target
=
project
->
activeTarget
();
QTC_ASSERT
(
target
,
return
);
ProjectExplorer
::
RunConfiguration
*
activeRc
=
target
->
activeRunConfiguration
();
QTC_ASSERT
(
activeRc
,
return
);
for
(
int
i
=
0
,
n
=
m_snapshotHandler
->
size
();
i
!=
n
;
++
i
)
{
DebuggerRunControl
*
runControl
=
m_snapshotHandler
->
at
(
i
);
RunConfiguration
*
rc
=
runControl
->
runConfiguration
();
if
(
rc
==
activeRc
)
{
m_snapshotHandler
->
setCurrentIndex
(
i
);
DebuggerEngine
*
engine
=
runControl
->
engine
();
updateState
(
engine
);
return
;
}
}
// No corresponding debugger found. So we are ready to start one.
ICore
*
core
=
ICore
::
instance
();
core
->
updateAdditionalContexts
(
m_gdbRunningContext
,
Core
::
Context
());
}
void
DebuggerPluginPrivate
::
onAction
()
{
QAction
*
act
=
qobject_cast
<
QAction
*>
(
sender
());
...
...
@@ -2163,7 +2191,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
cleanupViews
();
}
const
bool
startIsContinue
=
(
m_
state
==
InferiorStopOk
);
const
bool
startIsContinue
=
(
engine
->
state
()
==
InferiorStopOk
);
ICore
*
core
=
ICore
::
instance
();
if
(
startIsContinue
)
core
->
updateAdditionalContexts
(
Core
::
Context
(),
m_gdbRunningContext
);
...
...
src/plugins/debugger/debuggerrunner.cpp
View file @
96561a38
...
...
@@ -208,7 +208,8 @@ QWidget *DebuggerRunControlFactory::createConfigurationWidget
DebuggerRunControl
::
DebuggerRunControl
(
RunConfiguration
*
runConfiguration
,
DebuggerEngineType
enabledEngines
,
const
DebuggerStartParameters
&
sp
)
:
RunControl
(
runConfiguration
,
ProjectExplorer
::
Constants
::
DEBUGMODE
)
:
RunControl
(
runConfiguration
,
ProjectExplorer
::
Constants
::
DEBUGMODE
),
m_myRunConfiguration
(
runConfiguration
)
{
m_running
=
false
;
m_enabledEngines
=
enabledEngines
;
...
...
src/plugins/debugger/debuggerrunner.h
View file @
96561a38
...
...
@@ -86,7 +86,8 @@ class DEBUGGER_EXPORT DebuggerRunControl
Q_OBJECT
public:
DebuggerRunControl
(
ProjectExplorer
::
RunConfiguration
*
runConfiguration
,
typedef
ProjectExplorer
::
RunConfiguration
RunConfiguration
;
DebuggerRunControl
(
RunConfiguration
*
runConfiguration
,
DebuggerEngineType
enabledEngines
,
const
DebuggerStartParameters
&
sp
);
~
DebuggerRunControl
();
...
...
@@ -104,6 +105,7 @@ public:
void
startFailed
();
void
startSuccessful
();
void
debuggingFinished
();
RunConfiguration
*
runConfiguration
()
const
{
return
m_myRunConfiguration
.
data
();
}
DebuggerState
state
()
const
;
Internal
::
DebuggerEngine
*
engine
();
...
...
@@ -124,6 +126,7 @@ private:
DebuggerEngineType
engineForMode
(
DebuggerStartMode
mode
);
Internal
::
DebuggerEngine
*
m_engine
;
const
QWeakPointer
<
RunConfiguration
>
m_myRunConfiguration
;
bool
m_running
;
DebuggerEngineType
m_enabledEngines
;
QString
m_errorMessage
;
...
...
src/plugins/debugger/snapshothandler.cpp
View file @
96561a38
...
...
@@ -286,5 +286,10 @@ void SnapshotHandler::setCurrentIndex(int index)
reset
();
}
DebuggerRunControl
*
SnapshotHandler
::
at
(
int
i
)
{
return
m_snapshots
.
at
(
i
).
data
();
}
}
// namespace Internal
}
// namespace Debugger
src/plugins/debugger/snapshothandler.h
View file @
96561a38
...
...
@@ -67,6 +67,7 @@ public:
void
removeSnapshot
(
DebuggerRunControl
*
rc
);
void
setCurrentIndex
(
int
index
);
int
size
()
const
{
return
m_snapshots
.
size
();
}
DebuggerRunControl
*
at
(
int
i
);
private:
// QAbstractTableModel
...
...
src/plugins/projectexplorer/projectexplorer.cpp
View file @
96561a38
...
...
@@ -186,7 +186,6 @@ struct ProjectExplorerPluginPrivate {
QString
m_lastOpenDirectory
;
RunConfiguration
*
m_delayedRunConfiguration
;
// TODO this is not right
RunControl
*
m_debuggingRunControl
;
QString
m_runMode
;
QString
m_projectFilterString
;
Internal
::
MiniProjectTargetSelector
*
m_targetSelector
;
...
...
@@ -200,7 +199,6 @@ ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
m_currentProject
(
0
),
m_currentNode
(
0
),
m_delayedRunConfiguration
(
0
),
m_debuggingRunControl
(
0
),
m_projectsMode
(
0
)
{
}
...
...
@@ -1319,9 +1317,6 @@ void ProjectExplorerPlugin::startRunControl(RunControl *runControl, const QStrin
connect
(
runControl
,
SIGNAL
(
finished
()),
this
,
SLOT
(
runControlFinished
()));
if
(
runMode
==
ProjectExplorer
::
Constants
::
DEBUGMODE
)
d
->
m_debuggingRunControl
=
runControl
;
runControl
->
start
();
updateRunActions
();
}
...
...
@@ -1788,7 +1783,7 @@ void ProjectExplorerPlugin::runProjectImpl(Project *pro, QString mode)
void
ProjectExplorerPlugin
::
debugProject
()
{
Project
*
pro
=
startupProject
();
if
(
!
pro
||
d
->
m_debuggingRunControl
)
if
(
!
pro
)
return
;
runProjectImpl
(
pro
,
ProjectExplorer
::
Constants
::
DEBUGMODE
);
...
...
@@ -1821,9 +1816,6 @@ bool ProjectExplorerPlugin::showBuildConfigDialog()
void
ProjectExplorerPlugin
::
runControlFinished
()
{
if
(
sender
()
==
d
->
m_debuggingRunControl
)
d
->
m_debuggingRunControl
=
0
;
updateRunActions
();
}
...
...
@@ -1934,7 +1926,7 @@ void ProjectExplorerPlugin::updateRunActions()
bool
canRun
=
findRunControlFactory
(
activeRC
,
ProjectExplorer
::
Constants
::
RUNMODE
)
&&
activeRC
->
isEnabled
();
const
bool
canDebug
=
!
d
->
m_debuggingRunControl
&&
findRunControlFactory
(
activeRC
,
ProjectExplorer
::
Constants
::
DEBUGMODE
)
const
bool
canDebug
=
findRunControlFactory
(
activeRC
,
ProjectExplorer
::
Constants
::
DEBUGMODE
)
&&
activeRC
->
isEnabled
();
const
bool
building
=
d
->
m_buildManager
->
isBuilding
();
...
...
src/plugins/projectexplorer/target.h
View file @
96561a38
...
...
@@ -65,11 +65,11 @@ public:
// Running
QList
<
RunConfiguration
*>
runConfigurations
()
const
;
void
addRunConfiguration
(
RunConfiguration
*
runConfiguration
);
void
removeRunConfiguration
(
RunConfiguration
*
runConfiguration
);
void
addRunConfiguration
(
RunConfiguration
*
runConfiguration
);
void
removeRunConfiguration
(
RunConfiguration
*
runConfiguration
);
RunConfiguration
*
activeRunConfiguration
()
const
;
void
setActiveRunConfiguration
(
RunConfiguration
*
runConfiguration
);
RunConfiguration
*
activeRunConfiguration
()
const
;
void
setActiveRunConfiguration
(
RunConfiguration
*
runConfiguration
);
// Returns whether this target is actually available at he time
// of the call. A target may become unavailable e.g. when a Qt version
...
...
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