unity-dev team mailing list archive
-
unity-dev team
-
Mailing list archive
-
Message #00122
[Ayatana-dev] Debugging Unity-2d QML
I've been trying to fix a crash in the unity-2d-spread process that occurs when
I launch a new app, and use the 'Move to Another Workspace' menu option. I've
reported it as bug #753269.
I attached to the process with gdb to get a backtrace, and that told where the
crash was occuring in C++ terms. However, I get the feeling it is crashing
because of something in the QML side and I'm not sure how to go about
debugging that. Because I see std::terminate() in the crash, rather than a seg
fault, my best guess is that the JavaScript runtime has thrown some sort of
exception.
Thread 1 (Thread 0xb780a890 (LWP 5801)):
#0 0x004fb416 in __kernel_vsyscall ()
#1 0x0150fe71 in raise () from /lib/i386-linux-gnu/libc.so.6
#2 0x0151334e in abort () from /lib/i386-linux-gnu/libc.so.6
#3 0x083840b5 in __gnu_cxx::__verbose_terminate_handler() ()
from /usr/lib/i386-linux-gnu/libstdc++.so.6
#4 0x08381fa5 in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#5 0x08381fe2 in std::terminate() ()
from /usr/lib/i386-linux-gnu/libstdc++.so.6
#6 0x083821ab in __cxa_rethrow () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#7 0x00940920 in QMetaObject::activate(QObject*, QMetaObject const*, int,
void**) () from /usr/lib/libQtCore.so.4
#8 0x02ee1506 in WindowInfo::workspaceChanged (this=0x90a1e90, _t1=1)
Maybe there is a way that other people are using to debug QML issues like
this, that I haven't managed to find out about. Before I go ahead much further,
I thought I'd better summarize what I've tried so far.
I'm using Qt Creator as an IDE as it appears to have better QML support than
KDevelop. The first problem is that Qt Creator doesn't show the QML files, as it
can't work out from the cmake definitions what they are. For example, the
unity-2d-spread QML files are defined like this:
file(GLOB spread_QML *.qml *.js)
# Install
install(FILES ${spread_QML}
DESTINATION ${UNITY_2D_DIR}/spread
)
Maybe if they were listed as individual files, instead of the GLOB statement it
would work. Another solution might be to just write a parallel set of qmake
.pro files which could be just used to get Qt Creator to parse the project, and
not for actually building it.
Qt Creator has a QML debugger, and it took me some time to get it working
under Natty. It turns out that a plugin called 'qmltooling/tcpserver' was
missing from the qt4-dev package (I've reported that as a packaging bug).
Without the plugin, Qt Creator just gives an error message 'Remote debugger
plugin has not been found'.
Once the QML debugging is working, you can link you application against a
small debugging library by ticking the 'Link QML debugging library' option in
the build settings. When the application is started with a '-
qmljsdebugger=port:3768' command line option, it listens on port 3768 for
debugging commands sent from Qt Creator via the qmltooling/tcpserver plugin. I
was hoping that it would be possible to get the Qt Creator QML debugger to
attach to an already running process like the unity-2d-spread process, in a
similar way to gdb attaching to a process. It turns out that there isn't an
option to do that. So my current plan is to attempt to hack the Qt Creator
code to add that feature. My worry is that, even after doing that, I still
wouldn't find out what was causing bug #753269. But I can't think of a better
plan of attack - does anyone have any suggestions?
-- Richard
Follow ups