Bug 11874 - Vector pretty-printer chokes on bit-vectors
Summary: Vector pretty-printer chokes on bit-vectors
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: unknown
: P2 normal
Target Milestone: 7.1
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2010-08-03 20:40 UTC by Paul Pluzhnikov
Modified: 2010-08-16 18:52 UTC (History)
1 user (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Paul Pluzhnikov 2010-08-03 20:40:53 UTC
Test case:

// --- cut --- bitvector.cc ---
#include <vector>

typedef std::vector<bool> BV;

int main()
  BV bv;

  return 0;
// --- cut --- bitvector.cc ---

Using gcc 4.6.0 20100803 (experimental):

g++ -g bitvector.cc

gdb ./a.out
GNU gdb (GDB)
(gdb) python
>sys.path.insert(0, '/home/gcc-svn-install/share/gcc-4.6.0/python')
>from libstdcxx.v6.printers import register_libstdcxx_printers
>register_libstdcxx_printers (None)
(gdb) b main
Breakpoint 1 at 0x4007fd: file bitvector.cc, line 7.
(gdb) r

Breakpoint 1, main () at bitvector.cc:7
7         BV bv;
(gdb) n
8         bv.push_back(true);
(gdb) p bv
$1 = Traceback (most recent call last):
  File "/home/gcc-svn-install/share/gcc-4.6.0/python/libstdcxx/v6/printers.py",
line 186, in to_string
    % (self.typename, int (finish - start), int (end - start)))
RuntimeError: Argument to arithmetic operation not a number or boolean.
Traceback (most recent call last):
  File "/home/gcc-svn-install/share/gcc-4.6.0/python/libstdcxx/v6/printers.py",
line 169, in next
    elt = self.item.dereference()
RuntimeError: Attempt to take contents of a non-pointer value.
Comment 1 Tom Tromey 2010-08-16 18:52:46 UTC
The fix is in gcc svn now.