PlatformIO Community

Enable pretty-printing of vectors in PIO Unified Debugger


I am working on a project that makes use of STL vectors. I recently purchased a ESP-Prog dongle in order to debug the code and for the most part everything works great.

Once small issue I have is that I am unable to view the contents of std::vector type variables. For example, assume I have a variable _muted, running print _muted in the Debug Console yields the following result:

print _muted
$1 = {<std::_Bvector_base<std::allocator<bool> >> = {_M_impl = {<std::allocator<unsigned long>> = {<__gnu_cxx::new_allocator<unsigned long>> = {<No data fields>}, <No data fields>}, _M_start = {<std::_Bit_iterator_base> = {<std::iterator<std::random_access_iterator_tag, bool, int, bool*, bool&>> = {<No data fields>}, _M_p = 0x3ffb8474, _M_offset = 0
}, <No data fields>}
, _M_finish = {<std::_Bit_iterator_base> = {<std::iterator<std::random_access_iterator_tag, bool, int, bool*, bool&>> = {<No data fields>}, _M_p = 0x3ffb8474, _M_offset = 6
}, <No data fields>}
, _M_end_of_storage = 0x3ffb8478}
}, <No data fields>}

As one can see, the above command does not really print the contents of the vector. Looking at this thread, people seem to be pointing at making use of python pretty-printers, as also documented in the GDB Wiki.

I tried to follow the suggested steps in order to add a pretty-printer through a .gdbinit file. However, once debugging starts, I get the following error:

Python scripting is not supported in this copy of GDB.

I am wondering if anyone has had a go at doing this before. Any pointers or suggestions will be highly appreciated.