From patchwork Wed May 28 23:57:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 1193 Received: (qmail 22686 invoked by alias); 28 May 2014 23:57:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 22677 invoked by uid 89); 28 May 2014 23:57:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-gw3-out.broadcom.com Received: from mail-gw3-out.broadcom.com (HELO mail-gw3-out.broadcom.com) (216.31.210.64) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 May 2014 23:57:29 +0000 Received: from irvexchcas06.broadcom.com (HELO IRVEXCHCAS06.corp.ad.broadcom.com) ([10.9.208.53]) by mail-gw3-out.broadcom.com with ESMTP; 28 May 2014 16:59:23 -0700 Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS06.corp.ad.broadcom.com (10.9.208.53) with Microsoft SMTP Server (TLS) id 14.3.174.1; Wed, 28 May 2014 16:57:27 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.3.174.1; Wed, 28 May 2014 16:57:26 -0700 Received: from [10.177.252.246] (unknown [10.177.252.246]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id BE00B9FA0A; Wed, 28 May 2014 16:57:14 -0700 (PDT) Message-ID: <538677D9.3080607@broadcom.com> Date: Thu, 29 May 2014 00:57:13 +0100 From: Andrew Burgess User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: CC: Pedro Alves Subject: Re: [PATCH] demangler, only access valid fields for DEMANGLE_COMPONENT_FIXED_TYPE. References: <1401309510-10507-1-git-send-email-aburgess@broadcom.com> <538669AD.8020502@redhat.com> In-Reply-To: <538669AD.8020502@redhat.com> X-IsSubscribed: yes On 28/05/2014 11:56 PM, Pedro Alves wrote: > On 05/28/2014 09:38 PM, Andrew Burgess wrote: >> >> diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected >> index 453f9a3..0e2bb12 100644 >> --- a/libiberty/testsuite/demangle-expected >> +++ b/libiberty/testsuite/demangle-expected >> @@ -4343,3 +4343,9 @@ cereal::detail::InputBindingMap::Serializers cereal::p >> --format=gnu-v3 >> _ZNSt9_Any_data9_M_accessIPZ4postISt8functionIFvvEEEvOT_EUlvE_EERS5_v >> void post >(std::function&&)::{lambda()#1}*& std::_Any_data::_M_access >(void post >(std::function&&)::{lambda()#1}*&&)::{lambda()#1}*>() >> +# The following input symbol was found during random, it caused a fault > > Could you add a single empty # above, to separate the tests? > I find that that makes it much easier to follow the file. Done. >> +# The following input symbol was found during random, it caused a fault > > "during random testing?" > >> +# within the demangler, it's not a symbol we'd expect in the real world. > > Why not? Good point(s), that comment was out of date, I've removed it. The symbol is a perfectly good symbol which we could find in the real world, and should be able to handle. Patch below only has changes to the tests. Thanks, Andrew diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 68d8ee1..a31dad4 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -710,7 +710,9 @@ d_dump (struct demangle_component *dc, int indent) printf ("pointer to member type\n"); break; case DEMANGLE_COMPONENT_FIXED_TYPE: - printf ("fixed-point type\n"); + printf ("fixed-point type, accum? %d, sat? %d\n", + dc->u.s_fixed.accum, dc->u.s_fixed.sat); + d_dump (dc->u.s_fixed.length, indent + 2) break; case DEMANGLE_COMPONENT_ARGLIST: printf ("argument list\n"); @@ -3869,7 +3871,13 @@ d_count_templates_scopes (int *num_templates, int *num_scopes, case DEMANGLE_COMPONENT_FUNCTION_TYPE: case DEMANGLE_COMPONENT_ARRAY_TYPE: case DEMANGLE_COMPONENT_PTRMEM_TYPE: + goto recurse_left_right; + case DEMANGLE_COMPONENT_FIXED_TYPE: + d_count_templates_scopes (num_templates, num_scopes, + dc->u.s_fixed.length); + break; + case DEMANGLE_COMPONENT_VECTOR_TYPE: case DEMANGLE_COMPONENT_ARGLIST: case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST: diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 453f9a3..63f6821 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -4343,3 +4343,8 @@ cereal::detail::InputBindingMap::Serializers cereal::p --format=gnu-v3 _ZNSt9_Any_data9_M_accessIPZ4postISt8functionIFvvEEEvOT_EUlvE_EERS5_v void post >(std::function&&)::{lambda()#1}*& std::_Any_data::_M_access >(void post >(std::function&&)::{lambda()#1}*&&)::{lambda()#1}*>() +# +--format=auto --no-params +_Z3xxxDFyuVb +xxx(unsigned long long _Fract, bool volatile) +xxx