Qt Creator Debugging Python Issue Colibri i.MX7D

Hello,

I’m having an issue with using the debugger in Qt Creator for an application that I’m trying to debug in embedded Linux. My debugging log output is as follows:

 sStarting debugger "GdbEngine" for ABI "arm-linux-generic-elf-32bit"...
 dStart parameters: 'T200_Linux_Colibri-iMX7D (on Remote Device)' mode: 6
 dABI: arm-linux-generic-elf-32bit
 dLanguages: c++ 
 dExecutable: /opt/bin/T200_Linux_Colibri-iMX7D 
 dDebugger: /usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-gdb
 dProject: /home/carloval/Development/New_Products/Colibri/iMX7D/A7_0/Application/TXXXX_Colibri-iMX7DAddtional Search Directories:
 dRemote: 169.254.104.37:-1
 dSysroot: /usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi
 dDebug Source Location: 
 dDebugger settings: 
 dShowQtNamespace: true  (default: true)
 dShowQObjectNames: false  (default: false)
 dSortStructMembers: true  (default: true)
 dAutoDerefPointers: true  (default: true)
 dWatchdogTimeout: 20  (default: 20)
 dAutoEnrichParameters: true  (default: true)
 dUseDynamicType: true  (default: true)
 dTargetAsync: false  (default: false)
 dWarnOnReleaseBuilds: true  (default: true)
 dMultiInferior: false  (default: false)
 dIntelFlavor: false  (default: false)
 dIdentifyDebugInfoPackages: false  (default: false)
 dCDB_Console: false  (default: false)
 dBreakpointCorrection: true  (default: true)
 dIgnoreFirstChanceAccessViolation: false  (default: false)
 dLoadGdbInit: true  (default: true)
 dLoadGdbDumpers2: false  (default: false)
 dAttemptQuickStart: false  (default: false)
 dGdbStartupCommands:   (default: )
 dGdbPostAttachCommands:   (default: )
 dQmlInspector.ShowAppOnTop: false  (default: false)
 dNoPluginBreakpoints: false  (default: false)
 dSelectedPluginBreakpointsPattern: .*  (default: .*)
 dBreakOnThrow: false  (default: false)
 dBreakOnCatch: false  (default: false)
 dBreakOnWarning: false  (default: false)
 dBreakOnFatal: false  (default: false)
 dBreakOnAbort: false  (default: false)
 dShowQmlObjectTree: true  (default: true)
 dAlwaysAdjustColumnWidths: true  (default: true)
 dExtraDumperFile:   (default: )
 dGdbCustomDumperCommands:   (default: )
 dAdditionalArguments:   (default: )
 dSymbolPaths:   (default: )
 dSourcePaths:   (default: )
 dBreakEvent:   (default: )
 dBreakOnCrtDbgReport: false  (default: false)
 dShowThreadNames: false  (default: false)
 dUseToolTips: true  (default: true)
 dUseToolTipsInLocalsView: false  (default: false)
 dUseToolTipsInBreakpointsView: false  (default: false)
 dUseToolTipsInBreakpointsView: false  (default: true)  ***
 dUseAddressInBreakpointsView: false  (default: false)
 dUseAddressInStackView: false  (default: false)
 dCloseBuffersOnExit: false  (default: false)
 dCloseMemoryBuffersOnExit: true  (default: true)
 dSwitchModeOnExit: false  (default: false)
 dBreakpointsFullPath: false  (default: false)
 dRaiseOnInterrupt: true  (default: true)
 dStationaryEditorWhileStepping: false  (default: false)
 dUseDebuggingHelper: true  (default: true)
 dUseCodeModel: true  (default: true)
 dUseAlternatingRowColours: false  (default: false)
 dFontSizeFollowsEditor: false  (default: false)
 dUseMessageBoxForSignals: true  (default: true)
 dAutoQuit: false  (default: false)
 dLogTimeStamps: false  (default: false)
 dMaximalStringLength: 10000  (default: 10000)
 dDisplayStringLimit: 100  (default: 100)
 dSkipKnownFrames: false  (default: false)
 dEnableReverseDebugging: false  (default: false)
 dAllPluginBreakpoints: true  (default: true)
 dSelectedPluginBreakpoints: false  (default: false)
 dAdjustBreakpointLocations: true  (default: true)
 dMaximalStackDepth: 20  (default: 20)
 dShowStandardNamespace: true  (default: true)
 dState changed from DebuggerNotReady(0) to EngineSetupRequested(1) [master]
 dQUEUE: SETUP ENGINE
 dCALL: SETUP ENGINE
 dEXAMINING /home/carloval/Development/New_Products/Colibri/iMX7D/A7_0/Application/TXXXX_Colibri-iMX7D/build-T200_Linux_Colibri-iMX7D-Toradex_Qt_Embedded-Debug/T200_Linux_Colibri-iMX7D
 dELF SECTIONS:  .interp .note.ABI-tag .note.gnu.build-id .dynsym .dynstr .gnu.hash .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .ARM.extab .ARM.exidx .eh_frame .eh_frame_hdr .jcr .fini_array .init_array .data.rel.ro .dynamic .data .tm_clone_table .got .bss .comment .debug_aranges .debug_info .debug_abbrev .debug_line .debug_str .debug_ranges .debug_loc .debug_frame .note.gnu.gold-version .ARM.attributes .symtab .strtab .shstrtab 
 dTRYING TO START ADAPTER
 dNOTE: REQUEST REMOTE SETUP
 
  Listening on port 10000
 dNOTE: REMOTE SETUP DONE: GDB SERVER PORT: 10000  QML PORT -1
 dENABLING TEST CASE: 0
 dSTARTING /usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-gdb -i mi
 dGDB STARTED, INITIALIZING IT
 <1show version
 <2show debug-file-directory
 <3set print object on
 <4set breakpoint pending on
 <5set print elements 10000
 <6handle SIGSEGV nopass stop print
 <7set unwindonsignal on
 <8set width 0
 <9set height 0
 sSetting up inferior...
 <10set sysroot /usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi
 <11set substitute-path /usr/src /usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/src
 <12-interpreter-exec console "set auto-solib-add on"
 <13python sys.path.insert(1, '/home/carloval/Qt5.7.0/Tools/QtCreator/share/qtcreator/debugger/')
 <14python sys.path.append('/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/bin/arm-angstrom-linux-gnueabi/data-directory/python')
 <15python from gdbbridge import *
 <16python theDumper.loadDumpers({"token":16})
 
 >=thread-group-added,id="i1"
 >~"GNU gdb (Linaro GDB) 7.8-2014.09\n"
 >~"Copyright (C) 2014 Free Software Foundation, Inc.\n"
 >~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\n"
 >~"This GDB was configured as \"--host=x86_64-angstromsdk-linux --target=arm-angstrom-linux-gnueabi\".\nType \"show configuration\" for configuration details."
 >~"\nFor bug reporting instructions, please see:\n"
 >~"<http://bugs.linaro.org>.\n"
 >~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n"
 >~"For help, type \"help\".\n"
 >~"Type \"apropos word\" to search for commands related to \"word\".\n"
 
 >&"show version\n"
 >~"GNU gdb (Linaro GDB) 7.8-2014.09\n"
 >~"Copyright (C) 2014 Free Software Foundation, Inc.\n"
 >~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\n"
 >~"This GDB was configured as \"--host=x86_64-angstromsdk-linux --target=arm-angstrom-linux-gnueabi\".\nType \"show configuration\" for configuration details."
 >~"\nFor bug reporting instructions, please see:\n"
 >~"<http://bugs.linaro.org>.\n"
 >~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n"
 >~"For help, type \"help\".\n"
 >~"Type \"apropos word\" to search for commands related to \"word\".\n"
 >1^done
 dPARSING VERSION: 1^done
 dSUPPORTED GDB VERSION GNU gdb (Linaro GDB) 7.8-2014.09
 dCopyright (C) 2014 Free Software Foundation, Inc.
 dLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 dThis is free software: you are free to change and redistribute it.
 dThere is NO WARRANTY, to the extent permitted by law.  Type "show copying"
 dand "show warranty" for details.
 dThis GDB was configured as "--host=x86_64-angstromsdk-linux --target=arm-angstrom-linux-gnueabi".
 dType "show configuration" for configuration details.
 dFor bug reporting instructions, please see:
 d<http://bugs.linaro.org>.
 dFind the GDB manual and other documentation resources online at:
 d<http://www.gnu.org/software/gdb/documentation/>.
 dFor help, type "help".
 dType "apropos word" to search for commands related to "word".
 dGNU gdb (Linaro GDB) 7.8-2014.09
 dCopyright (C) 2014 Free Software Foundation, Inc.
 dLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 dThis is free software: you are free to change and redistribute it.
 dThere is NO WARRANTY, to the extent permitted by law.  Type "show copying"
 dand "show warranty" for details.
 dThis GDB was configured as "--host=x86_64-angstromsdk-linux --target=arm-angstrom-linux-gnueabi".
 dType "show configuration" for configuration details.
 dFor bug reporting instructions, please see:
 d<http://bugs.linaro.org>.
 dFind the GDB manual and other documentation resources online at:
 d<http://www.gnu.org/software/gdb/documentation/>.
 dFor help, type "help".
 dType "apropos word" to search for commands related to "word".
 dUSING GDB VERSION: 70800, BUILD: 2014
 <17-interpreter-exec console "set target-async off"
 <18-interpreter-exec console "set detach-on-fork off"
 
 >&"show debug-file-directory\n"
 >~"The directory where separate debug symbols are searched for is \"/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/lib/arm-angstrom-linux-gnueabi/debug\".\n"
 >2^done
 
 >&"set print object on\n"
 >=cmd-param-changed,param="print object",value="on"
 >3^done
 
 >&"set breakpoint pending on\n"
 >=cmd-param-changed,param="breakpoint pending",value="on"
 >4^done
 
 >&"set print elements 10000\n"
 >=cmd-param-changed,param="print elements",value="10000"
 >5^done
 
 >&"handle SIGSEGV nopass stop print\n"
 >~"Signal        Stop\tPrint\tPass to program\tDescription\n"
 >~"SIGSEGV       Yes\tYes\tNo\t\tSegmentation fault\n"
 >6^done
 
 >&"set unwindonsignal on\n"
 >=cmd-param-changed,param="unwindonsignal",value="on"
 >7^done
 
 >&"set width 0\n"
 >=cmd-param-changed,param="width",value="4294967295"
 >8^done
 
 >&"set height 0\n"
 >9^done
 
 >&"set sysroot /usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi\n"
 >=cmd-param-changed,param="sysroot",value="/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi"
 >10^done
 
 >&"set substitute-path /usr/src /usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/src\n"
 >11^done
 
 >12^done
 
 >&"python sys.path.insert(1, '/home/carloval/Qt5.7.0/Tools/QtCreator/share/qtcreator/debugger/')\n"
 >13^done
 
 >&"python sys.path.append('/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/bin/arm-angstrom-linux-gnueabi/data-directory/python')\n"
 >14^done
 
 >&"python from gdbbridge import *\n"
 
 >&"Traceback (most recent call last):\n"
 >&"  File \"<string>\", line 1, in <module>\n"
 >&"  File \"/home/carloval/Qt5.7.0/Tools/QtCreator/share/qtcreator/debugger/gdbbridge.py\", line 41, in <module>\n"
 >&"    from dumper import *\n"
 >&"  File \"/home/carloval/Qt5.7.0/Tools/QtCreator/share/qtcreator/debugger/dumper.py\", line 32, in <module>\n"
 >&"    import json\n"
 >&"ImportError: No module named 'json'\n"
 >&"Error while executing Python code.\n"
 >15^error,msg="Error while executing Python code."
 
 >&"python theDumper.loadDumpers({\"token\":16})\n"
 >&"Traceback (most recent call last):\n"
 >&"  File \"<string>\", line 1, in <module>\n"
 >&"NameError: name 'theDumper' is not defined\n"
 >&"Error while executing Python code.\n"
 >16^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.
 sUser requested stop. Shutting down...
 dHANDLE RUNCONTROL START FAILED
 dState changed from EngineSetupFailed(2) to DebuggerFinished(22) [master]
 
 dQUIT DEBUGGER REQUESTED IN STATE 22
 >17^done
 dCOOKIE FOR TOKEN 17 ALREADY EATEN (DebuggerFinished). TWO RESPONSES FOR ONE COMMAND?
 
 >=cmd-param-changed,param="detach-on-fork",value="off"
 >18^done
 dCOOKIE FOR TOKEN 18 ALREADY EATEN (DebuggerFinished). TWO RESPONSES FOR ONE COMMAND?

You can see towards the bottom of the output that the following error occurred:

>&"python theDumper.loadDumpers({\"token\":16})\n"
>&"Traceback (most recent call last):\n"
>&"  File \"<string>\", line 1, in <module>\n"
>&"NameError: name 'theDumper' is not defined\n"
>&"Error while executing Python code.\n"
>16^error,msg="Error while executing Python code."

I see this error, and sometimes the error: ImportError: No module named json when attempting to run the debugger. It seems that the GDB debugger might have Python built in, but not all of the modules that Python needs for the Qt Creator debugger to work. I did find a forum post on another website where someone had a similar problem with the json error when running Qt Creator in the Windows operating system:

ImportError: No module named json

This person ran a command from the command line that verified the json module was available to Python, but the problem turned out to be that the version of Python used by the debugger was different and did not have the necessary modules installed. I’m seeing the same thing. I run the command from the command line and Python verifies that the json module is there, but I see the error when attempting to run the debugger in Qt Creator.

Is there a way that I can install the necessary modules in the version of Python that is built into the GDB, or is there another version of the GDB debugger available that already has everything I need installed so that the debugger will work?

The OE image version that we’re using is: angstrom-lxde-image.

The version of Qt Creator that we’re using is: Qt Creator 4.0.2

Thank You.

It seems that Python is there and working, however Qt Creator tries to import some helper script (dumper.py) and that script tries to import the json module.

As far as I know GCC uses Python 3 in morty, hence you would have to add nativesdk-python3-json to the SDK dependencies. If you build meta-toolchain-qt5 I think adding that to ./meta-qt5/recipes-qt/packagegroups/nativesdk-packagegroup-qt5-toolchain-host.bb should make sure that the library gets included into the SDK.

Brilliant!

Stefan.tx your suggestion worked! That’s exactly what we needed to do to get the debugger working.

Thanks for your help! :).