User forums > Using Code::Blocks

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

<< < (4/6) > >>

killerbot:
some more feedback


--- Code: ---#include <iostream>
#include <bitset>


int main()
{
    std::bitset<10> bits;
    bits[0] = true;
    bits[5].flip();
    std::cout << bits << std::endl;
    return 0;
}

--- End code ---

within CB sending commands to gdb :


--- Code: ---> print bits
$1 = std::bitset = {
  [0] = 1,
  [5] = 1
}
--- End code ---


--- Code: ---> print /r bits
$2 = {
  <std::_Base_bitset<1ul>> = {
    _M_w = 33
  }, <No data fields>}

--- End code ---
so it seems CB is using the old "raw" style ...

oBFusCATed:

--- Quote from: killerbot on April 02, 2012, 01:21:20 pm ---when running gdb from shell (no application specified) : info pretty-printer  ==> nothing

--- End quote ---
This is expected as gdb  searches for pretty printers next to the binaries/shared objects.

killerbot:
some more issues :


--- Code: ---#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;
}

--- End code ---

in CB send gdb command manually :

--- Code: ---> print foo
$1 = std::map with 2 elements = {
  ["hello"] = 3,
  ["world"] = 5
}
--- End code ---

But when 'added as watch' we get something like this (even worse then a raw print, well maybe raw print and failure in parsing ??? ) :

--- Code: ---Couldn't find method std::map<std::basic_string .............................. and so on ....................................

--- End code ---

ollydbg:
Under Windows, I need to manually load the python pretty printer script for libstdc++. So I have some custom.gdb file to run after gdb started under C::B. I believe gdb have no idea to automatically load the python scripts (How does gdb know the path you install libstdc++'s scripts?).

As under Linux, I see:
http://sourceware.org/gdb/wiki/STLSupport


--- Quote ---Add the following to your ~/.gdbinit. The path needs to match where the python module above was checked-out. So if checked out to: /home/maude/gdb_printers/, the path would be as written in the example:

    python
    import sys
    sys.path.insert(0, '/home/maude/gdb_printers/python')
    from libstdcxx.v6.printers import register_libstdcxx_printers
    register_libstdcxx_printers (None)
    end

--- End quote ---



oBFusCATed:
Please post the full log from the session.

Also as far as I can see we don't use /r anywhere in our plugin.
Full log again will reveal what is happening.
And make sure you've disabled the option for the old scripts!

ollydbg: on linux gdb is smart and loads it by correctly if the printers are next to the bin/so file. Read the gdb docs for details, I'm sure they've documented it there. :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version