Commit Graph

61 Commits

Author SHA1 Message Date
Ulf Hermann e061150cc5 Remove pimpl from all classes derived from QQmlDebugService
There is no point in using pimpl for purely internal classes,
especially when we move them to their own plugins.

Change-Id: I2ee8bf2ded2242d91bab89f589a131dc3bcc9a55
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-31 11:31:09 +00:00
Ulf Hermann cc3a57861d Use signal/slot for passing messages through QQmlDebugServer
This results in much cleaner code than the previous implementation
using QMetaObject::invokeMethod().

We have to use read locks now for adding and removing engines, as we
should have done already before. If a condition is waiting on a write
lock you cannot acquire a read lock from another thread. So, if we kept
the write locks we wouldn't be able to receive messages while the engines
are waiting.

Change-Id: Icfe641601dec2f8d7181ae579146ed603d57a4c2
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-31 06:44:13 +00:00
Ulf Hermann 4d07a6254c Simplify thread synchronization in QQmlDebugServer
m_clientPlugins will only be accessed from the server thread, so it
doesn't need to be protected by a mutex. m_plugins will only be
modified before the server thread starts and after it ends. During the
runtime of the thread it is constant and thus doesn't need to be
protected, either.

Engines are supposed to be added and removed after any waiting for
connections and hello messages is done, so we can reuse the hello mutex
for synchronization there.

Change-Id: I09037430804c264a5f784c4b5a85668d87851b12
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-31 06:44:09 +00:00
Ulf Hermann 99141dd5fc Remove QQmlDebugServer::advertisePlugins()
As all services have to register before the server starts and cannot
unregister until after the thread is stopped, we don't need any
additional service advertisement anymore.

Change-Id: I20977560b4f7a3acb08a6cc703916bebf61d0220
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-31 06:44:06 +00:00
Ulf Hermann 6557b71188 Make QQmlDebugService::registerService() private and part of ctor
By forcing all debug services to register before the thread starts we
can get rid of the complicated thread synchronization and have a more
natural API for the services.

We can also better enforce the thread situation when registering
services in QQmlDebugServer now. QQmlProfilerService should not
moveToThread() in its constructor as the thread has not been started,
yet. The thread affinity of QQmlProfilerService doesn't make any
difference anyway, as all relevant methods are protected by mutexes
and it doesn't have any slots.

Change-Id: I57db9e2bf94ec6884ede694715dadf5bfd687334
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-30 14:55:19 +00:00
Ulf Hermann 52e782bdc5 Make sure QQmlDebugServer does not deadlock in blocking mode
Previously, the server could wake the helloCondition before the main
thread was waiting on it. This would lead to the main thread then
waiting forever once it hit the wait() statement.

Change-Id: I694d65f72cf6be6e4c5a0c65ea4aea8a5878bf5b
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-30 09:08:59 +00:00
Ulf Hermann 38b14d6646 Move debugger initialization out of QQmlDebugServer and QQmlEngine
QQmlDebugConnector has to check the parameters before deciding if (and
what kind of) instance to create. It also has to add the services
itself as we don't want to tie a specific implementation of
QQmlDebugConnector to a specific set of services. Logic to load the
services from plugins will be added in a separate change. Integrating
the service initialization with the connector initialization enables us
to load the services before the server thread startsi, which will
simplify the thread synchronization.

QQmlConfigurableDebugService has to recheck for blockingMode once it
gets enabled as it cannot rely on being enabled right away anymore. It
should have done that already before as it's possible to disable and
re-enable services.

Change-Id: I9d161d78836bae10d688a90b4c2a32efed320412
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-30 09:08:55 +00:00
Ulf Hermann 7d8e29534d Extract minimal interface from QQmlDebugServer and use it.
This will allow us to move QQmlDebugServer into a plugin. The new QQmlDebugServer
is the interface exposed to connection plugins. The interface exposed to services
is renamed to QQmlDebugConnector, as technically it doesn't have to be a
"server".

Change-Id: Id508b8c0a6960228e889f45a437b73060392db39
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-30 09:08:49 +00:00
Ulf Hermann ad633f595d Don't exposes QQmlDebugServer's list of services.
The only thing we ever want to do is look up a service by name.

Change-Id: I45007d3c742201ccc0871379a91b37381f6d1760
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-29 14:36:03 +00:00
Ulf Hermann 6d019b08cd Make QQmlDebugService's state and engine callbacks public
It's clear that the public API of QQmlDebugService is meant to be used
by QQmlDebugServer or future replacements. Restricting access with
"friend" requires listing all those possible replacements.

Change-Id: I197f1fa53cf985f52cfe5e077a95eda1ed5214b4
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-29 14:36:00 +00:00
Ulf Hermann c866ba8e3a Remove some methods from QQmlDebugServer
They were only used internally or for redundant checks in the tests.

Change-Id: Iaa7d52be030adaa52a07b28fba53bdef9fada879
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-29 14:35:56 +00:00
Ulf Hermann 3f3de3b9b7 Don't wait for debug services if none are active
Change-Id: I30f0ea1d34c9cb8d66f9dfd1e381ecc6ae8ccc61
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-29 14:35:50 +00:00
Ulf Hermann 235823de35 Fix broken Q_UNUSED declarations in QQmlDebugServer
Change-Id: I0f2cf0a09dfbfb1c2db79b3b5e0c35da546e5c31
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-23 08:26:11 +00:00
Ulf Hermann 8b7b855544 Move data stream version into QQmlDebugStream
When moving the server into a plugin we won't be able to directly
access it anymore.

Change-Id: Iea0bac187cfa5cda69a0852b36d61f535e12d6c6
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-22 16:54:00 +00:00
Ulf Hermann 33f6e267ad Use QQmlDebuggingEnabler::StartMode in connectToLocalDebugger
This unifies the API and gets rid of an ambiguous bool parameter.

Change-Id: If9d8906f9cd366cf37bd1bdded7fbd6c62146e32
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-02 08:23:28 +00:00
Liang Qi 5112821a37 Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
	.qmake.conf
	src/qml/qml/qqmlengine.cpp
	src/quick/items/qquickitemsmodule.cpp
	tools/qml/main.cpp

Change-Id: Ida8daf6b4d7e675385f2f5514c446e52dedaf136
2015-06-30 09:08:35 +02:00
Ulf Hermann f23d4fafbf Add option to use a local socket for QML debugging
Using a TCP debug server comes with a number of drawbacks. It has a
larger overhead than other connection types, the application has to
be able to access the network and there has to be an open port we can
find somehow.

Change-Id: Ia7fb24006b89419988c6504797303d84c3aa1bbc
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-06-26 14:13:46 +00:00
Ulf Hermann 77fa80f1ed Disable plugin loading in QQmlDebugServer if QT_NO_LIBRARY
Change-Id: I29682fc069cb457abeca90a1e1f7f7c964ed1607
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-06-26 08:22:44 +00:00
Sérgio Martins 52d91eeea4 Add 28 QList::reserve() calls
Change-Id: Id4820ac458f48b10f2bf457144767efdef9e2c07
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2015-06-08 11:35:42 +00:00
Sérgio Martins a8d532eb1d Fix build with QT_STRICT_ITERATORS
Change-Id: I3df6ac107cb46b3a1b15b80f39d7c6015adcd9ac
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-05-15 19:45:46 +00:00
Friedemann Kleint 5163c11952 QtQml: Micro-optimize iterator loops.
Avoid repeated instantiation of end() in loops, use variable instead.

Change-Id: I3bb1c6918cfd16a5dcefbcc03c442e99fe9bf76b
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-02-26 15:13:34 +00:00
Jani Heikkinen c5796292ad Update copyright headers
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.

Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9
Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
2015-02-12 10:28:11 +00:00
Pasi Petäjäjärvi c5b575bdc2 Rename QML debug macro to Qt naming style
With this change the macro is in line with QT_NO_<feature> style
of naming macros. This way it will also be automatically added to
the file mkspecs/qmodule.pri in QT_NO_DEFINES value.

Change-Id: I96041438ef68bbcbc4e66301b0f5fe1212129c1a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
2015-01-12 19:19:46 +01:00
Ulf Hermann 63d9693655 Disallow QQmlDebugServer::enable for QT_QML_NO_DEBUGGER
This mirrors the behavior of the QQmlDebugServer constructor.
Unfortunately we have two #defines to disable the debug server,
QT_QML_NO_DEBUGGER and QQML_NO_DEBUG_PROTOCOL. We should honor both of
them as people might rely on either of them to effectively prevent the
debug server from working.

Change-Id: I0bc0d48632eaa05c471d0afed6fc48436116746a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-12 11:38:27 +01:00
Shawn Rutledge 1bd42483b4 fix the build with -no-qml-debug
The "cleanup" variable doesn't exist in this case.

Change-Id: Ia7ed654d5c9ae57bc3f7cff39acbd72214ff4188
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
2014-12-13 14:18:19 +01:00
Simon Hausmann ff466a1881 Merge remote-tracking branch 'origin/5.4' into dev
Conflicts:
	src/qml/jsruntime/qv4arraydata.cpp
	src/qml/jsruntime/qv4context_p.h
	src/qml/jsruntime/qv4globalobject.cpp
	src/qml/jsruntime/qv4internalclass.cpp
	src/quick/items/qquicktext_p.h
	src/quick/items/qquicktextedit_p.h
	src/quick/items/qquicktextinput_p.h

Change-Id: If07e483e03197cb997ef47a9c647a479cdb09f4c
2014-12-09 15:09:26 +01:00
Ulf Hermann 5375c095c3 QmlDebug: Provide public method for starting a debug server
With QQmlDebuggingEnabler::startTcpDebugServer you can create a debug
server for debugging or profiling also without the qmljsdebugger
command line argument.

Change-Id: I642f73680585f9c7578762bcc0b247c736fe1338
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-05 12:26:46 +01:00
Ulf Hermann 5280e866f7 Mark cleanup function as unused if compiled with QT_QML_NO_DEBUGGER
The static cleanup function in qqmldebugserver.cpp is only used if the
debug server is actually created. If not we can mark it as unused to
avoid compile warnings. Enclosing it in #ifdef would be uglier.

Task-number: QTBUG-42394
Change-Id: Ieb7fa38ecb346e80ce815ced85eb3a168bad9d99
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-11-05 15:58:03 +01:00
Jani Heikkinen e7ceacda70 Update license headers and add new licenses
- Renamed LICENSE.LGPL to LICENSE.LGPLv21
- Added LICENSE.LGPLv3 & LICENSE.GPLv2
- Removed LICENSE.GPL

Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0
Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
2014-08-25 11:28:46 +02:00
Ulf Hermann cabc944f0e Remove V8 profiler service
It's broken and useless and it sends confusing data to the profiler
client.

Task-number: QTCREATORBUG-12188
Change-Id: I944cf19a78ee4378d5773e7aa80876f199a0f03b
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2014-05-09 13:20:46 +02:00
Thomas McGuire 0e0528df68 Give the QML and the debug server thread an objectname.
Now it is easier to identify the threads in e.g. the debugger in
QtCreator.

Change-Id: I032822e869df09cf43dc1d6e01d14610005ce217
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>
2014-04-01 14:18:53 +02:00
Fawzi Mohamed 90f497ae13 qmldebugger: handle static builds correctly
The loading of the qml debugger was hardcoded to dynamically load its
plugins.
Now directly build and instantiate the QQmlDebugServerConnection in
static builds.

Done-with: Kai Koehne <kai.koehne@digia.com>
Change-Id: I38bf0e310caaa6aaa743e3814b0108c6fe7001df
Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2014-03-11 18:31:21 +01:00
Ulf Hermann 4cc230ade4 Unify initial waiting of debug services
The debug services generally behave in one of two ways when initializing:
Either they block the initializing thread until some configuration is
passed over the network or they just go on. By introducing a generalized
configurable debug service the various ways of waiting on initialization
are cleaned up. The API defined for it also allows for engine-specific
initialization.

Change-Id: Id5685ef17d2a7eb1222629f7caa5ec53076d47b2
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2014-02-10 14:28:17 +01:00
Ulf Hermann 85bab8c8db Protect list of client plugins from concurrent access
Previously the list of client plugins in the QQmlDebugServer could be
accessed concurrently from receiveMessage() and addService() either
when in non-blocking mode, or if the client uses service discovery or
sends additional hello messages after the first one.

Change-Id: I946243957184210d40ebca728143714c341b1226
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2014-02-07 10:49:32 +01:00
Ulf Hermann 9ca736fd3f Unify the interface for QQmlDebugServices
Let the debug server handle adding and removing of engines through
defined interfaces to prepare for multi-engine profiling and debugging.

Change-Id: I7b277e54bdcce1d3e95e723f041a7db6b08b29fc
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2014-02-05 18:42:36 +01:00
Ulf Hermann 539d5376bb Make the QML debug server thread safe
Previously, if instance() was accessed concurrently we could run into
various problems as the initialization wasn't synchronized. By putting
most of the initialization into the constructor, wrapping it into a
Q_GLOBAL_STATIC and discerning between accesses that need to wait for
the initial "hello" packet and ones that don't the situation is
improved.

Change-Id: I182e8e6abf054b851ef7ea5f897d4a197a9da4bf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-01-30 14:17:46 +01:00
Ulf Hermann 13683d4ebc Allow debug plugin registrations from other threads than main GUI
There's no real reason to disallow that. The only thing we want to check
there is that the registration doesn't take place in the debugger
thread. Disallowing registrations from anywhere but the main GUI thread
creates unnecessary problems with threaded QML profiling and debugging.

Change-Id: Ic72d19237e2ddba02cc88f7f5a0743f6640fed4d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-01-29 18:30:34 +01:00
Erik Verbruggen 0910a577f4 Debugging with V4
Currently missing, but coming in subsequent patches:
- evaluating expressions
- evaluating breakpoint conditions

Change-Id: Ib43f2a3aaa252741ea7ce857a274480feb8741aa
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-11-10 11:01:35 +01:00
Kai Koehne ff28e3519d Fix deadlocks in debugger infrastructure on Mac
Set QReadWriteLocker to recursive. This is needed e.g. to allow
_q_changeServiceState to get a read lock when called from inside
receiveMessage.

Change-Id: I287a7c7f44e94005c0458825f8f6d1877ee914dd
Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
2013-10-16 08:33:18 +02:00
Kai Koehne 2653e79f18 Debugger: Make sure client list is protected by mutex
So far we didn't protect this access.

Change-Id: Id738453db5e655371fa2fbf88f81cab6c0af466f
Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
2013-05-24 15:04:26 +02:00
Kai Koehne a028d46350 Debugger: fix race condition in block mode
Make sure that the GUI thread & debugger thread actually sync on startup. So far
the GUI thread would block forever in waitCondition.wait() if the debugger thread
spawns & receives the HELLO before.

Also remove unused code and rename variables to make their use more obvious.

Change-Id: I8285e8860667496d491807e696535353d9f14dea
Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
2013-04-23 15:40:31 +02:00
Aurindam Jana 55b850e68d QmlDebugServer: Ensure plugin is set
Change-Id: Ibc0e5ed626edc076e96c4848994ba0cafba0f5c6
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2013-04-16 09:16:48 +02:00
Aurindam Jana f15595901b Debugger: Accepts port range as arguments
Allow a port range to pass on command line, and try to listen on any of the
ports in the range. (Re)using the ',' separator allows for backwards compatibility,
that is, also Qt 4 will accept a -qmljsdebugger=port:1000,1010 argument, but
will only try to listen on port 1000.

Change-Id: Ic03fe20e4aee9ecdea86651f46f1df5cb19bd75c
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2013-04-02 13:26:03 +02:00
Sergio Ahumada 83deab8d1b Update copyright year in Digia's license headers
Change-Id: I6c3bd7bebe3d62d1cfd0fa6334544c9db8398c76
Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2013-01-10 19:52:37 +01:00
Iikka Eklund 46010aa7a2 Change copyrights from Nokia to Digia
Change copyrights and license headers from Nokia to Digia

Change-Id: Ie7f5d49ed8235d7a7845ab68f99ad1c220e64d5c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-09-23 08:22:24 +02:00
Friedemann Kleint fd5c099eea QtQuick: Fix string related warnings, single character strings.
- Fix warnings about truncation from size_t to int (MSVC 2010,
  64bit).
- Remove single character strings.

Change-Id: Iaf4406e4e04d55d2d8b762f3433269868842a6f9
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-05-14 13:57:37 +02:00
Aurindam Jana 7f7cd79e29 QmlDebugging: Exchange supported QDataStream versions
Since the client and service needs to pack/unpack
datastreams, they need to encode/decode using the lowest common
QDataStream version.

Change-Id: I3b4886fece59b24950ba618da07a0fefd41a5637
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
2012-04-26 11:46:06 +02:00
Kai Koehne 0d284ae2d6 Debugger: Fix race conditions in block mode
Using waitForMessage() in the constructor after registerService() is
_not_ safe: You might get the first message already after the
registerService() and before the waitForMessage() call. Instead,
use QMutex/QWaitCondition to block the initialization. Also make
the use of the block mode explicit, since the service might already
be enabled also for non-blocking modes ...

Change-Id: I387bfe0627c80e2029acff71f86d12cd9ab58de1
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
2012-04-25 14:26:42 +02:00
Kai Koehne a5d4efbc00 Debugger: Fix race condition in block mode, QQmlDebugServer
Make sure that the first message hasn't already arrived before
we call d->messageArrivedCondition.wait().

Change-Id: I0d3df9adbd41f71df5c1c7d6df90c0037f494514
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
2012-04-25 11:46:05 +02:00
Kai Koehne 9b1299e0db Debugger: Fix RAII usage of ReadWriteLocker
Variables without a name are free to be deleted even before the
scope ends.

Change-Id: I07fb6f98cd5b36876db5de2e1b4e8ce355f74415
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
2012-04-24 17:31:24 +02:00