Debugging QNX applications using Qt Creator

According to Wikipedia QNX is: "QNX is a commercial Unix-like real-time operating system, aimed primarily at the embedded systems market".

One could get an evaluation copy of QNX 6.5.0SP1 and have a virtual machine running the x86 version of QNX 6.5.0SP1. QNX comes with an Eclipse based IDE, which is nice and all but I'm interested in QtCreator :)

Ed Langley has a very nice blog entry named - Setting up a QNX image for use with Qt Creator.

Qt Creator needs SSH communication with the QNX target, in my case a virtual machine. Ed Langley's blog entry has details on how to get this up and running.

I've created a "hello world" C++ project. In order to have Qt Creator deploy this hello world application one needs to add the following lines to the pro file:

target.path = /home/sam/qnx_test
INSTALLS += target 

Debugging the application using Qt Creator 3.0.1 looked like this:

Debugging works out of the box, unfortunately the STL types are not displayed very "pretty".

QNX 6.5.0SP1 comes with "GNU gdb 6.8 qnx-nto (rev. 506)" which is copyrighted "(C) 2008 Free Software Foundation, Inc.", which is a bit dated.

Fortunately QNX has an updated version of GDB "gdb-7.5-r791". Upgrading gdb was just a matter of unpacking gdb-prereq-linux.tgz and linux-gdb-7.5-r791.tar.gz. Now GDB version is "GNU gdb (GDB) 7.5 qnx (rev. 791)" which is copyrighted "(C) 2012 Free Software Foundation, Inc.".

Unfortunately Qt Creator 3.0.1 was not able to use the debugger. In Qt Creator's "Debugger Log" I was able to find out why:

&"    import binascii\n"
&"ImportError: No module named binascii\n"
&"Error while executing Python code.\n"

Python from the "gdb-prereq-linux.tgz" file, which ended up being installed here /opt/qnx650/host/linux/x86/usr/python27/, was incomplete. Binascii module should have been available, but was not.

So I decided to compile my own version of "Python 2.7.2". This was a bit tricky because Qt Creator needs a 32bit version of Python and my Linux installation was 64bit. I've set up a schroot environment for a 32bit version of my Linux distribution and done a ./configure, make, make install build of Python 2.7.2.

I've uploaded my Python 2.7.2 build here, "installation" should be done like:

# tar xJf python-2.7.2.tar.xz  -C /opt/qnx650

After upgrading GDB and Python Qt Creator 3.0.1 debugging looked like this:

As we can see it's not necessarily better. The STL types are not just not "pretty", this time are not accessible. One could say that's even worse.

Upgrading Qt Creator to the upcoming 3.1 release improved things a bit:

As you can see std::vector was displayed correctly. I don't know why "value" was presented as . The "Debugger Log" didn't show up any errors.

Digia announced on 25th of February 2014 the debut of "Qt 5 support for latest release of QNX operating system", which means that Qt Creator 3.1 and future versions would support QNX 6.6!

I hope you will give Qt Creator a try when developing QNX applications!

No comments: