Remember the times when the QtScript debugger was nothing but a maverick project on Trolltech Labs, and you could run the debugger as a stand-alone application? When the debugger was finally integrated into Qt for the 4.5 release, that feature had mysteriously disappeared. Well, today I'm happy to tell you it's been resurrected -- not as part of Qt (yet, at least; that depends on the interest), but right here on the Labs. It needs to be compiled against the latest and greatest qt/master sources, and getting it to link can be quirky (it needs some symbols that aren't exported from Qt by default -- see the project page for details)... Let me know how you get on.
The debugger application embeds a QScriptRemoteTargetDebugger object.
The debugger emits an attached() signal when it's attached to the target, or an error() signal if it fails to connect. Other than that, the API mirrors that of QScriptEngineDebugger; by default, the standard debugger window is shown when the target's script evaluation is suspended, but you also have access to the individual debugger widgets and actions if you want to create a custom configuration. A "reference implementation" of a debugger can be found in the examples/debugger directory.
So how does your application's script engine become a target that can hook up with a remote debugger? By adding lines like these:
The listen() function tells the debugger engine to wait for the debugger (UI) to initiate the connection; you can do it the other way around (have the debugger wait for the target to connect) by calling listen() on the debugger side and connectToDebugger() on the target side. The debugger engine emits a connected() signal when a connection has been established, or an error() signal if there's a problem.
Once you're connected, your application can start evaluating scripts as usual; the debugger engine will suspend evaluation and communicate with the debugger as necessary. There's an example application in the examples/debuggee directory that demonstrates this. To try it, first start examples/debuggee, then start examples/debugger.
The current implementation uses QDataStream with the debugger's own internal types to transport data from one end to the other; I'd like to also add support for protocols like those of GDB and Xdebug, so that other debugging tools could be used. It would be fun to see if Qt Creator's existing GDB integration can be utilized for QtScript debugging too. :-) Anyways, happy remote debugging! Comments and suggestions concerning API, functionality and protocols are welcome.
Download the latest release here: www.qt.io/download.
Qt 5.12 was developed with a strong focus on quality and is a long-term-supported (LTS) release that will be supported for 3 years.
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.
Näytä tämä julkaisu Instagramissa.
Want to build something for tomorrow, join #QtPeople today! We have loads of cool jobs you don’t want to miss! http://qt.io/careers #builtwithQt #software #developers #coding #framework #tool #tooling #C++ #QML #engineers #sales #tech #technology #UI #UX #CX #Qt #Qtdev #global #openpositions #careers #job
Henkilön Qt (@theqtcompany) jakama julkaisu