On Tue, Mar 11, 2008 at 12:35:46AM -0400, "H.S." <[EMAIL PROTECTED]> was heard to say: > Just wanted to see if somebody could share some information about where > we are regarding debugging programs which use STL. > > For example, I am not sure how I can print out the values of a two > dimensional vector (vector of a vector) in gdb.
So, this isn't pretty. But you can examine the values of a vector in gdb. If you print a vector you'll see something like this: (gdb) print matchers $10 = {<std::_Vector_base<aptitude::matching::pkg_matcher*,std::allocator<aptitude::matching::pkg_matcher*> >> = { _M_impl = {<std::allocator<aptitude::matching::pkg_matcher*>> = {<__gnu_cxx::new_allocator<aptitude::matching::pkg_matcher*>> = {<No data fields>}, <No data fields>}, _M_start = 0x832e4d8, _M_finish = 0x832e4e4, _M_end_of_storage = 0x832e4e8}}, <No data fields>} Here _M_start is matchers.begin(), _M_finish is matchers.end(), and I think _M_end_of_storage is the end of the allocated space. Luckily, gdb knows how to dispatch .size(), so you can do this to print a vector: (gdb) print [EMAIL PROTECTED]() $9 = {0x832e4d8, 0x832e4e4, 0x832e4e8} TBH, though, I think printf statements are more useful. Daniel PS: Please don't ask me about std::sets. ;-) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]