Commit 3efe2bf7 by Tom Tromey Committed by Tom Tromey

re PR libstdc++/51649 (pretty printers don't handle std::__7:: namespace)

	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.

From-SVN: r183732
parent e799d447
2012-01-30 Tom Tromey <tromey@redhat.com>
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 <paolo.carlini@oracle.com>
PR libstdc++/51795
......
# 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
}
......
// { 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<std::string, int, std::tuple<>> t2{ "Johnny", 5, {} };
// { dg-final { note-test t2 {std::tuple containing = {[1] = "Johnny", [2] = 5, [3] = {<std::tuple<>> = empty std::tuple, <No data fields>}}} } }
// { dg-final { regexp-test t2 {std::(__7::)?tuple containing = {\[1\] = "Johnny", \[2\] = 5, \[3\] = {<std::(__7::)?tuple<>> = empty std::(__7::)?tuple, <No data fields>}}} } }
return 0; // Mark SPOT
}
......
// { 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
// <http://www.gnu.org/licenses/>.
#define _GLIBCXX_DEBUG
#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::__debug::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::__debug::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::__debug::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::__debug::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::__debug::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 } }
// If you modify this, please update debug.cc as well.
// { dg-do run }
// { dg-options "-g" }
// { dg-options "-g -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
......@@ -24,34 +26,13 @@
#include <iostream>
#include <list>
#include <map>
template<class T>
void
placeholder(const T &s)
{
std::cout << s;
}
template<class T, class S>
void
placeholder(const std::pair<T,S> &s)
{
std::cout << s.first;
}
template<class T>
void
use(const T &container)
{
for (typename T::const_iterator i = container.begin();
i != container.end();
++i)
placeholder(*i);
}
#include <set>
#include <ext/slist>
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<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}} } }
placeholder(str); // Mark SPOT
std::cout << bs;
use(deq);
use(lst);
use(mp);
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;
return 0; // Mark SPOT
}
// { dg-final { gdb-test SPOT } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment