From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2100) id DDE483947C0B; Tue, 18 Aug 2020 01:35:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDE483947C0B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597714534; bh=giQMOI+lh6gZilkehpLc98DimKlpC3F1CcAwiFleHpI=; h=From:To:Subject:Date:From; b=PH/EDgjplIrTSdelSStb7x/NOVNl7jfcsvGDe1QxDXwzjxKnK7761kS8J5HyVS9OF McUjSi8MjjPgkrzQH9sPaJifb3iNtWYm+pv81dD0B/IG981BIXsCtrYiU6hNrkWASK IvzGcc3K7mLoOXYdovA6bUSVq9rL/lkUP/RA/8lg= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Giuliano Belinassi To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/users/giulianob/heads/autopar_rebase2)] libstdc++: Fix compatibility support in unique_ptr pretty printer X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/users/giulianob/heads/autopar_rebase2 X-Git-Oldrev: 74cbd48dcd928de8cc60fae9ca345514f074c58a X-Git-Newrev: cd92527c2e7cdf7594d6b3b48dd77017888b04f0 Message-Id: <20200818013534.DDE483947C0B@sourceware.org> Date: Tue, 18 Aug 2020 01:35:34 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Aug 2020 01:35:35 -0000 https://gcc.gnu.org/g:cd92527c2e7cdf7594d6b3b48dd77017888b04f0 commit cd92527c2e7cdf7594d6b3b48dd77017888b04f0 Author: Jonathan Wakely Date: Mon Aug 10 18:44:06 2020 +0100 libstdc++: Fix compatibility support in unique_ptr pretty printer The support for the old std::unique_ptr implementation was failing, because it tried to work on a typedef instead of the underlying type. The test supposed to verify the support worked wasn't using a typedef, so didn't notice the problem. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (UniquePointerPrinter.__init__): Use gdb.Type.strip_typedefs(). * testsuite/libstdc++-prettyprinters/compat.cc: Use a typedef in the emulated old type. Diff: --- libstdc++-v3/python/libstdcxx/v6/printers.py | 6 +++--- libstdc++-v3/testsuite/libstdc++-prettyprinters/compat.cc | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index 0bf307b8e5f..c0f061f79c1 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -245,7 +245,7 @@ class UniquePointerPrinter: def __init__ (self, typename, val): self.val = val - impl_type = val.type.fields()[0].type.tag + impl_type = val.type.fields()[0].type.strip_typedefs() # Check for new implementations first: if is_specialization_of(impl_type, '__uniq_ptr_data') \ or is_specialization_of(impl_type, '__uniq_ptr_impl'): @@ -253,7 +253,7 @@ class UniquePointerPrinter: elif is_specialization_of(impl_type, 'tuple'): tuple_member = val['_M_t'] else: - raise ValueError("Unsupported implementation for unique_ptr: %s" % impl_type) + raise ValueError("Unsupported implementation for unique_ptr: %s" % str(impl_type)) tuple_impl_type = tuple_member.type.fields()[0].type # _Tuple_impl tuple_head_type = tuple_impl_type.fields()[1].type # _Head_base head_field = tuple_head_type.fields()[0] @@ -262,7 +262,7 @@ class UniquePointerPrinter: elif head_field.is_base_class: self.pointer = tuple_member.cast(head_field.type) else: - raise ValueError("Unsupported implementation for tuple in unique_ptr: %s" % impl_type) + raise ValueError("Unsupported implementation for tuple in unique_ptr: %s" % str(impl_type)) def children (self): return SmartPtrIterator(self.pointer) diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/compat.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/compat.cc index f1c3b599634..c681becf8b9 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/compat.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/compat.cc @@ -53,7 +53,9 @@ namespace std { unique_ptr(T* p) { _M_t._M_head_impl = p; } - tuple _M_t; + using __tuple_type = tuple; + + __tuple_type _M_t; }; // Old representation of std::optional, before GCC 9