summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/libstdc++-prettyprinters
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2014-05-02 17:01:30 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2014-05-02 17:01:30 +0100
commit047f1cec7fe69c13ed55fcdd005ace93397f0a95 (patch)
tree58fd11f14c1d56ddb2194ca1ae6b3aad93daf788 /libstdc++-v3/testsuite/libstdc++-prettyprinters
parente13b3dfdeea77ac62a65c4afc710190ef413c9f8 (diff)
downloadgcc-047f1cec7fe69c13ed55fcdd005ace93397f0a95.tar.gz
re PR libstdc++/59476 (gdb pretty-printer cannot print C++11 _Rb_tree_iterator)
PR libstdc++/59476 * python/libstdcxx/v6/printers.py (get_value_from_Rb_tree_node): New function to handle both C++03 and C++11 _Rb_tree_node implementations. (StdRbtreeIteratorPrinter, StdMapPrinter, StdSetPrinter): Use it. * testsuite/libstdc++-prettyprinters/simple.cc: Update comment to refer to... * testsuite/libstdc++-prettyprinters/simple11.cc: New. From-SVN: r210008
Diffstat (limited to 'libstdc++-v3/testsuite/libstdc++-prettyprinters')
-rw-r--r--libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc2
-rw-r--r--libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc92
2 files changed, 93 insertions, 1 deletions
diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc
index 66ae8f70e56..030207aa67c 100644
--- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc
+++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc
@@ -1,4 +1,4 @@
-// If you modify this, please update debug.cc as well.
+// If you modify this, please update simple11.cc and debug.cc as well.
// { dg-do run }
// { dg-options "-g -O0" }
diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc
new file mode 100644
index 00000000000..e94bea6ec84
--- /dev/null
+++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc
@@ -0,0 +1,92 @@
+// If you modify this, please update simple.cc and debug.cc as well.
+
+// { dg-do run }
+// { dg-options "-g -O0 -std=gnu++11" }
+
+// Copyright (C) 2011-2014 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
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+#include <deque>
+#include <bitset>
+#include <iostream>
+#include <list>
+#include <map>
+#include <set>
+#include <ext/slist>
+
+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::bitset = {[0] = 1, [5] = 1, [7] = 1}} } }
+
+ std::deque<std::string> deq;
+ deq.push_back("one");
+ deq.push_back("two");
+// { dg-final { note-test deq {std::deque with 2 elements = {"one", "two"}} } }
+
+ std::deque<std::string>::iterator deqiter = deq.begin();
+// { dg-final { note-test deqiter {"one"} } }
+
+ std::list<std::string> lst;
+ lst.push_back("one");
+ lst.push_back("two");
+// { dg-final { note-test lst {std::list = {[0] = "one", [1] = "two"}} } }
+
+ std::list<std::string>::iterator lstiter = lst.begin();
+ tem = *lstiter;
+// { dg-final { note-test lstiter {"one"}} }
+
+ std::list<std::string>::const_iterator lstciter = lst.begin();
+ tem = *lstciter;
+// { dg-final { note-test lstciter {"one"}} }
+
+ std::map<std::string, int> mp;
+ mp["zardoz"] = 23;
+// { dg-final { note-test mp {std::map with 1 elements = {["zardoz"] = 23}} } }
+
+ std::map<std::string, int>::iterator mpiter = mp.begin();
+// { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }
+
+ std::set<std::string> sp;
+ sp.insert("clownfish");
+ sp.insert("barrel");
+// { dg-final { note-test sp {std::set with 2 elements = {[0] = "barrel", [1] = "clownfish"}} } }
+
+ std::set<std::string>::const_iterator spciter = sp.begin();
+// { dg-final { note-test spciter {"barrel"} } }
+
+ __gnu_cxx::slist<int> sll;
+ sll.push_front(23);
+ sll.push_front(47);
+// { dg-final { note-test sll {__gnu_cxx::slist = {[0] = 47, [1] = 23}} } }
+
+ __gnu_cxx::slist<int>::iterator slliter = sll.begin();
+// { dg-final { note-test slliter {47} } }
+
+ return 0; // Mark SPOT
+}
+
+// { dg-final { gdb-test SPOT } }