How to view variables in STL containers (e.g. std :: map) in NetBeans in C ++?

As I can see, it is impossible to determine what is on the STL map using NetBeans.

Is there any plugin / trick / solution that allows me to print all the values ​​from the map in debug mode?

As far as I know, it uses GDB to debug C ++ applications. I found some good GDB macros for STL containers (here: http://sourceware.org/ml/gdb/2008-02/msg00064.html ). Can they be run from within NetBeans?

+3
source share
3 answers

NetBeans gdb , gdb NetBeans .

wd- gdb, python STL: http://sourceware.org/gdb/wiki/STLSupport

(, .gdbinit, python, , )

g++ 4.7 ( ). , :

g++ --version

( Linux Mint 13, ):

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.7 c++-4.7

gcc g++, 4.7 ( ):

sudo su
rm /usr/bin/g++
rm /usr/bin/gcc
ln -s /usr/bin/g++-4.7 /usr/bin/g++
ln -s /usr/bin/gcc-4.7 /usr/bin/gcc
+2

.gdbinit , ( ), , GDB.

+1

stl-views.gdb is pretty old. GDB 7.x has a much better mechanism for checking STL containers.

0
source

Source: https://habr.com/ru/post/1765653/


All Articles