[Interest] QML Debug API

Ulf Hermann ulf.hermann at qt.io
Fri Nov 9 09:07:46 CET 2018


Hi Nils,

> I have read that QML offers a binary debug protocol that is used by 
> several tools to to gain insights into QML applications. I read about 
> this interface here: http://doc.qt.io/qt-5/qtquick-debugging.html
> It is stated that: "The Qt QML module provides services for debugging, 
> inspecting, and profiling applications via a TCP port."

In fact you can also use a local socket or (with restrictions) the 
native debugger as connection mechanism.

> I'm planning to build my own tool on top of that API. I searched around 
> for the description and details about this protocol for a while but 
> couldn't find much beside the qtdeclarative git repository which seems 
> to contain the implementation.
> 
> Do I have to reverese engeneer the API from the source code or is there 
> some form of documentation that I wasn't able to find?

There is private API for interacting with the various debug services. 
Take a look at src/qmldebug in qtdeclarative. The code results in a 
static library called QtQmlDebug. You can either link against that (with 
the usual caveats of using private API), or you can use the code to 
figure out how the protocol works.

There is QQmlDebugConnection to establish a connection to the target 
application, QV4DebugClient for JavaScript debugging, 
QQmlEngineDebugClient and QQmlInspectorClient for QML debugging, 
QQmlProfilerClient for profiling, QQmlEngineControlClient for 
synchronizing the profiler in case of multiple QML engines, and 
QQmlDebugMessageClient to receive debug messages through the connection. 
I'm thinking about adding QQmlDebugProcess to QtQmlDebug, so that you 
get an easy way to start a process and directly connect to it. That 
class so far is in tests/auto/qml/debugger/shared in qtdeclarative.

If there is demand for this, I would consider making it public. It 
probably needs some more cleanup, but generally the client interfaces 
look good.

Ulf


More information about the Interest mailing list