Debugging GC in Visual Studio Code. hint to watch Qt objects?

274 views
Skip to first unread message

Peret

unread,
Nov 12, 2021, 1:53:03 PM11/12/21
to golden-cheetah-developers
Hello,

When debugging Golden Cheetah, using Visual Studio Code on Ubuntu, I get stuck in a high percentage of tries, due to GC is based on Qt framework. Unless the piece of code I am interested in is a formula, or some code independent of Qt, I cannot usually progress.

Qt objects implementation is complex, and the debugger cannot show their inner properties in an easy way (neither in a complex way, I am afraid).
So, something as easy as checking the underlying string  in a QString object, for example, becomes a impossible task (at least form me).

VSCode is a very powerful and versatile code editor and is able to assist in the capability to watch complex objects in the debugger: it understands natvis files (a kind of dictionary to map complex data to some human readable, when debugging).
After researching a bit looking fo natvis files for Qt objects (KDAB and the Qt site, and then other examples in other forums), I have not been able to get a good configuration.

This screenshot shows the best I have got from a QString object (variable 'QString name'):

Screenshot.png


In the endd, I cannot see the text inside the variable at all.

I wonder whether this is the usual way people that are developing GC debug the code. To me, it sounds very difficult, perhaps because I do not know the code and needs more data to understand the execution.

Or maybe I should not use VSCode and should another IDE.

I have discarded any option that implies recompiling the code: adding lines of code to print data, for example, due to the complexity of the project, it takes a tme to compli, then I need to transfer source code and binary to a computer where I can execute,....

It is just to have a bit understandig about how GC experts debug, if I can fetch some idea that helps.

Thanks anyway for reading this.



Ale Martinez

unread,
Nov 14, 2021, 7:27:32 AM11/14/21
to golden-cheetah-developers
El viernes, 12 de noviembre de 2021 a la(s) 15:53:03 UTC-3, Peret escribió:
Hello,

When debugging Golden Cheetah, using Visual Studio Code on Ubuntu, I get stuck in a high percentage of tries, due to GC is based on Qt framework. Unless the piece of code I am interested in is a formula, or some code independent of Qt, I cannot usually progress.

Qt objects implementation is complex, and the debugger cannot show their inner properties in an easy way (neither in a complex way, I am afraid).
So, something as easy as checking the underlying string  in a QString object, for example, becomes a impossible task (at least form me).

VSCode is a very powerful and versatile code editor and is able to assist in the capability to watch complex objects in the debugger: it understands natvis files (a kind of dictionary to map complex data to some human readable, when debugging).
After researching a bit looking fo natvis files for Qt objects (KDAB and the Qt site, and then other examples in other forums), I have not been able to get a good configuration.

This screenshot shows the best I have got from a QString object (variable 'QString name'):

Screenshot.png


In the endd, I cannot see the text inside the variable at all.

I wonder whether this is the usual way people that are developing GC debug the code. To me, it sounds very difficult, perhaps because I do not know the code and needs more data to understand the execution.

Or maybe I should not use VSCode and should another IDE.

QtCreator, included in Qt distribution is likely easier for GC, the wiki entry is outdated but it should be easy to adapt combined with the install document: https://github.com/GoldenCheetah/GoldenCheetah/wiki/Dev-Howto---Ubuntu-17.10-and-QtCreator-%28debug-mode%29-setup
 
I have discarded any option that implies recompiling the code: adding lines of code to print data, for example, due to the complexity of the project, it takes a tme to compli, then I need to transfer source code and binary to a computer where I can execute,....

I am wondering why you can’t run the binary in the same machine like the debugger does  

Peret

unread,
Nov 15, 2021, 5:32:11 AM11/15/21
to golden-cheetah-developers
Thanks, Ale, that was the information I did not have (although there is a very clear entry in the wiki... sometimes we spend time with complex searches and do not see what is in front of our noses): QtCreator as IDE, I have never used it but I will give it a try.

I am wondering why you can’t run the binary in the same machine like the debugger does  

It is not required by the project, of course. It is due to my development environment: I have installed my Ubuntu 18.04 in Oracle Cloud Infraestructure (OCI), instead of a local virtual machine, as it has useful features: it is free, 24 hours working, so I can schedule nightly builds with the last commits,...
But it is not able to start GC, probably due to lack of OpenGL support...

I will investigate the best option: virtual machine, solve OpenGL issue, use of QtCreator...
thanks!

 
Reply all
Reply to author
Forward
0 new messages