It's intuitive and offers enough useful information for developers. Eclipse+cdt and codelite also have the same result with codeblocks. Then i installed wingdb (an application to use mingw/cygwin+gdb in visual studio) and tried visual studio again.This time it shows the same result with codeblocks. Is it gdb's fault?
You can run your debug session in the command line, and see whether gdb print right result.
Here, it works OK, mingw4.6.3 + gdb cvs + codeblocks debugger branch nightly build.
The sample code:
// bitset::test
#include <iostream>
#include <string>
#include <bitset>
using namespace std;
int main ()
{
bitset<5> mybits (string("01011"));
cout << "mybits contains:\n";
cout << boolalpha;
for (size_t i=0; i<mybits.size(); ++i)
cout << mybits.test(i) << endl;
return 0;
}
The result screen shot:
(http://i683.photobucket.com/albums/vv194/ollydbg_cb/2012-03-31145115.png)
I selected visual studio 2005/2008 compiler and cdb debugger in codeblocks to debug again,it still can not shows detailed contents.The result is:
dictionary = class std::bitset<26>
---_Array =[1]0x40f227
Now i am confused and not sure what is the culprit. Why codeblocks fails to show the detailed contents of bitset as visual studio does? ???
Code::blocks' debugger have better support on gdb than cdb, can you help to elaborate?
Why? Newer gccs have them integrated in the libstdc++ lib, although I don't know what is shipped with Mingw, but this is not our job, it is the job of Mingw developers to ship the printers with they stdc++ lib.
I see both PCX and TDM's GCC 4.6.x have shipped python pretty printers for libstdc++. They are under
MinGWFolder/share/gcc4.6.x/python/libstdcxx
running 'info pretty-printer' in CB
info pretty-printer
objfile /usr/lib64/libstdc++.so.6 pretty-printers:
libstdc++-v6
__gnu_cxx::_Slist_iterator
__gnu_cxx::__7::_Slist_iterator
__gnu_cxx::__7::__normal_iterator
__gnu_cxx::__7::slist
__gnu_cxx::__normal_iterator
__gnu_cxx::slist
__gnu_debug::_Safe_iterator
std::_Deque_const_iterator
std::_Deque_iterator
std::_List_const_iterator
std::_List_iterator
std::_Rb_tree_const_iterator
std::_Rb_tree_iterator
std::__7::_Deque_const_iterator
std::__7::_Deque_iterator
std::__7::_List_const_iterator
std::__7::_List_iterator
std::__7::_Rb_tree_const_iterator
std::__7::_Rb_tree_iterator
std::__7::basic_string
std::__7::bitset
std::__7::deque
std::__7::forward_list
std::__7::list
std::__7::map
std::__7::multimap
std::__7::multiset
std::__7::priority_queue
std::__7::queue
std::__7::set
std::__7::shared_ptr
std::__7::stack
std::__7::tuple
std::__7::unique_ptr
std::__7::unordered_map
std::__7::unordered_multimap
std::__7::unordered_multiset
std::__7::unordered_set
std::__7::vector
std::__7::weak_ptr
std::__cxx1998::_Deque_const_iterator
std::__cxx1998::_Deque_iterator
std::__cxx1998::_List_const_iterator
std::__cxx1998::_List_iterator
std::__cxx1998::__7::_Deque_const_iterator
std::__cxx1998::__7::_Deque_iterator
std::__cxx1998::__7::_List_const_iterator
std::__cxx1998::__7::_List_iterator
std::__cxx1998::__7::bitset
std::__cxx1998::__7::deque
std::__cxx1998::__7::forward_list
std::__cxx1998::__7::list
std::__cxx1998::__7::map
std::__cxx1998::__7::multimap
std::__cxx1998::__7::multiset
std::__cxx1998::__7::set
std::__cxx1998::__7::unordered_map
std::__cxx1998::__7::unordered_multimap
std::__cxx1998::__7::unordered_multiset
std::__cxx1998::__7::unordered_set
std::__cxx1998::__7::vector
std::__cxx1998::bitset
std::__cxx1998::deque
std::__cxx1998::forward_list
std::__cxx1998::list
std::__cxx1998::map
std::__cxx1998::multimap
std::__cxx1998::multiset
std::__cxx1998::set
std::__cxx1998::unordered_map
std::__cxx1998::unordered_multimap
std::__cxx1998::unordered_multiset
std::__cxx1998::unordered_set
std::__cxx1998::vector
std::__debug::bitset
std::__debug::deque
std::__debug::forward_list
std::__debug::list
std::__debug::map
std::__debug::multimap
std::__debug::multiset
std::__debug::priority_queue
std::__debug::queue
std::__debug::set
std::__debug::stack
std::__debug::unique_ptr
std::__debug::unordered_map
std::__debug::unordered_multimap
std::__debug::unordered_multiset
std::__debug::unordered_set
std::__debug::vector
std::__norm::_Deque_const_iterator
std::__norm::_Deque_iterator
std::__norm::_List_const_iterator
std::__norm::_List_iterator
std::basic_string
std::bitset
std::deque
std::forward_list
std::list
std::map
std::multimap
std::multiset
std::priority_queue
std::queue
std::set
std::shared_ptr
std::stack
std::tr1::__7::shared_ptr
std::tr1::__7::unordered_map
std::tr1::__7::unordered_multimap
std::tr1::__7::unordered_multiset
std::tr1::__7::unordered_set
std::tr1::__7::weak_ptr
std::tr1::shared_ptr
std::tr1::unordered_map
std::tr1::unordered_multimap
std::tr1::unordered_multiset
std::tr1::unordered_set
std::tr1::weak_ptr
std::tuple
std::unique_ptr
std::unordered_map
std::unordered_multimap
std::unordered_multiset
std::unordered_set
std::vector
std::weak_ptr
when running gdb from shell (no application specified) : info pretty-printer ==> nothing
some more feedback
#include <iostream>
#include <bitset>
int main()
{
std::bitset<10> bits;
bits[0] = true;
bits[5].flip();
std::cout << bits << std::endl;
return 0;
}
within CB sending commands to gdb :
> print bits
$1 = std::bitset = {
[0] = 1,
[5] = 1
}
> print /r bits
$2 = {
<std::_Base_bitset<1ul>> = {
_M_w = 33
}, <No data fields>}
so it seems CB is using the old "raw" style ...
some more issues :
#include <iostream>
#include <bitset>
#include <map>
#include <string>
int main()
{
std::bitset<10> bits;
bits[0] = true;
bits[5].flip();
std::map<std::string, int> foo;
foo["hello"] = 3;
foo["world"] = 5;
std::cout << bits << std::endl;
return 0;
}
in CB send gdb command manually :
> print foo
$1 = std::map with 2 elements = {
["hello"] = 3,
["world"] = 5
}
But when 'added as watch' we get something like this (even worse then a raw print, well maybe raw print and failure in parsing ??? ) :
Couldn't find method std::map<std::basic_string .............................. and so on ....................................