Debugging QT project on Col VF61

Hello,

I have a ColVF61 board which is running QT embedded image 4.8.7. I have made a demo qt application and have deployed it on VF61. It is running ok. I need to debug the application. I have included the gdb which is found inside /usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-gdb . When I clicked on the debugging, it gave me below errors:

Debugging starts
Listening on port 10000
Debugging has failed
Debugging has finished

After reading few articles about gdbserver, I run the below command on VF61 to start the gdbserver:

gdbserver host:1234 demo-app

Response:

Process demo-app created; pid = 325
Listening on port 1234

In the QT creator, I clicked on Debug->Start debugging->Attach to running debug server but again it failed. I looked into the debugger logs by clicking on window->view->debugger log, I found out that there are some python related issues. Here is the log:

>&"Error while executing Python code.\n"
>32^error,msg="Error while executing Python code."

>&"Error while executing Python code.\n"
>33^error,msg="Error while executing Python code."
dNOTE: ENGINE SETUP FAILED
dState changed from EngineSetupRequested(1) to EngineSetupFailed(2) [master]
dHANDLE RUNCONTROL FINISHED
sDebugger finished.
dHANDLE RUNCONTROL START FAILED
 dState changed from EngineSetupFailed(2) to DebuggerFinished(22) [master]

 dUNEXPECTED GDB STDERR: Python Exception <class 'ImportError'> No module named 'imp': 
d
dwarning: 
 dCould not load the Python gdb module from `/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-
linux/usr/share/gdb/python'.
dLimited Python support is available from the _gdb module.
dSuggest passing --data-directory=/path/to/gdb/data-directory.
d
dQUIT DEBUGGER REQUESTED IN STATE 22
>34^done

As it is pointing to the installed directory of cross compiler, do we need to include something to enable debugging support while building the toolchain?

AbhinavRawat - I’m having the very same issue as you. The only difference is that my Qt Project is for a Colibri i.MX7D, but the GDB debugger you’re using appears to be exactly the same as mine.

I’m also seeing the same error output as you in the debugger log.

There is an older project that I build that has debugging issues as well. It uses Qt 4.8.

I read somewhere that this may be caused by Python not being built into the GDB debugger which requires the use of Python scripting. I’m not sure how to build the debugger with Python scripting included.

If you type the “python -V” command from a Terminal Emulator what version of Python are you running on your host Linux system?

Here’s my output from running the command:

$ python -V
Python 2.7.6

Are you also running Python version 2.7.6 as well? I was also reading that Python version 3 or higher is what is needed.

Here’s a Qt Forum post I found about this which states in one of the responses that GDB will not work without Python (This is for MacOSx but I think the issue is the same):

Unable to debug application in Qt Creator 3.1.2 (Qt 5.3.1)

I hope someone is able to come along and provide an answer for you on this because I’m totally stuck right now too. My application is crashing at startup and the fastest way to resolve this issue will be to use the debugger.

Hey Gage05.
I have Python 2.7.12. I tried debugging in many ways but was not able to do it. So I am back with the eclipse and through eclipse, it is possible to debug the application.

Hi

What OE image version are you using?

What is the version of Qt Creator you are using?

What gdb version got built and what happens if you use python in a gdb session?

$ arm-angstrom-linux-gnueabi-gdb
Python Exception <class 'ImportError'> No module named 'imp': 

warning: 
Could not load the Python gdb module from `/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/share/gdb/python'.
Limited Python support is available from the _gdb module.
Suggest passing --data-directory=/path/to/gdb/data-directory.

GNU gdb (Linaro GDB) 7.8-2014.09
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-angstromsdk-linux --target=arm-angstrom-linux-gnueabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.linaro.org>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) python print ("Hello")
Hello
(gdb)

This post is about Colibri VF61 and Qt4. It is ok to link between posts if it seems related, but the main discussion should be stay on topic… For Qt5/iMX7 related issues, please keep using the new thread:

https://www.toradex.com/community/questions/11201/qt-creator-debugging-python-issue-colibri-imx7d.html?smartspace=linux-imx7

@Gage05, I deleted your comments with the full debug log in this thread to keep the comment section in manageable size. For the interested reader, the logs are still available in this thread:

https://www.toradex.com/community/questions/11201/qt-creator-debugging-python-issue-colibri-imx7d.html?smartspace=linux-imx7

@AbhinavRawat, Your case seems a bit different than Gage05. The imp module should be part of the Python installation by default. Altough, it is depricated nowadays. In my Qt Creator installation, it does not get used anymore, are you using an older Qt Creator version?

If you still expect support on this, can you answer Max’ question, and also try the following in the gdb console?

(gdb) python import sys; print(sys.version)

Hello,

don’t know if this thread is still alive, but i had the same problem with my QtCreator 4.2.1.
Additionally including nativesdk-python3-importlib into ./meta-qt5/recipes-qt/packagegroups/nativesdk-packagegroup-qt5-toolchain-host.bb solved this problem for me.

I am still not sure what OE version @AbhinavRawat uses, he claims Python is 2.7.12, but I guess that is the Python version of the host system. If the Python version part of the SDK is Python version 3 then your fix likely will solve his issue too.

Hello,

I have the same problem described by @AbhinavRawat and @res. I’m using QtCreator 4.3.1 and debugging has failed with the stock toolchain that comes with Toradex BSP 2.7.1, but works with 2.6.1.

If I run “arm-angstrom-linux-gnueabi-gdb” on Toradex BSP 2.7.1, I get:

Python Exception <class 'ImportError'> No module named 'imp':  warning:  Could not load the Python gdb module from `/usr/local/oecore-x86_64-v2.7.1/sysroots/x86_64-angstromsdk-linux/usr/share/gdb/python'. Limited Python support is available from the _gdb module.

I’ve seen the following packages in the toolchain host manifest:

SDK Host Manifest v2015.12 (BSP 2.6.1)

  • nativesdk-python-importlib
    x86_64-nativesdk 2.7.9-r1

SDK Host Manifest v2016.12 (BSP 2.7.1)

  • nativesdk-python-importlib
    x86_64-nativesdk 2.7.12-r1

    nativesdk-python3-importlib
    x86_64-nativesdk 3.5.2-r1.0

On BSP 2.7.1 and I got:

(gdb) python import sys; print(sys.version)
3.5.2 (default, Jul 29 2017, 22:53:17)  [GCC 5.2.1 20151005]

So my GDB is using python 3.5.2 instead 2.7.12. Any ideas how to solve this problem?

Can you check if that helps?

https://www.toradex.com/community/questions/11201/qt-creator-debugging-python-issue-colibri-imx7d.html?smartspace=linux-imx7

Hello Stefan… Problem solved and now debugging works with BSP 2.7.3 and Qt Creator 4.3.1.

I’ve created a bbappend named “gdb-cross-canadian_%.bbappend” with the following contents:

PACKAGECONFIG[python] += "
nativesdk-python3-json
"

Thanks!