EDIT:
Hey wait a second... did you say map? :lol:
I could swear I read vector... anyway: STL maps are not supposed to do that, but wxHashMap does.
Actually, according the specifications in Mark Nelson's STL book, operator[]
does insert the element in an STL map, although it does not for an STL vector. If the operator makes people nervous, though, the command to GDB could always just use vector::at().
I'm pretty sure you can also use and dereference iterators in GDB, though, so even for a map, it might be possible to write a compiler-independent script that steps through each map element using iterators - it would presumably ask GDB for (*(iter +
element#) ).first and (*(iter +
element#) ).second, then combine the two into a single string, for each map element. Although this would probably take a serious toll in terms of performance, to send and process all these GDB commands and output.
Mandrav, any results on performance using such multiple GDB commands?