Bug 10646 - pretty printers should also work for std::__debug::vector et al.
Summary: pretty printers should also work for std::__debug::vector et al.
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: unknown
: P2 normal
Target Milestone: 6.8
Assignee: Phil Muldoon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-16 19:51 UTC by Paul Pluzhnikov
Modified: 2009-10-02 07:06 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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Pluzhnikov 2009-09-16 19:51:52 UTC
When code is compiled with -D_GLIBCXX_DEBUG, then std::vector is replaced with
std::__debug::vector.

Our pretty-printers should work on those as well.

Example:

#include <vector>

int main()
{
  std::vector<int> v;
  v.push_back(1);
  return 0;  // break here
}

g++ -g t.cc
gdb64-cvs -q ./a.out

(gdb) b 7
Breakpoint 1 at 0x4007b4: file t.cc, line 7.
(gdb) r

Breakpoint 1, main () at t.cc:7
7         return 0;  // break here
(gdb) p v
$1 = std::vector of length 1, capacity 1 = {1}

g++ -g t.cc -D_GLIBCXX_DEBUG
gdb64-cvs -q ./a.out

(gdb) b 7
Breakpoint 1 at 0x400aa4: file t.cc, line 7.
(gdb) r

Breakpoint 1, main () at t.cc:7
7         return 0;  // break here
(gdb) p v
$1 = {<std::__norm::vector<int, std::allocator<int> >> =
{<std::__norm::_Vector_base<int, std::allocator<int> >> = {
      _M_impl = {<std::allocator<int>> = {<__gnu_cxx::new_allocator<int>> = {<No
data fields>}, <No data fields>}, _M_start = 0x603010, 
        _M_finish = 0x603014, 
        _M_end_of_storage = 0x603014}}, <No data fields>},
<__gnu_debug::_Safe_sequence<std::__debug::vector<int, std::allocator<int> > >>
= {<__gnu_debug::_Safe_sequence_base> = {_M_iterators = 0x0, _M_const_iterators
= 0x0, _M_version = 2}, <No data fields>}, 
  _M_guaranteed_capacity = 1}
(gdb) q
Comment 1 Phil Muldoon 2009-09-30 14:41:38 UTC
FYI: I've submitted a patch for this to gcc-patches:

http://gcc.gnu.org/ml/gcc-patches/2009-09/msg02187.html
Comment 2 Phil Muldoon 2009-10-02 07:06:11 UTC
This has been checked in:

http://gcc.gnu.org/ml/gcc-cvs/2009-10/msg00034.html

I'll close this bug, as the initial implementation request.