Linux IDE with proper STL debugging support

I am looking for a Linux IDE with STL debugging support.

The problem is that with Eclipse CDT, if I draw a vector after push_back:

int main() { vector<string> v; v.push_back("blah"); return 0; } 

I get something hostile like

 {<std::_Vector_base<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {_M_impl = {<std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >> = {<__gnu_cxx::new_allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >> = {<No data fields>}, <No data fields>}, _M_start = 0x1fee040, _M_finish = 0x1fee048, _M_end_of_storage = 0x1fee048}}, <No data fields>} 

instead of something like

 vector["blah"] 

or something similar. is there an alternative IDE / Debugger for Linux that provides better STL support?

+6
c ++ debugging linux eclipse-cdt stl
source share
4 answers

QtCreator contains debug dumpers for Qt containers, some of the STL containers, and a bunch of Qt classes. It is also more sensitive than Eclipse.

See Qt Creator debugging dump trucks .

+5
source share

Just a GDB script question so you can print stl containers. To print a vector:

 define pvec set $vec = ($arg0) set $vec_size = $vec->_M_impl->_M_finish - $vec->_M_impl->_M_start if ($vec_size != 0) set $i = 0 while ($i < $vec_size) printf "Vector Element %d: ", $i p *($vec->_M_impl->_M_start+$i) set $i++ end end end 

Now you can even script in python. Check the documentation.

I personally use cgdb, which is a very convenient curses debugger.

+1
source share

This has nothing to do with the IDE as such, but it is the drawback of the debugger you are using. IDEs, especially on Linux, are only debugger interfaces. I suppose you are using GDB and this will not improve. BTW, while developing on Linux, I use carefully deferred print statements instead of a debugger, and most of the time I find this better than using a debugger!

0
source share

Eclipse uses gdb, and you can script gdb to print different types the way you want. I use my own scripts for my own types, but there are many scripts available for stl.

Now, the challenge will be to make this work smoothly with Eclipse, but it may be a solution.

0
source share