PlatformIO Community

STL containers debug on ST NUCLEO-F401RE

Hey all,

this is my first post here :slight_smile:

First of all, I think platform.io is really a great tool! I am using it as a VSCode plugin.

I am working on a project for the ST nucleo_f401re board. This is the relevant part of my platformio.ini file:

[env:nucleo_f401re]
platform = ststm32
board = nucleo_f401re
framework = stm32cube
upload_protocol = stlink
debug_tool = stlink

I got everything set up to build and debug C++ code. I noticed the vendor of the toolchain implemented many STL containers (vector, string, etc…) and it would be great to be using them. One minor thing that is bothering me is that I cannot really find a way to have VSCode showing me the content of the STL containers while debugging.

Googling around I see there are some references but none of them seems to be working.

Did any of you encounter a similar issue?

Just as a test, if you set a breakpoint in some function and have it hit that breakpoint, then go into the “Debug Console” and use the GDB command for printing a variable (e.g., a global variable that is an STL container) with p <variable name>, does it pretty-print the container contents properly? (Per https://stackoverflow.com/a/46389265/5296568)

Unfortunately pretty-print seems not to be enabled on my debugger :frowning:
The toolchain / packages I am using are:

  • framework-stm32cubef4 1.25.2
  • tool-ldscripts-ststm32 0.1.0
  • toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
  • GNU gdb (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 8.0.50.20171128-git

Do I perhaps have to enable pretty-print manually? According to https://sourceware.org/gdb/wiki/STLSupport I have to modify the gdbinit file but I am a bit lost about where to find this file for the toolchain I am using.

I have found this issue in the vscode-cpptools github. I will soon try some of the suggestions made in that discussion to see if it works here too.