Variable issue while Remote Debugging on verdin-imx8mp

Hi,

I am trying to remote debug a Qt C++ application using vscode Torizon IDE Extension 2.4.2., Torizon OS 6.5.0-build.8 on verdin-imx8mp
What happens is that the execution stops on breakpoint and then if I try to examine the variables I only see values such as this:

 serialPort: 0xffff6c004a60

In this case serialPort is a pointer to QSerialPort.
My observation is if it is a simple type, such as int, float etc. the value of the variable will be displayed correctly. However, for complex types, such as QSerialPort or any of the Qt classes only an address (I guess it is an address) or something like this will be shown:

d: 0xffff8bb563d8 <QArrayData::shared_null>
QArrayData (base): QArrayData...

Not sure if this has something to do with gdb pretty printing, but maybe someone encountered this already.

Greetings @direttore,

I believe I know what’s happening here. Qt data structures/objects/variables don’t display nice values by default with GDB. Even on the Qt Creator IDE they have to make use of debugging helpers and such: Using Debugging Helpers | Qt Creator Manual

In our templates we already have pretty printing enabled by default. We also have a Qt pretty printer helper script in our template for the C++ QML project: vscode-torizon-templates/cppQML/.conf/qtpp/qt.py at dev · toradex/vscode-torizon-templates · GitHub

Though it seems this doesn’t handle every Qt data structure as observed by you. Could you share what Qt data structures are not showing nice values. Then I can share this with our Extensions team and see if we can improve this.

In your post you already mentioned QSerialPort and QArrayData. Did you notice anything else?

Best Regards,
Jeremias

As I am working with Qt5 I had to add the files from the template manually and now it is working as expected, at least for the classes that are listed in qt.py.

Here are a few more that are not included:

QNetworkInterface,
QNetworkAddressEntry,
QHostAddress

and there are surely many more.

Nevertheless, this is a big step forward.

Thanks!

As I am working with Qt5 I had to add the files from the template manually and now it is working as expected, at least for the classes that are listed in qt.py.

Oh you’re using Qt5? What template are you using for your project? We have our C++ Qt 6 QML template but this is Qt6 by default. Did you modify this template for Qt5?

Here are a few more that are not included:

I see, these probably require additional/new helpers, if possible. Are these vital for you, or do you have enough now to progress with your development?

Best Regards,
Jeremias

Not sure about which template I used as I migrated our software some time ago. I think there was a Qt5 C++ template there earlier or maybe I used some of the CMake templates.
To get the debugging working at all I had to use the parts of the template you mentioned.

The classes listed are only an example. Would be nice to have, however I am aware that there is probably a hundred more.

I’ll start from what I have now and see how it works.

Thanks for the support!

I see, yeah you must be working off something older since as you saw our current Qt CMake template has these debugging helpers by default. Well let us know if we can improve these Qt debugging helpers in anyway and I can bring this up with the team and see what we can do.

Glad to have been of some help!

Best Regards,
Jeremias