Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: rickg22 on January 10, 2006, 10:45:22 pm

Title: Watching STL maps?
Post by: rickg22 on January 10, 2006, 10:45:22 pm
Is there a way to find out all the values for a certain STL map? I could watch map[1],map[2] etc, but the [] operator adds the index if it's not found already. So, how to display the contents for an STL map (or vector, whatever) without calling the operators? :?

Also, if there IS a way, how about adding this functionality to the plugin? :mrgreen:

Title: Re: Watching STL maps?
Post by: rickg22 on January 10, 2006, 10:49:19 pm
Oh, look at what I found! :D

http://staff.science.uva.nl/~gilad/stl/stl_gdb.html

Quote
gdb_stl_utils is a small utility that may help solving these problems.
To use it, download and compile StlStdContainers.cc (a simple g++ StlStdContainers.cc -o StlStdContainers.o will do); then, load gdb_stl_utils into gdb by using the command "source gdb_stl_utils" (in gdb). You will then have access to the following gdb function:

p_stl_vector, p_stl_vector_size
p_stl_list, p_stl_list_size
p_stl_tree, p_stl_tree_size (for maps and sets)
p_stl_hash, p_stl_hash_size (for hash_maps and sets)

The names are self-explanatory: the functions print the contents and the sizes of STL containers given to them.

And it's GPL'ed! :D
Title: Re: Watching STL maps?
Post by: Game_Ender on January 12, 2006, 06:47:12 pm
Sounds like it should be added to the GDB debugger plugin.  Watching complex memory structures in GDB is a hard thing to do.
Title: Re: Watching STL maps?
Post by: takeshimiya on January 14, 2006, 12:01:39 am
Altrough I haven't tested myself, I think we should add easy support for STLFilt (http://www.bdsoft.com/tools/stlfilt.html) too. A good thing is that it supports every compiler C::B supports.

STL errors are really cryptic.
Title: Re: Watching STL maps?
Post by: yop on January 14, 2006, 12:24:58 am
You don't really need any support of STLFilt, you can just point the compiler executable to it and voila! I've been using it on my linux box at work for quite a while now and I only had to slightly modify the STLFilt configuration.
Title: Re: Watching STL maps?
Post by: takeshimiya on January 14, 2006, 12:38:11 am
Well, that's why I said more integration, perhaps a plugin.
And with each compiler is different to setup.
That's why a plugin for C::B would come in handy.
Title: Re: Watching STL maps?
Post by: Game_Ender on January 14, 2006, 05:39:37 am
Does anyone know how well STLFlit works with GCC 4.0?  They don't have official support on the website yet.