[STM32, C++, Atollic TrueStudio] Enable STL pretty printing (python GDB?) - Page 1
Forum section: electronics / general

author: gnasirator
author_rank: Contributor
timestamp: May 29, 2017, 04:33:10 am
content: Hi everybody,I would like to share a short story with you and ask for help afterwards.I've been happily coding my stm32s in plain old C for a while and everything was 'hunkydory' but I always missed object orientation and the nice layering/abstraction that would allow me to overview complex projects.No I have changed to C++ and am LOVING it! It's actually very painless and "just works". I'm using Atollic TrueStudio. The process is as follows:1. Generate C project using CubeMX for Truestudio just as you're used to.2. In TrueStudio, convert project to C++ and copy symbols + dirs from C compiler settings over to C++ (copy+paste!)3. Rename relevant files to .cpp / .hpp and voila!Now my help request:I'm making some use of STL containers and can't get the included GDB server to activate pretty printing. Thus during debugging, I don't know the contents of those containers. Vectors are still okay as I can recast them to arrays in gdb, allowing me to peek inside. This doesn't work with maps though.Does anyone around here have some experience with this? I found that the toolchain coming with TrueStudio actually HAS all the python pretty printer files. It only seems as if the gdb server exe doesn't support python.So I downloaded the arm-none-eabi toolchain and replaced the "arm-atollic-eabi-gdb.exe" with "arm-none-eabi-gdb-py.exe" (renamed it).Now Atollic won't start a debug session anymore (can't find open port) but if I start the gdb server manually, it spits out the following errors:Code:Python Exception <type 'exceptions.ImportError'> No module named gdb:C:\Program Files (x86)\Atollic\TrueSTUDIO for ARM 7.1.2\ARMTools\bin\arm-none-eabi-gdb-py.exe: warning:Could not load the Python gdb module from `c:\tmp\jenkins-gcc-6-buildandreg-104_20170216_1487268972\install-mingw\arm-none-eabi\share\gdb/python'.Limited Python support is available from the _gdb module.Suggest passing --data-directory=/path/to/gdb/data-directory.GNU gdb (GNU Tools for ARM Embedded Processors 6-2017-q1-update) 7.12.1.20170215-gitCopyright (C) 2017 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=i686-w64-mingw32 --target=arm-none-eabi".Type "show configuration" for configuration details.For bug reporting instructions, please see:<http://www.gnu.org/software/gdb/bugs/>.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".Don't know how to attach. Try "help target".(gdb)Does anybody know how to set this up properly? That would be of BIG help!Btw, the feature request to Atollic is already submitted. They say it's not very high on their priority. Seems like the majority uses C and doesn't care.PS: I don't want this thread to turn into a C vs C++ discussion, please! I think both have its pro's and con's and for larger, more complex projects (dynamically created objects with multiple member threads) I'm definitely a C++ fan. For smaller, simpler ones ... naah.