Author Topic: Watching STL maps?  (Read 9913 times)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Watching STL maps?
« 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:


Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Watching STL maps?
« Reply #1 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

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: Watching STL maps?
« Reply #2 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.

takeshimiya

  • Guest
Re: Watching STL maps?
« Reply #3 on: January 14, 2006, 12:01:39 am »
Altrough I haven't tested myself, I think we should add easy support for STLFilt too. A good thing is that it supports every compiler C::B supports.

STL errors are really cryptic.

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Watching STL maps?
« Reply #4 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.
Life would be so much easier if we could just look at the source code.

takeshimiya

  • Guest
Re: Watching STL maps?
« Reply #5 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.

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: Watching STL maps?
« Reply #6 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.