User forums > Using Code::Blocks

The output infomation of std:bitset is insufficient when debugging.

(1/6) > >>

hooluupog:
I added a bitset type of virable to watch When debugging but the output infomation is  insufficient and not intuitive.
For example,somthing like this:
{
...
std::bitset<26> dictionary;  
...
}
F8 start debugging it and add 'dictionary' to watch, the output is:

-dictionary
  -<std::_Base_Bitset<1u>>
     -M_w=8736     (when changed to binary,it shows: 10001000100000)
  -<No data fields>

It can not show the detailed contents of bitset for me to debug it.Then let's look at the result in visual studio 2008 debugger window:
watch1namedictionary01234...value[26]{0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0.......}falsefalsetruetruefalse...typestd::bitset<26>boolboolboolboolbool...
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?  
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? ???

ollydbg:

--- Quote from: hooluupog on March 31, 2012, 06:43:03 am ---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?

--- End quote ---
 
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:

--- 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;
}

--- End code ---

The result screen shot:



--- Quote ---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? ???

--- End quote ---
Code::blocks' debugger have better support on gdb than cdb, can you help to elaborate?

Jenna:

--- Quote from: ollydbg on March 31, 2012, 08:52:49 am ---Here, it works OK, mingw4.6.3 + gdb cvs + codeblocks debugger branch nightly build.

--- End quote ---

It does not work with default installation.
I guess you need pretty printers to make it work.

hooluupog:

--- Quote from: ollydbg on March 31, 2012, 08:52:49 am ---The result screen shot:


--- End quote ---
Hi,
it is strange. I am using 7790 debugger branch with latest version tdm-gcc. Here is my result:
click to zoom it.

oBFusCATed:
hooluupog: Works for me, like in the screenshot from Ollydbg, but you need to install python enabled gdb and you need to have python pretty printers for gdb for the stl library.
See here: http://sourceware.org/gdb/wiki/STLSupport

p.s. Keep in mind that attaching images to the forum is not a really good idea, because the space is limited an when it is exhausted the admins delete attachments at random. A better idea is to paste as text (right click in the command line and mark) or use an image sharing service!

Navigation

[0] Message Index

[#] Next page

Go to full version