From patchwork Thu Dec 1 21:51:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Fran=C3=A7ois_Dumont?= X-Patchwork-Id: 86158 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp904074qgi; Thu, 1 Dec 2016 13:52:16 -0800 (PST) X-Received: by 10.99.159.26 with SMTP id g26mr73096471pge.62.1480629136134; Thu, 01 Dec 2016 13:52:16 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id v35si1775464plg.80.2016.12.01.13.52.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Dec 2016 13:52:16 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-443262-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-443262-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-443262-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:references:cc:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=s1WGZdIlYwjX+m0LI RHREkEtp1ULGHRWianWXs7bL7E2n0AOh/hf5BFwEI6BxHfr+EvOz9y8HroFVwjYu cq24/JZ4rhhh+DrumO00uxAbhiL99A3iBB0oHiXc0iJNqnjW0i0oDYws9JTt3Sby rnSs+s3Iz7QlW6U/fPgBfisRv8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:references:cc:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=+8Au41P9slPXEFtDQzT3ObX m2A4=; b=kXn61LsW1IsHZjM4Mx/vSuqtbmaXqrPfhqKTT35sOMAPVQHZGatJB/H SZmquFlictLn/cYFUlZN65/hInhBhr+n6g9p/LDaDr+DMfHjLswZLU93I0//LVpZ nt/I2UeDQ+gMvfF5LTDQPSX8oeqQ7PlS2eilSfbcmhbGXe+g9QoU= Received: (qmail 85212 invoked by alias); 1 Dec 2016 21:51:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 85192 invoked by uid 89); 1 Dec 2016 21:51:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_05, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=preferable, holder, 1487, tpl X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-wm0-f41.google.com Received: from mail-wm0-f41.google.com (HELO mail-wm0-f41.google.com) (74.125.82.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Dec 2016 21:51:25 +0000 Received: by mail-wm0-f41.google.com with SMTP id f82so261500191wmf.1; Thu, 01 Dec 2016 13:51:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to; bh=PVpNmXSoL0bJoNijr59MyEFsIDRvrJcARQ1rg5Leaws=; b=MBal1ifhVp3PD7hBuJHOB8EABO8inBbwolXIyO1ShI30/h4VWGk02iuTVwOw2SBJJ3 NGIqb386XIEremVTnyZgqD82uCXi4N9Dwjeoodh/kEG7ug4Vfkq3+78lr72haridkH1s q5NjBuGr+VQ4XX1CHeTm9g8gP0Km7KINaJ82ExDBEpeqY6kcouJr42Il439nlJzhzAlN ALIyJwA1fvVnVNYzLEbcmSr+2L4t2xcQckk2s7mef1Q744v46pNvi/7SrasCs4Gm0oq5 7j28ujCcePOBzagFl502zxZcA4w4J0IKKABwXtHlC5E9yWtpMWA9Gwl6lhw7yQ9zMhFY LTjQ== X-Gm-Message-State: AKaTC02WS6q47VmDf/Cdhm6jzua0FGBpXzZrNE3QZIzAQ4ZFX6fGo003ke6wlZIEFeFf5g== X-Received: by 10.28.227.215 with SMTP id a206mr38578306wmh.84.1480629083425; Thu, 01 Dec 2016 13:51:23 -0800 (PST) Received: from [192.168.0.23] (arf62-1-82-237-250-248.fbx.proxad.net. [82.237.250.248]) by smtp.googlemail.com with ESMTPSA id c187sm2916727wmd.13.2016.12.01.13.51.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Dec 2016 13:51:22 -0800 (PST) From: =?UTF-8?Q?Fran=c3=a7ois_Dumont?= Subject: Re: Pretty printers for versioned namespace To: Jonathan Wakely References: <37f043c2-5022-feb2-598b-5cb8ba11d762@gmail.com> <20161129201709.GL3301@redhat.com> Cc: "libstdc++@gcc.gnu.org" , gcc-patches Message-ID: <71a8120b-494a-c074-bb13-1ddfa560fdf2@gmail.com> Date: Thu, 1 Dec 2016 22:51:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161129201709.GL3301@redhat.com> On 29/11/2016 21:17, Jonathan Wakely wrote: > On 28/11/16 22:19 +0100, François Dumont wrote: >> Hi >> >> Here is a patch to fix pretty printers when versioned namespace is >> activated. >> >> You will see that I have hesitated in making the fix independant >> of the version being used. In source files you will find (__7::)? >> patterns while in xmethods.py I chose (__\d+::)? making it ready for >> __8 and forward. Do you want to generalize one option ? If so which >> one ? > > I don't really mind, but I note that the point of the path > libstdcxx/v6/printers.py was that we'd have different printers for v7, > v8 etc. ... I think it's simpler to keep everything in one place > though. Ok, I think the folder v6 depends more on a potential gdb api change. >> At the moment version namespace is visible within gdb, it displays >> for instance 'std::__7::string'. I am pretty sure we could hide it, >> is it preferable ? I would need some time to do so as I am neither a >> python nor regex expert. > > It's fine to display it. > >> I am not fully happy with the replication in printers.py of >> StdRbtreeIteratorPrinter and >> StdExpAnyPrinter(SingleObjContainerPrinter in respectively >> StdVersionedRbtreeIteratorPrinter and >> StdExpVerAnyPrinter(SingleObjContainerPrinter just to adapt 2 lines >> where regex is not an option. We could surely keep only one and pass >> it '' or '__7'. But as I said I am not a python expert so any help >> would be appreciated. > > We definitely want to avoid that duplication. For > StdRbtreeIteratorPrinter you can just look at 'typename' and see > whether it starts with "std::__7" or not. If it does, you need to lookup > std::__7::_Rb_tree_node<...>, otherwise you need to lookup > std::_Rb_tree_node<...> instead. > > For StdExpAnyPrinter just do two replacements: first replace > std::string with the result of gdb.lookup_type('std::string') and then > replace std::__7::string with the result of looking that up. Are you > sure that's even needed though? Does std::__7::string actually appear > in the manager function's name? I would expect it to appear as > std::__7::basic_string, > std::__7::allocator > > > which doesn't need to be expanded anyway. So I think you can just > remove your StdExpVerAnyPrinter. We needed the StdExpVerAnyPrinter just because of the loopkup for 'std::string' which has to be 'std::__7::string'. But I used similar technique exposed previously to get rid of it. So here is the simplified version I plan to test without versioned namespace. François diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index bad42b4..a7c92a6 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -36,6 +36,8 @@ import sys # We probably can't do much about this until this GDB PR is addressed: # +vers_nsp = '__7::' + if sys.version_info[0] > 2: ### Python 3 stuff Iterator = object @@ -127,9 +129,9 @@ class UniquePointerPrinter: def to_string (self): impl_type = self.val.type.fields()[0].type.tag - if impl_type.startswith('std::__uniq_ptr_impl<'): # New implementation + if re.match('^std::(' + vers_nsp + ')?__uniq_ptr_impl<.*>$', impl_type): # New implementation v = self.val['_M_t']['_M_t']['_M_head_impl'] - elif impl_type.startswith('std::tuple<'): + elif re.match('^std::(' + vers_nsp + ')?tuple<.*>$', impl_type): v = self.val['_M_t']['_M_head_impl'] else: raise ValueError("Unsupported implementation for unique_ptr: %s" % self.val.type.fields()[0].type.tag) @@ -485,7 +487,10 @@ class StdRbtreeIteratorPrinter: def __init__ (self, typename, val): self.val = val valtype = self.val.type.template_argument(0).strip_typedefs() - nodetype = gdb.lookup_type('std::_Rb_tree_node<' + str(valtype) + '>') + if typename.startswith('std::' + vers_nsp): + nodetype = gdb.lookup_type('std::' + vers_nsp + '_Rb_tree_node<' + str(valtype) + '>') + else: + nodetype = gdb.lookup_type('std::_Rb_tree_node<' + str(valtype) + '>') self.link_type = nodetype.strip_typedefs().pointer() def to_string (self): @@ -927,7 +932,6 @@ class SingleObjContainerPrinter(object): return self.visualizer.display_hint () return self.hint - class StdExpAnyPrinter(SingleObjContainerPrinter): "Print a std::any or std::experimental::any" @@ -948,7 +952,11 @@ class StdExpAnyPrinter(SingleObjContainerPrinter): raise ValueError("Unknown manager function in %s" % self.typename) # FIXME need to expand 'std::string' so that gdb.lookup_type works - mgrname = re.sub("std::string(?!\w)", str(gdb.lookup_type('std::string').strip_typedefs()), m.group(1)) + if re.match('std::(experimental::)?' + vers_nsp + '.*$', self.typename): + strt = gdb.lookup_type('std::' + vers_nsp + 'string') + else: + strt = gdb.lookup_type('std::string') + mgrname = re.sub("std::string(?!\w)", str(strt.strip_typedefs()), m.group(1)) mgrtype = gdb.lookup_type(mgrname) self.contained_type = mgrtype.template_argument(0) valptr = None @@ -1031,7 +1039,7 @@ class StdNodeHandlePrinter(SingleObjContainerPrinter): def __init__(self, typename, val): self.value_type = val.type.template_argument(1) nodetype = val.type.template_argument(2).template_argument(0) - self.is_rb_tree_node = nodetype.name.startswith('std::_Rb_tree_node') + self.is_rb_tree_node = re.match('^std::(' + vers_nsp + ')?_Rb_tree_node.*$', nodetype.name) self.is_map_node = val.type.template_argument(0) != self.value_type nodeptr = val['_M_ptr'] if nodeptr: @@ -1176,7 +1184,7 @@ class Printer(object): # 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) + self.add(base + vers_nsp + name, function) # Add a name using _GLIBCXX_BEGIN_NAMESPACE_CONTAINER. def add_container(self, base, name, function): @@ -1311,7 +1319,7 @@ def register_type_printers(obj): if not _use_type_printing: return - for pfx in ('', 'w'): + for pfx in ('', 'w', vers_nsp, vers_nsp + 'w'): add_one_type_printer(obj, 'basic_string', pfx + 'string') add_one_type_printer(obj, 'basic_string_view', pfx + 'string_view') add_one_type_printer(obj, 'basic_ios', pfx + 'ios') @@ -1342,70 +1350,70 @@ def register_type_printers(obj): add_one_type_printer(obj, 'regex_token_iterator', pfx + 'sregex_token_iterator') - # Note that we can't have a printer for std::wstreampos, because - # it shares the same underlying type as std::streampos. - add_one_type_printer(obj, 'fpos', 'streampos') - add_one_type_printer(obj, 'basic_string', 'u16string') - add_one_type_printer(obj, 'basic_string', 'u32string') - - add_one_type_printer(obj, 'basic_string_view', 'u16string_view') - add_one_type_printer(obj, 'basic_string_view', 'u32string_view') - - for dur in ('nanoseconds', 'microseconds', 'milliseconds', - 'seconds', 'minutes', 'hours'): - add_one_type_printer(obj, 'duration', dur) - - add_one_type_printer(obj, 'linear_congruential_engine', 'minstd_rand0') - add_one_type_printer(obj, 'linear_congruential_engine', 'minstd_rand') - add_one_type_printer(obj, 'mersenne_twister_engine', 'mt19937') - add_one_type_printer(obj, 'mersenne_twister_engine', 'mt19937_64') - add_one_type_printer(obj, 'subtract_with_carry_engine', 'ranlux24_base') - add_one_type_printer(obj, 'subtract_with_carry_engine', 'ranlux48_base') - add_one_type_printer(obj, 'discard_block_engine', 'ranlux24') - add_one_type_printer(obj, 'discard_block_engine', 'ranlux48') - add_one_type_printer(obj, 'shuffle_order_engine', 'knuth_b') - - # Do not show defaulted template arguments in class templates - add_one_template_type_printer(obj, 'unique_ptr', - 'unique_ptr<(.*), std::default_delete<\\1 ?> >', - 'unique_ptr<{1}>') - - add_one_template_type_printer(obj, 'deque', - 'deque<(.*), std::allocator<\\1 ?> >', - 'deque<{1}>') - add_one_template_type_printer(obj, 'forward_list', - 'forward_list<(.*), std::allocator<\\1 ?> >', - 'forward_list<{1}>') - add_one_template_type_printer(obj, 'list', - 'list<(.*), std::allocator<\\1 ?> >', - 'list<{1}>') - add_one_template_type_printer(obj, 'vector', - 'vector<(.*), std::allocator<\\1 ?> >', - 'vector<{1}>') - add_one_template_type_printer(obj, 'map', - 'map<(.*), (.*), std::less<\\1 ?>, std::allocator > >', - 'map<{1}, {2}>') - add_one_template_type_printer(obj, 'multimap', - 'multimap<(.*), (.*), std::less<\\1 ?>, std::allocator > >', - 'multimap<{1}, {2}>') - add_one_template_type_printer(obj, 'set', - 'set<(.*), std::less<\\1 ?>, std::allocator<\\1 ?> >', - 'set<{1}>') - add_one_template_type_printer(obj, 'multiset', - 'multiset<(.*), std::less<\\1 ?>, std::allocator<\\1 ?> >', - 'multiset<{1}>') - add_one_template_type_printer(obj, 'unordered_map', - 'unordered_map<(.*), (.*), std::hash<\\1 ?>, std::equal_to<\\1 ?>, std::allocator > >', - 'unordered_map<{1}, {2}>') - add_one_template_type_printer(obj, 'unordered_multimap', - 'unordered_multimap<(.*), (.*), std::hash<\\1 ?>, std::equal_to<\\1 ?>, std::allocator > >', - 'unordered_multimap<{1}, {2}>') - add_one_template_type_printer(obj, 'unordered_set', - 'unordered_set<(.*), std::hash<\\1 ?>, std::equal_to<\\1 ?>, std::allocator<\\1 ?> >', - 'unordered_set<{1}>') - add_one_template_type_printer(obj, 'unordered_multiset', - 'unordered_multiset<(.*), std::hash<\\1 ?>, std::equal_to<\\1 ?>, std::allocator<\\1 ?> >', - 'unordered_multiset<{1}>') + for vers in ('', vers_nsp): + # Note that we can't have a printer for std::wstreampos, because + # it shares the same underlying type as std::streampos. + add_one_type_printer(obj, 'fpos', vers + 'streampos') + add_one_type_printer(obj, 'basic_string', vers + 'u16string') + add_one_type_printer(obj, 'basic_string', vers + 'u32string') + add_one_type_printer(obj, 'basic_string_view', 'u16string_view') + add_one_type_printer(obj, 'basic_string_view', 'u32string_view') + + for dur in ('nanoseconds', 'microseconds', 'milliseconds', + 'seconds', 'minutes', 'hours'): + add_one_type_printer(obj, 'duration', vers + dur) + + add_one_type_printer(obj, 'linear_congruential_engine', vers + 'minstd_rand0') + add_one_type_printer(obj, 'linear_congruential_engine', vers + 'minstd_rand') + add_one_type_printer(obj, 'mersenne_twister_engine', vers + 'mt19937') + add_one_type_printer(obj, 'mersenne_twister_engine', vers + 'mt19937_64') + add_one_type_printer(obj, 'subtract_with_carry_engine', vers + 'ranlux24_base') + add_one_type_printer(obj, 'subtract_with_carry_engine', vers + 'ranlux48_base') + add_one_type_printer(obj, 'discard_block_engine', vers + 'ranlux24') + add_one_type_printer(obj, 'discard_block_engine', vers + 'ranlux48') + add_one_type_printer(obj, 'shuffle_order_engine', vers + 'knuth_b') + + # Do not show defaulted template arguments in class templates + add_one_template_type_printer(obj, 'unique_ptr', + '%sunique_ptr<(.*), std::%sdefault_delete<\\1 ?> >' % (vers, vers), + '%sunique_ptr<{1}>' % vers) + + add_one_template_type_printer(obj, 'deque', + '%sdeque<(.*), std::%sallocator<\\1 ?> >' % (vers, vers), + '%sdeque<{1}>' % vers) + add_one_template_type_printer(obj, 'forward_list', + '%sforward_list<(.*), std::%sallocator<\\1 ?> >' % (vers, vers), + '%sforward_list<{1}>' % vers) + add_one_template_type_printer(obj, 'list', + '%slist<(.*), std::%sallocator<\\1 ?> >' % (vers, vers), + '%slist<{1}>' % vers) + add_one_template_type_printer(obj, 'vector', + '%svector<(.*), std::%sallocator<\\1 ?> >' % (vers, vers), + '%svector<{1}>' % vers) + add_one_template_type_printer(obj, 'map', + '%smap<(.*), (.*), std::%sless<\\1 ?>, std::%sallocator > >' % (vers, vers, vers, vers), + '%smap<{1}, {2}>' % vers) + add_one_template_type_printer(obj, 'multimap', + '%smultimap<(.*), (.*), std::%sless<\\1 ?>, std::%sallocator > >' % (vers, vers, vers, vers), + '%smultimap<{1}, {2}>' % vers) + add_one_template_type_printer(obj, 'set', + '%sset<(.*), std::%sless<\\1 ?>, std::%sallocator<\\1 ?> >' % (vers, vers, vers), + '%sset<{1}>' % vers) + add_one_template_type_printer(obj, 'multiset', + '%smultiset<(.*), std::%sless<\\1 ?>, std::%sallocator<\\1 ?> >' % (vers, vers, vers), + '%smultiset<{1}>' % vers) + add_one_template_type_printer(obj, 'unordered_map', + '%sunordered_map<(.*), (.*), std::%shash<\\1 ?>, std::%sequal_to<\\1 ?>, std::%sallocator > >' % (vers, vers, vers, vers, vers), + '%sunordered_map<{1}, {2}>' % vers) + add_one_template_type_printer(obj, 'unordered_multimap', + '%sunordered_multimap<(.*), (.*), std::%shash<\\1 ?>, std::%sequal_to<\\1 ?>, std::%sallocator > >' % (vers, vers, vers, vers, vers), + '%sunordered_multimap<{1}, {2}>' % vers) + add_one_template_type_printer(obj, 'unordered_set', + '%sunordered_set<(.*), std::%shash<\\1 ?>, std::%sequal_to<\\1 ?>, std::%sallocator<\\1 ?> >' % (vers, vers, vers, vers), + '%sunordered_set<{1}>' % vers) + add_one_template_type_printer(obj, 'unordered_multiset', + '%sunordered_multiset<(.*), std::%shash<\\1 ?>, std::%sequal_to<\\1 ?>, std::%sallocator<\\1 ?> >' % (vers, vers, vers, vers), + '%sunordered_multiset<{1}>' % vers) # strip the "fundamentals_v1" inline namespace from these types add_one_template_type_printer(obj, 'any', @@ -1439,7 +1447,7 @@ def build_libstdcxx_dictionary (): libstdcxx_printer = Printer("libstdc++-v6") # For _GLIBCXX_BEGIN_NAMESPACE_VERSION. - vers = '(__7::)?' + vers = '(' + vers_nsp + ')?' # For _GLIBCXX_BEGIN_NAMESPACE_CONTAINER. container = '(__cxx1998::' + vers + ')?' diff --git a/libstdc++-v3/python/libstdcxx/v6/xmethods.py b/libstdc++-v3/python/libstdcxx/v6/xmethods.py index 045b661..4d58663 100644 --- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py +++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py @@ -148,7 +148,7 @@ class ArrayMethodsMatcher(gdb.xmethod.XMethodMatcher): self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): - if not re.match('^std::array<.*>$', class_type.tag): + if not re.match('^std::(__\d+::)?array<.*>$', class_type.tag): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: @@ -265,7 +265,7 @@ class DequeMethodsMatcher(gdb.xmethod.XMethodMatcher): self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): - if not re.match('^std::deque<.*>$', class_type.tag): + if not re.match('^std::(__\d+::)?deque<.*>$', class_type.tag): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: @@ -309,7 +309,7 @@ class ForwardListMethodsMatcher(gdb.xmethod.XMethodMatcher): self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): - if not re.match('^std::forward_list<.*>$', class_type.tag): + if not re.match('^std::(__\d+::)?forward_list<.*>$', class_type.tag): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: @@ -390,7 +390,7 @@ class ListMethodsMatcher(gdb.xmethod.XMethodMatcher): self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): - if not re.match('^std::(__cxx11::)?list<.*>$', class_type.tag): + if not re.match('^std::(__\d+::)?(__cxx11::)?list<.*>$', class_type.tag): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: @@ -505,7 +505,7 @@ class VectorMethodsMatcher(gdb.xmethod.XMethodMatcher): self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): - if not re.match('^std::vector<.*>$', class_type.tag): + if not re.match('^std::(__\d+::)?vector<.*>$', class_type.tag): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: @@ -554,7 +554,7 @@ class AssociativeContainerMethodsMatcher(gdb.xmethod.XMethodMatcher): self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): - if not re.match('^std::%s<.*>$' % self._name, class_type.tag): + if not re.match('^std::(__\d+::)?%s<.*>$' % self._name, class_type.tag): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: @@ -576,9 +576,9 @@ class UniquePtrGetWorker(gdb.xmethod.XMethodWorker): def __call__(self, obj): impl_type = obj.dereference().type.fields()[0].type.tag - if impl_type.startswith('std::__uniq_ptr_impl<'): # New implementation + if re.match('^std::(__\d+::)?__uniq_ptr_impl<.*>$', impl_type): # New implementation return obj['_M_t']['_M_t']['_M_head_impl'] - elif impl_type.startswith('std::tuple<'): + elif re.match('^std::(__\d+::)?tuple<.*>$', impl_type): return obj['_M_t']['_M_head_impl'] return None @@ -604,7 +604,7 @@ class UniquePtrMethodsMatcher(gdb.xmethod.XMethodMatcher): self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): - if not re.match('^std::unique_ptr<.*>$', class_type.tag): + if not re.match('^std::(__\d+::)?unique_ptr<.*>$', class_type.tag): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: diff --git a/libstdc++-v3/testsuite/lib/gdb-test.exp b/libstdc++-v3/testsuite/lib/gdb-test.exp index 3ebbf6b..5e1bdf7 100644 --- a/libstdc++-v3/testsuite/lib/gdb-test.exp +++ b/libstdc++-v3/testsuite/lib/gdb-test.exp @@ -74,6 +74,14 @@ proc whatis-test {var result} { lappend gdb_tests $var $result whatis } +# A test of 'whatis'. This tests a type rather than a variable through a +# regular expression. +proc whatis-regexp-test {var result} { + global gdb_tests + + lappend gdb_tests $var $result whatis_regexp +} + # Utility for testing variable values using gdb, invoked via dg-final. # Tests all tests indicated by note-test and regexp-test. # @@ -140,10 +148,15 @@ proc gdb-test { marker {selector {}} {load_xmethods 0} } { incr count set gdb_var($count) $var set gdb_expected($count) $result - if {$kind == "whatis"} { + if {$kind == "whatis" || $kind == "whatis_regexp"} { if {$do_whatis_tests} { set gdb_is_type($count) 1 set gdb_command($count) "whatis $var" + if {$kind == "whatis"} { + set gdb_is_regexp($count) 0 + } else { + set gdb_is_regexp($count) 1 + } } else { unsupported "$testname" close $fd @@ -179,13 +192,13 @@ proc gdb-test { marker {selector {}} {load_xmethods 0} } { if {$expect_out(1,string) != "type"} { error "gdb failure" } - set match [expr {![string compare $first \ - $gdb_expected($test_counter)]}] - } elseif {$gdb_is_regexp($test_counter)} { + } + + if {$gdb_is_regexp($test_counter)} { set match [regexp -- $gdb_expected($test_counter) $first] } else { set match [expr {![string compare $first \ - $gdb_expected($test_counter)]}] + $gdb_expected($test_counter)]}] } if {$match} { diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc index 780a4e4..aa3b63b 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc @@ -63,77 +63,77 @@ int main() { std::forward_list efl; -// { dg-final { note-test efl "empty std::forward_list" } } +// { dg-final { regexp-test efl "empty std::(__7::)?forward_list" } } std::forward_list &refl = efl; -// { dg-final { note-test refl "empty std::forward_list" } } +// { dg-final { regexp-test refl "empty std::(__7::)?forward_list" } } std::forward_list fl; fl.push_front(2); fl.push_front(1); -// { dg-final { note-test fl {std::forward_list = {[0] = 1, [1] = 2}} } } +// { dg-final { regexp-test fl {std::(__7::)?forward_list = {\[0\] = 1, \[1\] = 2}} } } std::forward_list &rfl = fl; -// { dg-final { note-test rfl {std::forward_list = {[0] = 1, [1] = 2}} } } +// { dg-final { regexp-test rfl {std::(__7::)?forward_list = {\[0\] = 1, \[1\] = 2}} } } std::unordered_map eum; -// { dg-final { note-test eum "std::unordered_map with 0 elements" } } +// { dg-final { regexp-test eum "std::(__7::)?unordered_map with 0 elements" } } std::unordered_map &reum = eum; -// { dg-final { note-test reum "std::unordered_map with 0 elements" } } +// { dg-final { regexp-test reum "std::(__7::)?unordered_map with 0 elements" } } std::unordered_multimap eumm; -// { dg-final { note-test eumm "std::unordered_multimap with 0 elements" } } +// { dg-final { regexp-test eumm "std::(__7::)?unordered_multimap with 0 elements" } } std::unordered_multimap &reumm = eumm; -// { dg-final { note-test reumm "std::unordered_multimap with 0 elements" } } +// { dg-final { regexp-test reumm "std::(__7::)?unordered_multimap with 0 elements" } } std::unordered_set eus; -// { dg-final { note-test eus "std::unordered_set with 0 elements" } } +// { dg-final { regexp-test eus "std::(__7::)?unordered_set with 0 elements" } } std::unordered_set &reus = eus; -// { dg-final { note-test reus "std::unordered_set with 0 elements" } } +// { dg-final { regexp-test reus "std::(__7::)?unordered_set with 0 elements" } } std::unordered_multiset eums; -// { dg-final { note-test eums "std::unordered_multiset with 0 elements" } } +// { dg-final { regexp-test eums "std::(__7::)?unordered_multiset with 0 elements" } } std::unordered_multiset &reums = eums; -// { dg-final { note-test reums "std::unordered_multiset with 0 elements" } } +// { dg-final { regexp-test reums "std::(__7::)?unordered_multiset with 0 elements" } } std::unordered_map uom; uom[5] = "three"; uom[3] = "seven"; -// { dg-final { note-test uom {std::unordered_map with 2 elements = {[3] = "seven", [5] = "three"}} } } +// { dg-final { regexp-test uom {std::(__7::)?unordered_map with 2 elements = {\[3\] = "seven", \[5\] = "three"}} } } std::unordered_map &ruom = uom; -// { dg-final { note-test ruom {std::unordered_map with 2 elements = {[3] = "seven", [5] = "three"}} } } +// { dg-final { regexp-test ruom {std::(__7::)?unordered_map with 2 elements = {\[3\] = "seven", \[5\] = "three"}} } } std::unordered_multimap uomm; uomm.insert(std::pair (5, "three")); uomm.insert(std::pair (5, "seven")); -// { dg-final { note-test uomm {std::unordered_multimap with 2 elements = {[5] = "seven", [5] = "three"}} } } +// { dg-final { regexp-test uomm {std::(__7::)?unordered_multimap with 2 elements = {\[5\] = "seven", \[5\] = "three"}} } } std::unordered_multimap &ruomm = uomm; -// { dg-final { note-test ruomm {std::unordered_multimap with 2 elements = {[5] = "seven", [5] = "three"}} } } +// { dg-final { regexp-test ruomm {std::(__7::)?unordered_multimap with 2 elements = {\[5\] = "seven", \[5\] = "three"}} } } std::unordered_set uos; uos.insert(5); -// { dg-final { note-test uos {std::unordered_set with 1 elements = {[0] = 5}} } } +// { dg-final { regexp-test uos {std::(__7::)?unordered_set with 1 elements = {\[0\] = 5}} } } std::unordered_set &ruos = uos; -// { dg-final { note-test ruos {std::unordered_set with 1 elements = {[0] = 5}} } } +// { dg-final { regexp-test ruos {std::(__7::)?unordered_set with 1 elements = {\[0\] = 5}} } } std::unordered_multiset uoms; uoms.insert(5); -// { dg-final { note-test uoms {std::unordered_multiset with 1 elements = {[0] = 5}} } } +// { dg-final { regexp-test uoms {std::(__7::)?unordered_multiset with 1 elements = {\[0\] = 5}} } } std::unordered_multiset &ruoms = uoms; -// { dg-final { note-test ruoms {std::unordered_multiset with 1 elements = {[0] = 5}} } } +// { dg-final { regexp-test ruoms {std::(__7::)?unordered_multiset with 1 elements = {\[0\] = 5}} } } std::unique_ptr uptr (new datum); uptr->s = "hi bob"; uptr->i = 23; -// { dg-final { regexp-test uptr {std::unique_ptr.datum. containing 0x.*} } } +// { dg-final { regexp-test uptr {std::(__7::)?unique_ptr.datum. containing 0x.*} } } std::unique_ptr &ruptr = uptr; -// { dg-final { regexp-test ruptr {std::unique_ptr.datum. containing 0x.*} } } +// { dg-final { regexp-test ruptr {std::(__7::)?unique_ptr.datum. containing 0x.*} } } ExTuple tpl(6,7); -// { dg-final { note-test tpl {std::tuple containing = {[1] = 6, [2] = 7}} } } +// { dg-final { regexp-test tpl {std::(__7::)?tuple containing = {\[1\] = 6, \[2\] = 7}} } } ExTuple &rtpl = tpl; -// { dg-final { note-test rtpl {std::tuple containing = {[1] = 6, [2] = 7}} } } +// { dg-final { regexp-test rtpl {std::(__7::)?tuple containing = {\[1\] = 6, \[2\] = 7}} } } placeholder(""); // Mark SPOT use(efl); use(fl); diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc index 96be8c7..c85edc3 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc @@ -44,50 +44,50 @@ main() // { dg-final { note-test str "\"string\"" } } optional o; -// { dg-final { note-test o {std::optional [no contained value]} } } +// { dg-final { regexp-test o {std::(__7::)?optional \[no contained value\]} } } optional ob{false}; -// { dg-final { note-test ob {std::optional = {[contained value] = false}} } } +// { dg-final { regexp-test ob {std::(__7::)?optional = {\[contained value\] = false}} } } optional oi{5}; -// { dg-final { note-test oi {std::optional = {[contained value] = 5}} } } +// { dg-final { regexp-test oi {std::(__7::)?optional = {\[contained value\] = 5}} } } optional op{nullptr}; -// { dg-final { note-test op {std::optional = {[contained value] = 0x0}} } } +// { dg-final { regexp-test op {std::(__7::)?optional = {\[contained value\] = 0x0}} } } optional> om; om = std::map{ {1, 2.}, {3, 4.}, {5, 6.} }; -// { dg-final { note-test om {std::optional> containing std::map with 3 elements = {[1] = 2, [3] = 4, [5] = 6}} } } +// { dg-final { regexp-test om {std::(__7::)?optional> containing std::(__7::)?map with 3 elements = {\[1\] = 2, \[3\] = 4, \[5\] = 6}} } } optional os{ "stringy" }; -// { dg-final { note-test os {std::optional = {[contained value] = "stringy"}} } } +// { dg-final { regexp-test os {std::(__7::)?optional = {\[contained value\] = "stringy"}} } } any a; -// { dg-final { note-test a {std::any [no contained value]} } } +// { dg-final { regexp-test a {std::(__7::)?any \[no contained value\]} } } any ab(false); -// { dg-final { note-test ab {std::any containing bool = {[contained value] = false}} } } +// { dg-final { regexp-test ab {std::(__7::)?any containing bool = {\[contained value\] = false}} } } any ai(6); -// { dg-final { note-test ai {std::any containing int = {[contained value] = 6}} } } +// { dg-final { regexp-test ai {std::(__7::)?any containing int = {\[contained value\] = 6}} } } any ap = (void*)nullptr; -// { dg-final { note-test ap {std::any containing void * = {[contained value] = 0x0}} } } +// { dg-final { regexp-test ap {std::(__7::)?any containing void \* = {\[contained value\] = 0x0}} } } any as = *os; -// { dg-final { note-test as {std::any containing std::string = {[contained value] = "stringy"}} } } +// { dg-final { regexp-test as {std::(__7::)?any containing std::(__7::)?string = {\[contained value\] = "stringy"}} } } any as2("stringiest"); -// { dg-final { regexp-test as2 {std::any containing const char \* = {\[contained value\] = 0x[[:xdigit:]]+ "stringiest"}} } } +// { dg-final { regexp-test as2 {std::(__7::)?any containing const char \* = {\[contained value\] = 0x[[:xdigit:]]+ "stringiest"}} } } any am = *om; -// { dg-final { note-test am {std::any containing std::map with 3 elements = {[1] = 2, [3] = 4, [5] = 6}} } } +// { dg-final { regexp-test am {std::(__7::)?any containing std::(__7::)?map with 3 elements = {\[1\] = 2, \[3\] = 4, \[5\] = 6}} } } struct S { operator int() { throw 42; }}; variant v0; -// { dg-final { note-test v0 {std::variant [index 0] = {0}} } } +// { dg-final { regexp-test v0 {std::(__7::)?variant \[index 0\] = {0}} } } variant v1{ 0.5f }; -// { dg-final { note-test v1 {std::variant [index 0] = {0.5}} } } +// { dg-final { regexp-test v1 {std::(__7::)?variant \[index 0\] = [{]0.5[}]} } } variant v2; try { v2.emplace<1>(S()); } catch (int) { } -// { dg-final { note-test v2 {std::variant [no contained value]} } } +// { dg-final { regexp-test v2 {std::(__7::)?variant \[no contained value\]} } } variant v3{ 3 }; -// { dg-final { note-test v3 {std::variant [index 1] = {3}} } } +// { dg-final { regexp-test v3 {std::(__7::)?variant \[index 1\] = [{]3[}]} } } variant v4{ str }; -// { dg-final { note-test v4 {std::variant [index 2] = {"string"}} } } +// { dg-final { regexp-test v4 {std::(__7::)?variant \[index 2\] = {"string"}} } } variant vref{str}; -// { dg-final { note-test vref {std::variant [index 0] = {"string"}} } } +// { dg-final { regexp-test vref {std::(__7::)?variant \[index 0\] = {"string"}} } } map m{ {1, "one"} }; map::node_type n0; diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/libfundts.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/libfundts.cc index 534c55f..18580c7 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/libfundts.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/libfundts.cc @@ -39,33 +39,33 @@ main() // { dg-final { note-test str "\"string\"" } } optional o; -// { dg-final { note-test o {std::experimental::optional [no contained value]} } } +// { dg-final { regexp-test o {std::experimental::(__7::)?optional \[no contained value\]} } } optional ob{false}; -// { dg-final { note-test ob {std::experimental::optional = {[contained value] = false}} } } +// { dg-final { regexp-test ob {std::experimental::(__7::)?optional = {\[contained value\] = false}} } } optional oi{5}; -// { dg-final { note-test oi {std::experimental::optional = {[contained value] = 5}} } } +// { dg-final { regexp-test oi {std::experimental::(__7::)?optional = {\[contained value\] = 5}} } } optional op{nullptr}; -// { dg-final { note-test op {std::experimental::optional = {[contained value] = 0x0}} } } +// { dg-final { regexp-test op {std::experimental::(__7::)?optional = {\[contained value\] = 0x0}} } } optional> om; om = std::map{ {1, 2.}, {3, 4.}, {5, 6.} }; -// { dg-final { note-test om {std::experimental::optional> containing std::map with 3 elements = {[1] = 2, [3] = 4, [5] = 6}} } } +// { dg-final { regexp-test om {std::experimental::(__7::)?optional> containing std::(__7::)?map with 3 elements = {\[1\] = 2, \[3\] = 4, \[5\] = 6}} } } optional os{ "stringy" }; -// { dg-final { note-test os {std::experimental::optional = {[contained value] = "stringy"}} } } +// { dg-final { regexp-test os {std::experimental::(__7::)?optional = {\[contained value\] = "stringy"}} } } any a; -// { dg-final { note-test a {std::experimental::any [no contained value]} } } +// { dg-final { regexp-test a {std::experimental::(__7::)?any \[no contained value\]} } } any ab(false); -// { dg-final { note-test ab {std::experimental::any containing bool = {[contained value] = false}} } } +// { dg-final { regexp-test ab {std::experimental::(__7::)?any containing bool = {\[contained value\] = false}} } } any ai(6); -// { dg-final { note-test ai {std::experimental::any containing int = {[contained value] = 6}} } } +// { dg-final { regexp-test ai {std::experimental::(__7::)?any containing int = {\[contained value\] = 6}} } } any ap = (void*)nullptr; -// { dg-final { note-test ap {std::experimental::any containing void * = {[contained value] = 0x0}} } } +// { dg-final { regexp-test ap {std::experimental::(__7::)?any containing void \* = {\[contained value\] = 0x0}} } } any as = *os; -// { dg-final { note-test as {std::experimental::any containing std::string = {[contained value] = "stringy"}} } } +// { dg-final { regexp-test as {std::experimental::(__7::)?any containing std::(__7::)?string = {\[contained value\] = "stringy"}} } } any as2("stringiest"); -// { dg-final { regexp-test as2 {std::experimental::any containing const char \* = {\[contained value\] = 0x[[:xdigit:]]+ "stringiest"}} } } +// { dg-final { regexp-test as2 {std::experimental::(__7::)?any containing const char \* = {\[contained value\] = 0x[[:xdigit:]]+ "stringiest"}} } } any am = *om; -// { dg-final { note-test am {std::experimental::any containing std::map with 3 elements = {[1] = 2, [3] = 4, [5] = 6}} } } +// { dg-final { regexp-test am {std::experimental::(__7::)?any containing std::(__7::)?map with 3 elements = {\[1\] = 2, \[3\] = 4, \[5\] = 6}} } } std::cout << "\n"; return 0; // Mark SPOT diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/shared_ptr.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/shared_ptr.cc index 9528860..ab9baf9 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/shared_ptr.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/shared_ptr.cc @@ -49,25 +49,25 @@ main() typedef std::weak_ptr weak; shared esp; -// { dg-final { note-test esp "std::shared_ptr (empty) 0x0" } } +// { dg-final { regexp-test esp {std::(__7::)?shared_ptr \(empty\) 0x0} } } weak ewp1; -// { dg-final { note-test ewp1 "std::weak_ptr (empty) 0x0" } } +// { dg-final { regexp-test ewp1 {std::(__7::)?weak_ptr \(empty\) 0x0} } } weak ewp2 = esp; -// { dg-final { note-test ewp2 "std::weak_ptr (empty) 0x0" } } +// { dg-final { regexp-test ewp2 {std::(__7::)?weak_ptr \(empty\) 0x0} } } shared sp1 = make(0x12345678); shared sp2 = sp1; -// { dg-final { note-test sp1 "std::shared_ptr (count 2, weak 0) 0x12345678" } } +// { dg-final { regexp-test sp1 {std::(__7::)?shared_ptr \(count 2, weak 0\) 0x12345678} } } shared sp3 = make(0x12344321); weak sp4 = sp3; weak wp1 = sp3; -// { dg-final { note-test wp1 "std::weak_ptr (count 1, weak 2) 0x12344321" } } +// { dg-final { regexp-test wp1 {std::(__7::)?weak_ptr \(count 1, weak 2\) 0x12344321} } } shared sp5 = make(0x56788765); weak wp2 = sp5; sp5.reset(); -// { dg-final { note-test wp2 "std::weak_ptr (expired, weak 1) 0x56788765" } } +// { dg-final { regexp-test wp2 {std::(__7::)?weak_ptr \(expired, weak 1\) 0x56788765} } } placeholder(""); // Mark SPOT use(esp); diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc index 5f98b25..edf1735 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc @@ -43,12 +43,12 @@ main() bs[0] = 1; bs[5] = 1; bs[7] = 1; -// { dg-final { note-test bs {std::bitset = {[0] = 1, [5] = 1, [7] = 1}} } } +// { dg-final { regexp-test bs {std::(__7::)?bitset = {\[0\] = 1, \[5\] = 1, \[7\] = 1}} } } std::deque deq; deq.push_back("one"); deq.push_back("two"); -// { dg-final { note-test deq {std::deque with 2 elements = {"one", "two"}} } } +// { dg-final { regexp-test deq {std::(__7::)?deque with 2 elements = {"one", "two"}} } } std::deque::iterator deqiter = deq.begin(); // { dg-final { note-test deqiter {"one"} } } @@ -56,7 +56,7 @@ main() std::list lst; lst.push_back("one"); lst.push_back("two"); -// { dg-final { note-test lst {std::list = {[0] = "one", [1] = "two"}} } } +// { dg-final { regexp-test lst {std::(__7::)?list = {\[0\] = "one", \[1\] = "two"}} } } std::list::iterator lstiter = lst.begin(); tem = *lstiter; @@ -68,7 +68,7 @@ main() std::map mp; mp["zardoz"] = 23; -// { dg-final { note-test mp {std::map with 1 elements = {["zardoz"] = 23}} } } +// { dg-final { regexp-test mp {std::(__7::)?map with 1 elements = {\["zardoz"\] = 23}} } } std::map::iterator mpiter = mp.begin(); // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } } @@ -78,12 +78,12 @@ main() intset.insert(2); intset.insert(3); const std::set const_intset = intset; -// { dg-final { note-test const_intset {std::set with 2 elements = {[0] = 2, [1] = 3}} } } +// { dg-final { regexp-test const_intset {std::(__7::)?set with 2 elements = {\[0\] = 2, \[1\] = 3}} } } std::set sp; sp.insert("clownfish"); sp.insert("barrel"); -// { dg-final { note-test sp {std::set with 2 elements = {[0] = "barrel", [1] = "clownfish"}} } } +// { dg-final { regexp-test sp {std::(__7::)?set with 2 elements = {\[0\] = "barrel", \[1\] = "clownfish"}} } } std::set::const_iterator spciter = sp.begin(); // { dg-final { note-test spciter {"barrel"} } } diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc index 97a57ef..fa3e36d 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc @@ -43,12 +43,12 @@ main() bs[0] = 1; bs[5] = 1; bs[7] = 1; -// { dg-final { note-test bs {std::bitset = {[0] = 1, [5] = 1, [7] = 1}} } } +// { dg-final { regexp-test bs {std::(__7::)?bitset = {\[0\] = 1, \[5\] = 1, \[7\] = 1}} } } std::deque deq; deq.push_back("one"); deq.push_back("two"); -// { dg-final { note-test deq {std::deque with 2 elements = {"one", "two"}} } } +// { dg-final { regexp-test deq {std::(__7::)?deque with 2 elements = {"one", "two"}} } } std::deque::iterator deqiter = deq.begin(); // { dg-final { note-test deqiter {"one"} } } @@ -56,7 +56,7 @@ main() std::list lst; lst.push_back("one"); lst.push_back("two"); -// { dg-final { note-test lst {std::list = {[0] = "one", [1] = "two"}} } } +// { dg-final { regexp-test lst {std::(__7::)?list = {\[0\] = "one", \[1\] = "two"}} } } std::list::iterator lstiter = lst.begin(); tem = *lstiter; @@ -68,19 +68,19 @@ main() std::map mp; mp["zardoz"] = 23; -// { dg-final { note-test mp {std::map with 1 elements = {["zardoz"] = 23}} } } +// { dg-final { regexp-test mp {std::(__7::)?map with 1 elements = {\["zardoz"\] = 23}} } } std::map::iterator mpiter = mp.begin(); // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } } // PR 67440 const std::set const_intset = {2, 3}; -// { dg-final { note-test const_intset {std::set with 2 elements = {[0] = 2, [1] = 3}} } } +// { dg-final { regexp-test const_intset {std::(__7::)?set with 2 elements = {\[0\] = 2, \[1\] = 3}} } } std::set sp; sp.insert("clownfish"); sp.insert("barrel"); -// { dg-final { note-test sp {std::set with 2 elements = {[0] = "barrel", [1] = "clownfish"}} } } +// { dg-final { regexp-test sp {std::(__7::)?set with 2 elements = {\[0\] = "barrel", \[1\] = "clownfish"}} } } std::set::const_iterator spciter = sp.begin(); // { dg-final { note-test spciter {"barrel"} } } diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/tr1.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/tr1.cc index 52dca4d..0a87dd9 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/tr1.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/tr1.cc @@ -51,31 +51,31 @@ int main() { std::tr1::unordered_map eum; -// { dg-final { note-test eum "std::tr1::unordered_map with 0 elements" } } +// { dg-final { regexp-test eum "std::tr1::(__7::)?unordered_map with 0 elements" } } std::tr1::unordered_multimap eumm; -// { dg-final { note-test eumm "std::tr1::unordered_multimap with 0 elements" } } +// { dg-final { regexp-test eumm "std::tr1::(__7::)?unordered_multimap with 0 elements" } } std::tr1::unordered_set eus; -// { dg-final { note-test eus "std::tr1::unordered_set with 0 elements" } } +// { dg-final { regexp-test eus "std::tr1::(__7::)?unordered_set with 0 elements" } } std::tr1::unordered_multiset eums; -// { dg-final { note-test eums "std::tr1::unordered_multiset with 0 elements" } } +// { dg-final { regexp-test eums "std::tr1::(__7::)?unordered_multiset with 0 elements" } } std::tr1::unordered_map uom; uom[5] = "three"; uom[3] = "seven"; -// { dg-final { note-test uom {std::tr1::unordered_map with 2 elements = {[3] = "seven", [5] = "three"}} } } +// { dg-final { regexp-test uom {std::tr1::(__7::)?unordered_map with 2 elements = {\[3\] = "seven", \[5\] = "three"}} } } std::tr1::unordered_multimap uomm; uomm.insert(std::pair (5, "three")); uomm.insert(std::pair (5, "seven")); -// { dg-final { note-test uomm {std::tr1::unordered_multimap with 2 elements = {[5] = "three", [5] = "seven"}} } } +// { dg-final { regexp-test uomm {std::tr1::(__7::)?unordered_multimap with 2 elements = {\[5\] = "three", \[5\] = "seven"}} } } std::tr1::unordered_set uos; uos.insert(5); -// { dg-final { note-test uos {std::tr1::unordered_set with 1 elements = {[0] = 5}} } } +// { dg-final { regexp-test uos {std::tr1::(__7::)?unordered_set with 1 elements = {\[0\] = 5}} } } std::tr1::unordered_multiset uoms; uoms.insert(5); -// { dg-final { note-test uoms {std::tr1::unordered_multiset with 1 elements = {[0] = 5}} } } +// { dg-final { regexp-test uoms {std::tr1::(__7::)?unordered_multiset with 1 elements = {\[0\] = 5}} } } placeholder(""); // Mark SPOT use(eum); diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/whatis.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/whatis.cc index 3f79f92..f440692 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/whatis.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/whatis.cc @@ -60,141 +60,141 @@ typedef std::basic_string ustring; std::string *string_ptr; holder string_holder; -// { dg-final { whatis-test string_holder "holder" } } +// { dg-final { whatis-regexp-test string_holder "holder" } } std::ios *ios_ptr; holder ios_holder; -// { dg-final { whatis-test ios_holder "holder" } } +// { dg-final { whatis-regexp-test ios_holder "holder" } } std::streambuf *streambuf_ptr; holder streambuf_holder; -// { dg-final { whatis-test streambuf_holder "holder" } } +// { dg-final { whatis-regexp-test streambuf_holder "holder" } } std::istream *istream_ptr; holder istream_holder; -// { dg-final { whatis-test istream_holder "holder" } } +// { dg-final { whatis-regexp-test istream_holder "holder" } } std::ostream *ostream_ptr; holder ostream_holder; -// { dg-final { whatis-test ostream_holder "holder" } } +// { dg-final { whatis-regexp-test ostream_holder "holder" } } std::iostream *iostream_ptr; holder iostream_holder; -// { dg-final { whatis-test iostream_holder "holder" } } +// { dg-final { whatis-regexp-test iostream_holder "holder" } } std::stringbuf *stringbuf_ptr; holder stringbuf_holder; -// { dg-final { whatis-test stringbuf_holder "holder" } } +// { dg-final { whatis-regexp-test stringbuf_holder "holder" } } std::istringstream *istringstream_ptr; holder istringstream_holder; -// { dg-final { whatis-test istringstream_holder "holder" } } +// { dg-final { whatis-regexp-test istringstream_holder "holder" } } std::ostringstream *ostringstream_ptr; holder ostringstream_holder; -// { dg-final { whatis-test ostringstream_holder "holder" } } +// { dg-final { whatis-regexp-test ostringstream_holder "holder" } } std::stringstream *stringstream_ptr; holder stringstream_holder; -// { dg-final { whatis-test stringstream_holder "holder" } } +// { dg-final { whatis-regexp-test stringstream_holder "holder" } } std::filebuf *filebuf_ptr; holder filebuf_holder; -// { dg-final { whatis-test filebuf_holder "holder" } } +// { dg-final { whatis-regexp-test filebuf_holder "holder" } } std::ifstream *ifstream_ptr; holder ifstream_holder; -// { dg-final { whatis-test ifstream_holder "holder" } } +// { dg-final { whatis-regexp-test ifstream_holder "holder" } } std::ofstream *ofstream_ptr; holder ofstream_holder; -// { dg-final { whatis-test ofstream_holder "holder" } } +// { dg-final { whatis-regexp-test ofstream_holder "holder" } } std::fstream *fstream_ptr; holder fstream_holder; -// { dg-final { whatis-test fstream_holder "holder" } } +// { dg-final { whatis-regexp-test fstream_holder "holder" } } std::streampos *streampos_ptr; holder streampos_holder; -// { dg-final { whatis-test streampos_holder "holder" } } +// { dg-final { whatis-regexp-test streampos_holder "holder" } } std::regex *regex_ptr; holder regex_holder; -// { dg-final { whatis-test regex_holder "holder" } } +// { dg-final { whatis-regexp-test regex_holder "holder" } } std::csub_match *csub_match_ptr; holder csub_match_holder; -// { dg-final { whatis-test csub_match_holder "holder" } } +// { dg-final { whatis-regexp-test csub_match_holder "holder" } } std::ssub_match *ssub_match_ptr; holder ssub_match_holder; -// { dg-final { whatis-test ssub_match_holder "holder" } } +// { dg-final { whatis-regexp-test ssub_match_holder "holder" } } std::cmatch *cmatch_ptr; holder cmatch_holder; -// { dg-final { whatis-test cmatch_holder "holder" } } +// { dg-final { whatis-regexp-test cmatch_holder "holder" } } std::smatch *smatch_ptr; holder smatch_holder; -// { dg-final { whatis-test smatch_holder "holder" } } +// { dg-final { whatis-regexp-test smatch_holder "holder" } } std::cregex_iterator *cregex_iterator_ptr; holder cregex_iterator_holder; -// { dg-final { whatis-test cregex_iterator_holder "holder" } } +// { dg-final { whatis-regexp-test cregex_iterator_holder "holder" } } std::sregex_iterator *sregex_iterator_ptr; holder sregex_iterator_holder; -// { dg-final { whatis-test sregex_iterator_holder "holder" } } +// { dg-final { whatis-regexp-test sregex_iterator_holder "holder" } } std::cregex_token_iterator *cregex_token_iterator_ptr; holder cregex_token_iterator_holder; -// { dg-final { whatis-test cregex_token_iterator_holder "holder" } } +// { dg-final { whatis-regexp-test cregex_token_iterator_holder "holder" } } std::sregex_token_iterator *sregex_token_iterator_ptr; holder sregex_token_iterator_holder; -// { dg-final { whatis-test sregex_token_iterator_holder "holder" } } +// { dg-final { whatis-regexp-test sregex_token_iterator_holder "holder" } } std::u16string *u16string_ptr; holder u16string_holder; -// { dg-final { whatis-test u16string_holder "holder" } } +// { dg-final { whatis-regexp-test u16string_holder "holder" } } std::u32string *u32string_ptr; holder u32string_holder; -// { dg-final { whatis-test u32string_holder "holder" } } +// { dg-final { whatis-regexp-test u32string_holder "holder" } } std::minstd_rand0 *minstd_rand0_ptr; holder minstd_rand0_holder; -// { dg-final { whatis-test minstd_rand0_holder "holder" } } +// { dg-final { whatis-regexp-test minstd_rand0_holder "holder" } } std::minstd_rand *minstd_rand_ptr; holder minstd_rand_holder; -// { dg-final { whatis-test minstd_rand_holder "holder" } } +// { dg-final { whatis-regexp-test minstd_rand_holder "holder" } } std::mt19937 *mt19937_ptr; holder mt19937_holder; -// { dg-final { whatis-test mt19937_holder "holder" } } +// { dg-final { whatis-regexp-test mt19937_holder "holder" } } std::mt19937_64 *mt19937_64_ptr; holder mt19937_64_holder; -// { dg-final { whatis-test mt19937_64_holder "holder" } } +// { dg-final { whatis-regexp-test mt19937_64_holder "holder" } } std::ranlux24_base *ranlux24_base_ptr; holder ranlux24_base_holder; -// { dg-final { whatis-test ranlux24_base_holder "holder" } } +// { dg-final { whatis-regexp-test ranlux24_base_holder "holder" } } std::ranlux48_base *ranlux48_base_ptr; holder ranlux48_base_holder; -// { dg-final { whatis-test ranlux48_base_holder "holder" } } +// { dg-final { whatis-regexp-test ranlux48_base_holder "holder" } } std::ranlux24 *ranlux24_ptr; holder ranlux24_holder; -// { dg-final { whatis-test ranlux24_holder "holder" } } +// { dg-final { whatis-regexp-test ranlux24_holder "holder" } } std::ranlux48 *ranlux48_ptr; holder ranlux48_holder; -// { dg-final { whatis-test ranlux48_holder "holder" } } +// { dg-final { whatis-regexp-test ranlux48_holder "holder" } } std::knuth_b *knuth_b_ptr; holder knuth_b_holder; -// { dg-final { whatis-test knuth_b_holder "holder" } } +// { dg-final { whatis-regexp-test knuth_b_holder "holder" } } ustring *ustring_ptr; holder ustring_holder; -// { dg-final { whatis-test ustring_holder "holder, std::allocator > >" } } +// { dg-final { whatis-regexp-test ustring_holder "holder, std::(__7::)?allocator > >" } } std::basic_string *sstring_ptr; holder< std::basic_string > sstring_holder; -// { dg-final { whatis-test sstring_holder "holder, std::allocator > >" } } +// { dg-final { whatis-regexp-test sstring_holder "holder, std::(__7::)?allocator > >" } } std::vector>> *seq1_ptr; holder< std::vector>> > seq1_holder; -// { dg-final { whatis-test seq1_holder "holder>> >" } } +// { dg-final { whatis-regexp-test seq1_holder "holder>> >" } } std::list>> *seq2_ptr; holder< std::list>> > seq2_holder; -// { dg-final { whatis-test seq2_holder "holder>> >" } } +// { dg-final { whatis-regexp-test seq2_holder "holder>> >" } } std::map> *assoc1_ptr; holder< std::map> > assoc1_holder; -// { dg-final { whatis-test assoc1_holder "holder> >" } } +// { dg-final { whatis-regexp-test assoc1_holder "holder> >" } } std::multimap> *assoc2_ptr; holder< std::multimap> > assoc2_holder; -// { dg-final { whatis-test assoc2_holder "holder> >" } } +// { dg-final { whatis-regexp-test assoc2_holder "holder> >" } } std::unordered_map> *unord1_ptr; holder< std::unordered_map> > unord1_holder; -// { dg-final { whatis-test unord1_holder "holder> >" } } +// { dg-final { whatis-regexp-test unord1_holder "holder> >" } } std::unordered_multimap> *unord2_ptr; holder< std::unordered_multimap> > unord2_holder; -// { dg-final { whatis-test unord2_holder "holder> >" } } +// { dg-final { whatis-regexp-test unord2_holder "holder> >" } } int