Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
b7563b3d
Commit
b7563b3d
authored
Jun 11, 2010
by
hjk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debugger: streamline RunControl creation a bit
parent
628cf52f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
62 deletions
+59
-62
src/plugins/debugger/debuggerrunner.cpp
src/plugins/debugger/debuggerrunner.cpp
+53
-59
src/plugins/debugger/debuggerrunner.h
src/plugins/debugger/debuggerrunner.h
+6
-3
No files found.
src/plugins/debugger/debuggerrunner.cpp
View file @
b7563b3d
...
...
@@ -76,75 +76,39 @@ QString DebuggerRunControlFactory::displayName() const
return
tr
(
"Debug"
);
}
RunControl
*
DebuggerRunControlFactory
::
create
(
const
DebuggerStartParametersPtr
&
sp
)
static
DebuggerStartParametersPtr
localStartParameters
(
RunConfiguration
*
runConfiguration
)
{
return
new
DebuggerRunControl
(
m_manager
,
sp
);
}
RunControl
*
DebuggerRunControlFactory
::
create
(
RunConfiguration
*
runConfiguration
,
const
QString
&
mode
)
{
QTC_ASSERT
(
mode
==
ProjectExplorer
::
Constants
::
DEBUGMODE
,
return
0
);
LocalApplicationRunConfiguration
*
rc
=
qobject_cast
<
LocalApplicationRunConfiguration
*>
(
runConfiguration
);
QTC_ASSERT
(
rc
,
return
0
);
return
new
DebuggerRunControl
(
m_manager
,
rc
);
}
DebuggerStartParametersPtr
sp
(
new
DebuggerStartParameters
());
QTC_ASSERT
(
runConfiguration
,
return
sp
);
LocalApplicationRunConfiguration
*
rc
=
qobject_cast
<
LocalApplicationRunConfiguration
*>
(
runConfiguration
);
QTC_ASSERT
(
rc
,
return
sp
);
QWidget
*
DebuggerRunControlFactory
::
createConfigurationWidget
(
RunConfiguration
*
runConfiguration
)
{
// NBS TODO: Add GDB-specific configuration widget
Q_UNUSED
(
runConfiguration
)
return
0
;
}
////////////////////////////////////////////////////////////////////////
//
// DebuggerRunControl
//
////////////////////////////////////////////////////////////////////////
DebuggerRunControl
::
DebuggerRunControl
(
DebuggerManager
*
manager
,
LocalApplicationRunConfiguration
*
runConfiguration
)
:
RunControl
(
runConfiguration
,
ProjectExplorer
::
Constants
::
DEBUGMODE
),
m_startParameters
(
new
DebuggerStartParameters
()),
m_manager
(
manager
),
m_running
(
false
)
{
init
();
if
(
!
runConfiguration
)
return
;
sp
->
startMode
=
StartInternal
;
sp
->
executable
=
rc
->
executable
();
sp
->
environment
=
rc
->
environment
().
toStringList
();
sp
->
workingDirectory
=
rc
->
workingDirectory
();
sp
->
processArgs
=
rc
->
commandLineArguments
();
m_startParameters
->
startMode
=
StartInternal
;
m_startParameters
->
executable
=
runConfiguration
->
executable
();
m_startParameters
->
environment
=
runConfiguration
->
environment
().
toStringList
();
m_startParameters
->
workingDirectory
=
runConfiguration
->
workingDirectory
();
m_startParameters
->
processArgs
=
runConfiguration
->
commandLineArguments
();
switch
(
m_startParameters
->
toolChainType
)
{
switch
(
sp
->
toolChainType
)
{
case
ProjectExplorer
::
ToolChain
::
UNKNOWN
:
case
ProjectExplorer
::
ToolChain
::
INVALID
:
m_startParameter
s
->
toolChainType
=
r
unConfiguration
->
toolChainType
();
s
p
->
toolChainType
=
r
c
->
toolChainType
();
break
;
default:
break
;
}
if
(
r
unConfiguration
->
target
()
->
project
())
{
BuildConfiguration
*
bc
=
r
unConfiguration
->
target
()
->
activeBuildConfiguration
();
if
(
r
c
->
target
()
->
project
())
{
BuildConfiguration
*
bc
=
r
c
->
target
()
->
activeBuildConfiguration
();
if
(
bc
)
m_startParameter
s
->
buildDirectory
=
bc
->
buildDirectory
();
s
p
->
buildDirectory
=
bc
->
buildDirectory
();
}
m_startParameters
->
useTerminal
=
runConfiguration
->
runMode
()
==
LocalApplicationRunConfiguration
::
Console
;
m_startParameters
->
dumperLibrary
=
runConfiguration
->
dumperLibrary
();
m_startParameters
->
dumperLibraryLocations
=
runConfiguration
->
dumperLibraryLocations
();
sp
->
useTerminal
=
rc
->
runMode
()
==
LocalApplicationRunConfiguration
::
Console
;
sp
->
dumperLibrary
=
rc
->
dumperLibrary
();
sp
->
dumperLibraryLocations
=
rc
->
dumperLibraryLocations
();
QString
qmakePath
=
ProjectExplorer
::
DebuggingHelperLibrary
::
findSystemQt
(
r
unConfiguration
->
environment
());
r
c
->
environment
());
if
(
!
qmakePath
.
isEmpty
())
{
QProcess
proc
;
QStringList
args
;
...
...
@@ -154,13 +118,43 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
proc
.
waitForFinished
();
QByteArray
ba
=
proc
.
readAllStandardOutput
().
trimmed
();
QFileInfo
fi
(
QString
::
fromLocal8Bit
(
ba
)
+
"/.."
);
m_startParameter
s
->
qtInstallPath
=
fi
.
absoluteFilePath
();
s
p
->
qtInstallPath
=
fi
.
absoluteFilePath
();
}
return
sp
;
}
RunControl
*
DebuggerRunControlFactory
::
create
(
RunConfiguration
*
runConfiguration
,
const
QString
&
mode
)
{
QTC_ASSERT
(
mode
==
ProjectExplorer
::
Constants
::
DEBUGMODE
,
return
0
);
DebuggerStartParametersPtr
sp
=
localStartParameters
(
runConfiguration
);
return
new
DebuggerRunControl
(
m_manager
,
sp
,
runConfiguration
);
}
RunControl
*
DebuggerRunControlFactory
::
create
(
const
DebuggerStartParametersPtr
&
sp
)
{
return
new
DebuggerRunControl
(
m_manager
,
sp
,
0
);
}
QWidget
*
DebuggerRunControlFactory
::
createConfigurationWidget
(
RunConfiguration
*
runConfiguration
)
{
// NBS TODO: Add GDB-specific configuration widget
Q_UNUSED
(
runConfiguration
)
return
0
;
}
DebuggerRunControl
::
DebuggerRunControl
(
DebuggerManager
*
manager
,
const
DebuggerStartParametersPtr
&
startParameters
)
:
RunControl
(
0
,
ProjectExplorer
::
Constants
::
DEBUGMODE
),
////////////////////////////////////////////////////////////////////////
//
// DebuggerRunControl
//
////////////////////////////////////////////////////////////////////////
DebuggerRunControl
::
DebuggerRunControl
(
DebuggerManager
*
manager
,
const
DebuggerStartParametersPtr
&
startParameters
,
ProjectExplorer
::
RunConfiguration
*
runConfiguration
)
:
RunControl
(
runConfiguration
,
ProjectExplorer
::
Constants
::
DEBUGMODE
),
m_startParameters
(
startParameters
),
m_manager
(
manager
),
m_running
(
false
)
...
...
src/plugins/debugger/debuggerrunner.h
View file @
b7563b3d
...
...
@@ -55,6 +55,7 @@ public:
virtual
QWidget
*
createConfigurationWidget
(
ProjectExplorer
::
RunConfiguration
*
runConfiguration
);
// This is used by the "Non-Standard" scenarios, e.g. Attach to Core.
ProjectExplorer
::
RunControl
*
create
(
const
DebuggerStartParametersPtr
&
sp
);
private:
...
...
@@ -69,9 +70,11 @@ class DEBUGGER_EXPORT DebuggerRunControl
Q_OBJECT
public:
DebuggerRunControl
(
DebuggerManager
*
manager
,
ProjectExplorer
::
LocalApplicationRunConfiguration
*
runConfiguration
);
DebuggerRunControl
(
DebuggerManager
*
manager
,
const
DebuggerStartParametersPtr
&
startParameters
);
// startParameters are primary. If the user code has a RunConfiguration
// (like the 'standard' LocalRunConfiguration), it should pass it so
// we can pass it down to the ProjectExplorer::RunControl constructor.
DebuggerRunControl
(
DebuggerManager
*
manager
,
const
DebuggerStartParametersPtr
&
startParameters
,
ProjectExplorer
::
RunConfiguration
*
runConfiguration
=
0
);
void
setCustomEnvironment
(
ProjectExplorer
::
Environment
env
);
...
...
Write
Preview
Markdown
is supported
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