diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 82dbf42f96a..25359160ba7 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,33 @@ +2012-01-30 Tom Tromey + + PR libstdc++/51649: + * testsuite/libstdc++-prettyprinters/debug.cc: New file. + * testsuite/lib/gdb-test.exp (regexp-test): New proc. + (note-test): Update. + (gdb-test): Handle regexp tests. Add some logging. + * testsuite/libstdc++-prettyprinters/simple.cc: Compile with -O0. + (placeholder, use): Remove. + (main): Add tests for deque, list, map, and set iterators. Add + tests for slist and slist iterator. + * testsuite/libstdc++-prettyprinters/48362.cc (main): Handle __7 + namespace. + * python/libstdcxx/v6/printers.py (StdListPrinter.children): Use + the type's _Node typedef. + (StdListIteratorPrinter.to_string): Change how node type is + computed. + (StdSlistPrinter.children): Use the type's _Node typedef. + (StdSlistIteratorPrinter.to_string): Likewise. + (StdRbtreeIteratorPrinter.to_string): Use the type's _Link_type + typedef. + (StdMapPrinter.children): Change how the node's type is computed. + (StdSetPrinter.children): Likewise. + (StdForwardListPrinter.children): Use the type's _Node typedef. + (Printer.add_version): New method. + (Printer.add_container): New method. + (build_libstdcxx_dictionary): Handle __7 and __cxx1998 + namespaces. + (find_type): New function. + 2012-01-27 Paolo Carlini PR libstdc++/51795 diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index 81c33c733e6..4f34733ef46 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -1,6 +1,6 @@ # Pretty-printers for libstc++. -# Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +# Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,6 +26,25 @@ try: except ImportError: _use_gdb_pp = False +# Starting with the type ORIG, search for the member type NAME. This +# handles searching upward through superclasses. This is needed to +# work around http://sourceware.org/bugzilla/show_bug.cgi?id=13615. +def find_type(orig, name): + typ = orig.strip_typedefs() + while True: + search = str(typ) + '::' + name + try: + return gdb.lookup_type(search) + except RuntimeError: + pass + # The type was not found, so try the superclass. We only need + # to check the first superclass, so we don't bother with + # anything fancier here. + field = typ.fields()[0] + if not field.is_base_class: + raise ValueError, "Cannot find type %s::%s" % (str(orig), name) + typ = field.type + class StdPointerPrinter: "Print a smart pointer of some kind" @@ -76,15 +95,8 @@ class StdListPrinter: self.val = val def children(self): - itype = self.val.type.template_argument(0) - # If the inferior program is compiled with -D_GLIBCXX_DEBUG - # some of the internal implementation details change. - if self.typename == "std::list": - nodetype = gdb.lookup_type('std::_List_node<%s>' % itype).pointer() - elif self.typename == "std::__debug::list": - nodetype = gdb.lookup_type('std::__norm::_List_node<%s>' % itype).pointer() - else: - raise ValueError, "Cannot cast list node for list printer." + nodetype = find_type(self.val.type, '_Node') + nodetype = nodetype.strip_typedefs().pointer() return self._iterator(nodetype, self.val['_M_impl']['_M_node']) def to_string(self): @@ -100,15 +112,8 @@ class StdListIteratorPrinter: self.typename = typename def to_string(self): - itype = self.val.type.template_argument(0) - # If the inferior program is compiled with -D_GLIBCXX_DEBUG - # some of the internal implementation details change. - if self.typename == "std::_List_iterator" or self.typename == "std::_List_const_iterator": - nodetype = gdb.lookup_type('std::_List_node<%s>' % itype).pointer() - elif self.typename == "std::__norm::_List_iterator" or self.typename == "std::__norm::_List_const_iterator": - nodetype = gdb.lookup_type('std::__norm::_List_node<%s>' % itype).pointer() - else: - raise ValueError, "Cannot cast list node for list iterator printer." + nodetype = find_type(self.val.type, '_Node') + nodetype = nodetype.strip_typedefs().pointer() return self.val['_M_node'].cast(nodetype).dereference()['_M_data'] class StdSlistPrinter: @@ -136,8 +141,8 @@ class StdSlistPrinter: self.val = val def children(self): - itype = self.val.type.template_argument(0) - nodetype = gdb.lookup_type('__gnu_cxx::_Slist_node<%s>' % itype).pointer() + nodetype = find_type(self.val.type, '_Node') + nodetype = nodetype.strip_typedefs().pointer() return self._iterator(nodetype, self.val) def to_string(self): @@ -152,8 +157,8 @@ class StdSlistIteratorPrinter: self.val = val def to_string(self): - itype = self.val.type.template_argument(0) - nodetype = gdb.lookup_type('__gnu_cxx::_Slist_node<%s>' % itype).pointer() + nodetype = find_type(self.val.type, '_Node') + nodetype = nodetype.strip_typedefs().pointer() return self.val['_M_node'].cast(nodetype).dereference()['_M_data'] class StdVectorPrinter: @@ -364,9 +369,8 @@ class StdRbtreeIteratorPrinter: self.val = val def to_string (self): - valuetype = self.val.type.template_argument(0) - nodetype = gdb.lookup_type('std::_Rb_tree_node < %s >' % valuetype) - nodetype = nodetype.pointer() + typename = str(self.val.type.strip_typedefs()) + '::_Link_type' + nodetype = gdb.lookup_type(typename).strip_typedefs() return self.val.cast(nodetype).dereference()['_M_value_field'] class StdDebugIteratorPrinter: @@ -415,11 +419,10 @@ class StdMapPrinter: len (RbtreeIterator (self.val))) def children (self): - keytype = self.val.type.template_argument(0).const() - valuetype = self.val.type.template_argument(1) - nodetype = gdb.lookup_type('std::_Rb_tree_node< std::pair< %s, %s > >' % (keytype, valuetype)) - nodetype = nodetype.pointer() - return self._iter (RbtreeIterator (self.val), nodetype) + rep_type = find_type(self.val.type, '_Rep_type') + node = find_type(rep_type, '_Link_type') + node = node.strip_typedefs() + return self._iter (RbtreeIterator (self.val), node) def display_hint (self): return 'map' @@ -455,9 +458,10 @@ class StdSetPrinter: len (RbtreeIterator (self.val))) def children (self): - keytype = self.val.type.template_argument(0) - nodetype = gdb.lookup_type('std::_Rb_tree_node< %s >' % keytype).pointer() - return self._iter (RbtreeIterator (self.val), nodetype) + rep_type = find_type(self.val.type, '_Rep_type') + node = find_type(rep_type, '_Link_type') + node = node.strip_typedefs() + return self._iter (RbtreeIterator (self.val), node) class StdBitsetPrinter: "Print a std::bitset" @@ -713,15 +717,8 @@ class StdForwardListPrinter: self.typename = typename def children(self): - itype = self.val.type.template_argument(0) - # If the inferior program is compiled with -D_GLIBCXX_DEBUG - # some of the internal implementation details change. - if self.typename == "std::forward_list": - nodetype = gdb.lookup_type('std::_Fwd_list_node<%s>' % itype).pointer() - elif self.typename == "std::__debug::list": - nodetype = gdb.lookup_type('std::__norm::_Fwd_list_node<%s>' % itype).pointer() - else: - raise ValueError, "Cannot cast forward_list node for forward_list printer." + nodetype = find_type(self.val.type, '_Node') + nodetype = nodetype.strip_typedefs().pointer() return self._iterator(nodetype, self.val['_M_impl']['_M_head']) def to_string(self): @@ -764,6 +761,16 @@ class Printer(object): self.subprinters.append(printer) self.lookup[name] = printer + # Add a name using _GLIBCXX_BEGIN_NAMESPACE_VERSION. + def add_version(self, base, name, function): + self.add(base + name, function) + self.add(base + '__7::' + name, function) + + # Add a name using _GLIBCXX_BEGIN_NAMESPACE_CONTAINER. + def add_container(self, base, name, function): + self.add_version(base, name, function) + self.add_version(base + '__cxx1998::', name, function) + @staticmethod def get_basic_type(type): # If it points to a reference, get the reference. @@ -813,23 +820,29 @@ def build_libstdcxx_dictionary (): libstdcxx_printer = Printer("libstdc++-v6") + # For _GLIBCXX_BEGIN_NAMESPACE_VERSION. + vers = '(__7::)?' + # For _GLIBCXX_BEGIN_NAMESPACE_CONTAINER. + container = '(__cxx1998::' + vers + ')?' + # libstdc++ objects requiring pretty-printing. # In order from: # http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01847.html - libstdcxx_printer.add('std::basic_string', StdStringPrinter) - libstdcxx_printer.add('std::bitset', StdBitsetPrinter) - libstdcxx_printer.add('std::deque', StdDequePrinter) - libstdcxx_printer.add('std::list', StdListPrinter) - libstdcxx_printer.add('std::map', StdMapPrinter) - libstdcxx_printer.add('std::multimap', StdMapPrinter) - libstdcxx_printer.add('std::multiset', StdSetPrinter) - libstdcxx_printer.add('std::priority_queue', StdStackOrQueuePrinter) - libstdcxx_printer.add('std::queue', StdStackOrQueuePrinter) - libstdcxx_printer.add('std::tuple', StdTuplePrinter) - libstdcxx_printer.add('std::set', StdSetPrinter) - libstdcxx_printer.add('std::stack', StdStackOrQueuePrinter) - libstdcxx_printer.add('std::unique_ptr', UniquePointerPrinter) - libstdcxx_printer.add('std::vector', StdVectorPrinter) + libstdcxx_printer.add_version('std::', 'basic_string', StdStringPrinter) + libstdcxx_printer.add_container('std::', 'bitset', StdBitsetPrinter) + libstdcxx_printer.add_container('std::', 'deque', StdDequePrinter) + libstdcxx_printer.add_container('std::', 'list', StdListPrinter) + libstdcxx_printer.add_container('std::', 'map', StdMapPrinter) + libstdcxx_printer.add_container('std::', 'multimap', StdMapPrinter) + libstdcxx_printer.add_container('std::', 'multiset', StdSetPrinter) + libstdcxx_printer.add_version('std::', 'priority_queue', + StdStackOrQueuePrinter) + libstdcxx_printer.add_version('std::', 'queue', StdStackOrQueuePrinter) + libstdcxx_printer.add_version('std::', 'tuple', StdTuplePrinter) + libstdcxx_printer.add_container('std::', 'set', StdSetPrinter) + libstdcxx_printer.add_version('std::', 'stack', StdStackOrQueuePrinter) + libstdcxx_printer.add_version('std::', 'unique_ptr', UniquePointerPrinter) + libstdcxx_printer.add_container('std::', 'vector', StdVectorPrinter) # vector # Printer registrations for classes compiled with -D_GLIBCXX_DEBUG. @@ -849,22 +862,29 @@ def build_libstdcxx_dictionary (): # These are the TR1 and C++0x printers. # For array - the default GDB pretty-printer seems reasonable. - libstdcxx_printer.add('std::shared_ptr', StdPointerPrinter) - libstdcxx_printer.add('std::weak_ptr', StdPointerPrinter) - libstdcxx_printer.add('std::unordered_map', Tr1UnorderedMapPrinter) - libstdcxx_printer.add('std::unordered_set', Tr1UnorderedSetPrinter) - libstdcxx_printer.add('std::unordered_multimap', Tr1UnorderedMapPrinter) - libstdcxx_printer.add('std::unordered_multiset', Tr1UnorderedSetPrinter) - libstdcxx_printer.add('std::forward_list', StdForwardListPrinter) + libstdcxx_printer.add_version('std::', 'shared_ptr', StdPointerPrinter) + libstdcxx_printer.add_version('std::', 'weak_ptr', StdPointerPrinter) + libstdcxx_printer.add_container('std::', 'unordered_map', + Tr1UnorderedMapPrinter) + libstdcxx_printer.add_container('std::', 'unordered_set', + Tr1UnorderedSetPrinter) + libstdcxx_printer.add_container('std::', 'unordered_multimap', + Tr1UnorderedMapPrinter) + libstdcxx_printer.add_container('std::', 'unordered_multiset', + Tr1UnorderedSetPrinter) + libstdcxx_printer.add_container('std::', 'forward_list', + StdForwardListPrinter) - libstdcxx_printer.add('std::tr1::shared_ptr', StdPointerPrinter) - libstdcxx_printer.add('std::tr1::weak_ptr', StdPointerPrinter) - libstdcxx_printer.add('std::tr1::unordered_map', Tr1UnorderedMapPrinter) - libstdcxx_printer.add('std::tr1::unordered_set', Tr1UnorderedSetPrinter) - libstdcxx_printer.add('std::tr1::unordered_multimap', - Tr1UnorderedMapPrinter) - libstdcxx_printer.add('std::tr1::unordered_multiset', - Tr1UnorderedSetPrinter) + libstdcxx_printer.add_version('std::tr1::', 'shared_ptr', StdPointerPrinter) + libstdcxx_printer.add_version('std::tr1::', 'weak_ptr', StdPointerPrinter) + libstdcxx_printer.add_version('std::tr1::', 'unordered_map', + Tr1UnorderedMapPrinter) + libstdcxx_printer.add_version('std::tr1::', 'unordered_set', + Tr1UnorderedSetPrinter) + libstdcxx_printer.add_version('std::tr1::', 'unordered_multimap', + Tr1UnorderedMapPrinter) + libstdcxx_printer.add_version('std::tr1::', 'unordered_multiset', + Tr1UnorderedSetPrinter) # These are the C++0x printer registrations for -D_GLIBCXX_DEBUG cases. # The tr1 namespace printers do not seem to have any debug @@ -882,25 +902,27 @@ def build_libstdcxx_dictionary (): # Extensions. - libstdcxx_printer.add('__gnu_cxx::slist', StdSlistPrinter) + libstdcxx_printer.add_version('__gnu_cxx::', 'slist', StdSlistPrinter) if True: # These shouldn't be necessary, if GDB "print *i" worked. # But it often doesn't, so here they are. - libstdcxx_printer.add('std::_List_iterator', StdListIteratorPrinter) - libstdcxx_printer.add('std::_List_const_iterator', - StdListIteratorPrinter) - libstdcxx_printer.add('std::_Rb_tree_iterator', - StdRbtreeIteratorPrinter) - libstdcxx_printer.add('std::_Rb_tree_const_iterator', - StdRbtreeIteratorPrinter) - libstdcxx_printer.add('std::_Deque_iterator', StdDequeIteratorPrinter) - libstdcxx_printer.add('std::_Deque_const_iterator', - StdDequeIteratorPrinter) - libstdcxx_printer.add('__gnu_cxx::__normal_iterator', - StdVectorIteratorPrinter) - libstdcxx_printer.add('__gnu_cxx::_Slist_iterator', - StdSlistIteratorPrinter) + libstdcxx_printer.add_container('std::', '_List_iterator', + StdListIteratorPrinter) + libstdcxx_printer.add_container('std::', '_List_const_iterator', + StdListIteratorPrinter) + libstdcxx_printer.add_version('std::', '_Rb_tree_iterator', + StdRbtreeIteratorPrinter) + libstdcxx_printer.add_version('std::', '_Rb_tree_const_iterator', + StdRbtreeIteratorPrinter) + libstdcxx_printer.add_container('std::', '_Deque_iterator', + StdDequeIteratorPrinter) + libstdcxx_printer.add_container('std::', '_Deque_const_iterator', + StdDequeIteratorPrinter) + libstdcxx_printer.add_version('__gnu_cxx::', '__normal_iterator', + StdVectorIteratorPrinter) + libstdcxx_printer.add_version('__gnu_cxx::', '_Slist_iterator', + StdSlistIteratorPrinter) # Debug (compiled with -D_GLIBCXX_DEBUG) printer # registrations. The Rb_tree debug iterator when unwrapped diff --git a/libstdc++-v3/testsuite/lib/gdb-test.exp b/libstdc++-v3/testsuite/lib/gdb-test.exp index 032b66c7d2a..b9d4742d393 100644 --- a/libstdc++-v3/testsuite/lib/gdb-test.exp +++ b/libstdc++-v3/testsuite/lib/gdb-test.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2011 Free Software Foundation, Inc. +# Copyright (C) 2009, 2011, 2012 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -55,11 +55,20 @@ proc get_line_number {filename marker} { proc note-test {var result} { global gdb_tests - lappend gdb_tests $var $result + lappend gdb_tests $var $result 0 +} + +# A test that uses a regular expression. This is like note-test, but +# the result is a regular expression that is matched against the +# output. +proc regexp-test {var result} { + global gdb_tests + + lappend gdb_tests $var $result 1 } # Utility for testing variable values using gdb, invoked via dg-final. -# Tests all tests indicated by note-test. +# Tests all tests indicated by note-test and regexp-test. # # Argument 0 is the marker on which to put a breakpoint # Argument 2 handles expected failures and the like @@ -100,11 +109,12 @@ proc gdb-test { marker {selector {}} } { puts $fd "run" set count 0 - foreach {var result} $gdb_tests { + foreach {var result is_regexp} $gdb_tests { puts $fd "print $var" incr count set gdb_var($count) $var set gdb_expected($count) $result + set gdb_is_regexp($count) $is_regexp } set gdb_tests {} @@ -120,9 +130,18 @@ proc gdb-test { marker {selector {}} } { remote_expect target [timeout_value] { -re {^\$([0-9]+) = ([^\n\r]*)[\n\r]+} { + send_log "got: $expect_out(buffer)" + set num $expect_out(1,string) set first $expect_out(2,string) - if { ![string compare $first $gdb_expected($num)] } { + + if {$gdb_is_regexp($num)} { + set match [regexp -- $gdb_expected($num) $first] + } else { + set match [expr {![string compare $first $gdb_expected($num)]}] + } + + if {$match} { pass "$testname print $gdb_var($num)" } else { fail "$testname print $gdb_var($num)" @@ -145,7 +164,7 @@ proc gdb-test { marker {selector {}} } { } -re {^[^$][^\n\r]*[\n\r]+} { - verbose "skipping: $expect_out(buffer)" + send_log "skipping: $expect_out(buffer)" exp_continue } diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/48362.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/48362.cc index e6e4af9fd83..97607f1b884 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/48362.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/48362.cc @@ -1,7 +1,7 @@ // { dg-do run } // { dg-options "-g -std=gnu++11 -O0" } -// Copyright (C) 2011 Free Software Foundation, Inc. +// Copyright (C) 2011, 2012 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -25,10 +25,10 @@ int main() { std::tuple<> t1; -// { dg-final { note-test t1 {empty std::tuple} } } +// { dg-final { regexp-test t1 {empty std::(__7::)?tuple} } } std::tuple> t2{ "Johnny", 5, {} }; -// { dg-final { note-test t2 {std::tuple containing = {[1] = "Johnny", [2] = 5, [3] = {> = empty std::tuple, }}} } } +// { dg-final { regexp-test t2 {std::(__7::)?tuple containing = {\[1\] = "Johnny", \[2\] = 5, \[3\] = {> = empty std::(__7::)?tuple, }}} } } return 0; // Mark SPOT } diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc new file mode 100644 index 00000000000..bdc8eb974cf --- /dev/null +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc @@ -0,0 +1,92 @@ +// { dg-do run } +// { dg-options "-g -O0" } + +// Copyright (C) 2011, 2012 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#define _GLIBCXX_DEBUG + +#include +#include +#include +#include +#include +#include +#include +#include + +int +main() +{ + std::string tem; + std::string str = "zardoz"; +// { dg-final { note-test str "\"zardoz\"" } } + + std::bitset<10> bs; + bs[0] = 1; + bs[5] = 1; + bs[7] = 1; +// { dg-final { note-test bs {std::__debug::bitset = {[0] = 1, [5] = 1, [7] = 1}} } } + + std::deque deq; + deq.push_back("one"); + deq.push_back("two"); +// { dg-final { note-test deq {std::__debug::deque with 2 elements = {"one", "two"}} } } + + std::deque::iterator deqiter = deq.begin(); +// { dg-final { note-test deqiter {"one"} } } + + std::list lst; + lst.push_back("one"); + lst.push_back("two"); +// { dg-final { note-test lst {std::__debug::list = {[0] = "one", [1] = "two"}} } } + + std::list::iterator lstiter = lst.begin(); + tem = *lstiter; +// { dg-final { note-test lstiter {"one"}} } + + std::list::const_iterator lstciter = lst.begin(); + tem = *lstciter; +// { dg-final { note-test lstciter {"one"}} } + + std::map mp; + mp["zardoz"] = 23; +// { dg-final { note-test mp {std::__debug::map with 1 elements = {["zardoz"] = 23}} } } + + std::map::iterator mpiter = mp.begin(); +// { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } } + + std::set sp; + sp.insert("clownfish"); + sp.insert("barrel"); +// { dg-final { note-test sp {std::__debug::set with 2 elements = {[0] = "barrel", [1] = "clownfish"}} } } + + std::set::const_iterator spciter = sp.begin(); +// { dg-final { note-test spciter {"barrel"} } } + + __gnu_cxx::slist sll; + sll.push_front(23); + sll.push_front(47); +// { dg-final { note-test sll {__gnu_cxx::slist = {[0] = 47, [1] = 23}} } } + + __gnu_cxx::slist::iterator slliter = sll.begin(); +// { dg-final { note-test slliter {47} } } + + return 0; // Mark SPOT +} + +// { dg-final { gdb-test SPOT } } diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc index 2cccb622355..09badbbfe28 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc @@ -1,7 +1,9 @@ -// { dg-do run } -// { dg-options "-g" } +// If you modify this, please update debug.cc as well. -// Copyright (C) 2011 Free Software Foundation, Inc. +// { dg-do run } +// { dg-options "-g -O0" } + +// Copyright (C) 2011, 2012 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -24,34 +26,13 @@ #include #include #include - -template -void -placeholder(const T &s) -{ - std::cout << s; -} - -template -void -placeholder(const std::pair &s) -{ - std::cout << s.first; -} - -template -void -use(const T &container) -{ - for (typename T::const_iterator i = container.begin(); - i != container.end(); - ++i) - placeholder(*i); -} +#include +#include int main() { + std::string tem; std::string str = "zardoz"; // { dg-final { note-test str "\"zardoz\"" } } @@ -66,22 +47,46 @@ main() deq.push_back("two"); // { dg-final { note-test deq {std::deque with 2 elements = {"one", "two"}} } } + std::deque::iterator deqiter = deq.begin(); +// { dg-final { note-test deqiter {"one"} } } + std::list lst; lst.push_back("one"); lst.push_back("two"); // { dg-final { note-test lst {std::list = {[0] = "one", [1] = "two"}} } } + std::list::iterator lstiter = lst.begin(); + tem = *lstiter; +// { dg-final { note-test lstiter {"one"}} } + + std::list::const_iterator lstciter = lst.begin(); + tem = *lstciter; +// { dg-final { note-test lstciter {"one"}} } + std::map mp; mp["zardoz"] = 23; // { dg-final { note-test mp {std::map with 1 elements = {["zardoz"] = 23}} } } - placeholder(str); // Mark SPOT - std::cout << bs; - use(deq); - use(lst); - use(mp); + std::map::iterator mpiter = mp.begin(); +// { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } } - return 0; + std::set sp; + sp.insert("clownfish"); + sp.insert("barrel"); +// { dg-final { note-test sp {std::set with 2 elements = {[0] = "barrel", [1] = "clownfish"}} } } + + std::set::const_iterator spciter = sp.begin(); +// { dg-final { note-test spciter {"barrel"} } } + + __gnu_cxx::slist sll; + sll.push_front(23); + sll.push_front(47); +// { dg-final { note-test sll {__gnu_cxx::slist = {[0] = 47, [1] = 23}} } } + + __gnu_cxx::slist::iterator slliter = sll.begin(); +// { dg-final { note-test slliter {47} } } + + return 0; // Mark SPOT } // { dg-final { gdb-test SPOT } }