User forums > Using Code::Blocks

How can watch the contents of std::containers?

(1/2) > >>

chameleon:
I am not sure that it is a Code::Blocks question or off-topic.

I work with g++/gdb and I cannot debug my programs without placing std::cout all over my code.

The reason is that gdb shows the internal structure of e.g. std::vector instead of what I want: the contained elements as array.
So, given the start vector pointer and the end pointer, I cannot debug. I must inspect the memory which is a NO. Better std::cout for logging.
I give and a screenshot with meaningless values.


Also, 'this' and other pointers are given with their memory pointer value which is almost useless. I want the contents.
Here there is a fast workaround to place extra watch *this but why Code::Blocks does not give both by default? Not for 'this' only. For every pointer.

hongwenjun:
Please search for gdbinit in the MinGW directory.

Debugger setting  -->  default -->  Initialization command

source $(TARGET_COMPILER_DIR)etc\gdbinit



New result

chameleon:
Thanks pal.
I really understand that, I am doing something wrong.

I cannot make your solution work.

I use this binary of Mingw64:
http://winlibs.com/ the 10.1 version.

There is no etc\gdbinit
I will appreciate if you can be a little bit more accurate, based on my distribution of mingw64.

Thanks.

PS: I really understand that my post is off-topic too.

chameleon:
It seems that I run a GDB without Python support.
So, there is no solution.

oBFusCATed:
There is a solution - install gdb with python. But it will be partial solution. :(

Navigation

[0] Message Index

[#] Next page

Go to full version