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
e6958859
Commit
e6958859
authored
Sep 08, 2010
by
Christian Kandeler
Browse files
Maemo: Support QML debugging.
Could not be tested with actual QML project yet. Reviewed-by: kh1
parent
68f13d3f
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp
View file @
e6958859
...
...
@@ -44,6 +44,7 @@
#include
<debugger/debuggerengine.h>
#include
<debugger/debuggerplugin.h>
#include
<debugger/debuggerrunner.h>
#include
<debugger/qml/qmlcppengine.h>
#include
<debugger/gdb/remotegdbserveradapter.h>
#include
<debugger/gdb/remoteplaingdbadapter.h>
#include
<projectexplorer/toolchain.h>
...
...
@@ -63,12 +64,18 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
{
DebuggerStartParameters
params
;
const
MaemoDeviceConfig
&
devConf
=
runConfig
->
deviceConfig
();
if
(
runConfig
->
useQmlDebugger
())
{
params
.
qmlServerAddress
=
runConfig
->
deviceConfig
().
server
.
host
;
params
.
qmlServerPort
=
qmlServerPort
(
runConfig
);
}
if
(
runConfig
->
useRemoteGdb
())
{
params
.
startMode
=
StartRemoteGdb
;
params
.
executable
=
runConfig
->
remoteExecutableFilePath
();
params
.
debuggerCommand
=
MaemoGlobal
::
remoteCommandPrefix
(
runConfig
->
remoteExecutableFilePath
())
+
QLatin1String
(
" /usr/bin/gdb"
);
+
environment
(
runConfig
)
+
QLatin1String
(
" /usr/bin/gdb"
);
params
.
connParams
=
devConf
.
server
;
params
.
localMountDir
=
runConfig
->
localDirToMountForRemoteGdb
();
params
.
remoteMountPoint
=
MaemoGlobal
::
remoteProjectSourcesMountPoint
();
...
...
@@ -84,9 +91,11 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
params
.
debuggerCommand
=
runConfig
->
gdbCmd
();
params
.
remoteChannel
=
devConf
.
server
.
host
+
QLatin1Char
(
':'
)
+
QString
::
number
(
gdbServerPort
(
runConfig
));
params
.
useServerStartScript
=
true
;
params
.
remoteArchitecture
=
QLatin1String
(
"arm"
);
}
params
.
processArgs
=
runConfig
->
arguments
();
params
.
sysRoot
=
runConfig
->
sysRoot
();
params
.
toolChainType
=
ToolChain
::
GCC_MAEMO
;
...
...
@@ -106,9 +115,15 @@ MaemoDebugSupport::MaemoDebugSupport(MaemoRunConfiguration *runConfig,
m_deviceConfig
(
m_runConfig
->
deviceConfig
()),
m_runner
(
new
MaemoSshRunner
(
this
,
m_runConfig
,
true
))
{
GdbEngine
*
engine
=
qobject_cast
<
GdbEngine
*>
(
m_runControl
->
engine
());
Q_ASSERT
(
engine
);
m_gdbAdapter
=
engine
->
gdbAdapter
();
GdbEngine
*
gdbEngine
=
qobject_cast
<
GdbEngine
*>
(
m_runControl
->
engine
());
if
(
!
gdbEngine
)
{
QmlCppEngine
*
const
qmlEngine
=
qobject_cast
<
QmlCppEngine
*>
(
m_runControl
->
engine
());
Q_ASSERT
(
qmlEngine
);
gdbEngine
=
qobject_cast
<
GdbEngine
*>
(
qmlEngine
->
cppEngine
());
}
Q_ASSERT
(
gdbEngine
);
m_gdbAdapter
=
gdbEngine
->
gdbAdapter
();
Q_ASSERT
(
m_gdbAdapter
);
connect
(
m_gdbAdapter
,
SIGNAL
(
requestSetup
()),
this
,
SLOT
(
handleAdapterSetupRequested
()));
...
...
@@ -230,9 +245,9 @@ void MaemoDebugSupport::startDebugging()
connect
(
m_runner
,
SIGNAL
(
remoteProcessStarted
()),
this
,
SLOT
(
handleRemoteProcessStarted
()));
const
QString
&
remoteExe
=
m_runConfig
->
remoteExecutableFilePath
();
m_runner
->
startExecution
(
QString
::
fromLocal8Bit
(
"%1 gdbserver :
%2
%3 %4"
)
m_runner
->
startExecution
(
QString
::
fromLocal8Bit
(
"%1
%2
gdbserver :%3 %4
%5
"
)
.
arg
(
MaemoGlobal
::
remoteCommandPrefix
(
remoteExe
))
.
arg
(
gdbServerPort
(
m_runConfig
))
.
arg
(
environment
(
m_runConfig
))
.
arg
(
gdbServerPort
(
m_runConfig
))
.
arg
(
remoteExe
).
arg
(
m_runConfig
->
arguments
()
.
join
(
QLatin1String
(
" "
))).
toUtf8
());
}
...
...
@@ -299,6 +314,23 @@ int MaemoDebugSupport::gdbServerPort(const MaemoRunConfiguration *rc)
return
rc
->
freePorts
().
getNext
();
}
int
MaemoDebugSupport
::
qmlServerPort
(
const
MaemoRunConfiguration
*
rc
)
{
MaemoPortList
portList
=
rc
->
freePorts
();
portList
.
getNext
();
return
portList
.
getNext
();
}
QString
MaemoDebugSupport
::
environment
(
const
MaemoRunConfiguration
*
rc
)
{
QList
<
EnvironmentItem
>
env
=
rc
->
userEnvironmentChanges
();
if
(
rc
->
useQmlDebugger
())
{
env
<<
EnvironmentItem
(
QLatin1String
(
Debugger
::
Constants
::
E_QML_DEBUG_SERVER_PORT
),
QString
::
number
(
qmlServerPort
(
rc
)));
}
return
MaemoGlobal
::
remoteEnvironment
(
env
);
}
QString
MaemoDebugSupport
::
uploadDir
(
const
MaemoDeviceConfig
&
devConf
)
{
return
MaemoGlobal
::
homeDirOnDevice
(
devConf
.
server
.
uname
);
...
...
src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h
View file @
e6958859
...
...
@@ -86,6 +86,8 @@ private slots:
private:
static
int
gdbServerPort
(
const
MaemoRunConfiguration
*
rc
);
static
int
qmlServerPort
(
const
MaemoRunConfiguration
*
rc
);
static
QString
environment
(
const
MaemoRunConfiguration
*
rc
);
void
stopSsh
();
void
handleAdapterSetupFailed
(
const
QString
&
error
);
...
...
src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp
View file @
e6958859
...
...
@@ -51,6 +51,7 @@
#include
<qt4projectmanager/qt4target.h>
#include
<utils/detailswidget.h>
#include
<QtGui/QCheckBox>
#include
<QtGui/QComboBox>
#include
<QtGui/QFileDialog>
#include
<QtGui/QFormLayout>
...
...
@@ -122,12 +123,18 @@ void MaemoRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout)
m_argsLineEdit
=
new
QLineEdit
(
m_runConfiguration
->
arguments
().
join
(
" "
));
formLayout
->
addRow
(
tr
(
"Arguments:"
),
m_argsLineEdit
);
m_qmlCheckBox
=
new
QCheckBox
(
tr
(
"Also debug QML parts"
));
m_qmlCheckBox
->
setChecked
(
m_runConfiguration
->
useQmlDebugger
());
formLayout
->
addRow
(
new
QLabel
(
tr
(
"Debugging:"
)),
m_qmlCheckBox
);
connect
(
addDevConfLabel
,
SIGNAL
(
linkActivated
(
QString
)),
this
,
SLOT
(
showSettingsDialog
(
QString
)));
connect
(
debuggerConfLabel
,
SIGNAL
(
linkActivated
(
QString
)),
this
,
SLOT
(
showSettingsDialog
(
QString
)));
connect
(
m_argsLineEdit
,
SIGNAL
(
textEdited
(
QString
)),
this
,
SLOT
(
argumentsEdited
(
QString
)));
connect
(
m_qmlCheckBox
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
handleQmlDebuggingChanged
(
bool
)));
connect
(
m_runConfiguration
,
SIGNAL
(
targetInformationChanged
()),
this
,
SLOT
(
updateTargetInformation
()));
connect
(
m_runConfiguration
->
deployStep
()
->
deployables
(),
...
...
@@ -423,6 +430,12 @@ void MaemoRunConfigurationWidget::handleRemoteMountsChanged()
updateMountWarning
();
}
void
MaemoRunConfigurationWidget
::
handleQmlDebuggingChanged
(
bool
debugQml
)
{
m_runConfiguration
->
setUseQmlDebugger
(
debugQml
);
updateMountWarning
();
}
void
MaemoRunConfigurationWidget
::
updateMountWarning
()
{
QString
mountWarning
;
...
...
@@ -436,11 +449,16 @@ void MaemoRunConfigurationWidget::updateMountWarning()
"your device has only %2 free ports.<br>You will not be able "
"to run this configuration."
)
.
arg
(
mountDirCount
).
arg
(
availablePortCount
);
}
else
if
(
mountDirCount
>
0
&&
mountDirCount
==
availablePortCount
)
{
mountWarning
=
tr
(
"WARNING: The directories you want to mount will "
"use all %1 free ports on the device.<br>You will not be able "
"to debug your application with this configuration."
)
.
arg
(
availablePortCount
);
}
else
if
(
mountDirCount
>
0
)
{
const
int
portsLeftByDebuggers
=
availablePortCount
-
1
-
m_runConfiguration
->
useQmlDebugger
();
if
(
mountDirCount
>
portsLeftByDebuggers
)
{
mountWarning
=
tr
(
"WARNING: You want to mount %1 directories, "
"but only %2 ports on the device will be available "
"in debug mode. <br>You will not be able to debug your "
"application with this configuration."
).
arg
(
mountDirCount
).
arg
(
portsLeftByDebuggers
);
}
}
}
if
(
mountWarning
.
isEmpty
())
{
...
...
src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h
View file @
e6958859
...
...
@@ -38,6 +38,7 @@
#include
<QtGui/QWidget>
QT_BEGIN_NAMESPACE
class
QCheckBox
;
class
QComboBox
;
class
QLabel
;
class
QLineEdit
;
...
...
@@ -87,6 +88,7 @@ private slots:
void
systemEnvironmentChanged
();
void
userEnvironmentChangesChanged
(
const
QList
<
ProjectExplorer
::
EnvironmentItem
>
&
userChanges
);
void
handleRemoteMountsChanged
();
void
handleQmlDebuggingChanged
(
bool
debugQml
);
void
handleDeploySpecsChanged
();
void
handleBuildConfigChanged
();
void
handleToolchainChanged
();
...
...
@@ -102,6 +104,7 @@ private:
QLabel
*
m_localExecutableLabel
;
QLabel
*
m_remoteExecutableLabel
;
QLabel
*
m_devConfLabel
;
QCheckBox
*
m_qmlCheckBox
;
QLabel
*
m_mountWarningLabel
;
QTableView
*
m_mountView
;
QToolButton
*
m_removeMountButton
;
...
...
src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.cpp
View file @
e6958859
...
...
@@ -169,7 +169,7 @@ bool MaemoRunControlFactory::canRun(RunConfiguration *runConfiguration,
const
int
mountDirCount
=
maemoRunConfig
->
remoteMounts
()
->
validMountSpecificationCount
();
if
(
mode
==
ProjectExplorer
::
Constants
::
DEBUGMODE
)
return
freePortCount
>
mountDirCount
;
return
freePortCount
>
mountDirCount
+
runConfiguration
->
useQmlDebugger
()
;
if
(
mode
==
ProjectExplorer
::
Constants
::
RUNMODE
)
return
freePortCount
>=
mountDirCount
;
return
false
;
...
...
src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp
View file @
e6958859
...
...
@@ -191,8 +191,12 @@ void MaemoSshRunner::handleUnmounted()
return
;
m_mounter
->
resetMountSpecifications
();
MaemoPortList
portList
=
m_devConfig
.
freePorts
();
if
(
m_debugging
&&
!
m_runConfig
->
useRemoteGdb
())
portList
.
getNext
();
// One has already been used for gdbserver.
if
(
m_debugging
)
{
// gdbserver and QML inspector need one port each.
if
(
!
m_runConfig
->
useRemoteGdb
())
portList
.
getNext
();
if
(
m_runConfig
->
useQmlDebugger
())
portList
.
getNext
();
}
m_mounter
->
setToolchain
(
m_runConfig
->
toolchain
());
m_mounter
->
setPortList
(
portList
);
const
MaemoRemoteMountsModel
*
const
remoteMounts
...
...
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