Is it possible to debug QScriptEngine in non-GUI thread?



  • I've only seen QScriptEngineDebugger with a nice feature set, but it appears that it can only work in GUI-thread and same thread as QScriptEnginge, so it has to be in GUI thread too. The problem is: in the app I'm trying to introduce debugger to there is absolutely no way to run QScriptEngine in the GUI thread. But I really want to have ability to at least set breakpoints and maybe to have step-by-step execution.
    According to this, however,
    https://bugreports.qt.io/browse/QTBUG-15839
    it is not certain whether there is actually no way to make debugger work with engine from non-GUI thread. But the test he mentioned only tests very simple stuff that doesn't require any interaction (and creation) of GUI elements. It's almost the only thing you can do without using GUI - checking whether script is running or not. But you can do this with plain script engine too.

    If in my app I try to attach debugger to engine in the non-GUI thread and then ask for mainwindow/some action I get
    QObject: Cannot create children for a parent that is in a different thread.
    spammed in the debug console and the program fails.

    So my question is - are there any workarounds/3rd party solution or something else, that'd allow me to add some debugging capabilities to the QScriptEngine? Because the engine itself lacks any convenient API to, for example, pause execution at certain line and resume it later.

    P.S. I know that QScriptEngine was deprecated, but this can't be helped at the moment.



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.