From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42931 invoked by alias); 24 Mar 2018 18:56:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 42918 invoked by uid 89); 24 Mar 2018 18:56:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1500, H*u:6.1, H*UA:6.1, HContent-Transfer-Encoding:8bit X-HELO: aserp2130.oracle.com Received: from aserp2130.oracle.com (HELO aserp2130.oracle.com) (141.146.126.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 24 Mar 2018 18:56:38 +0000 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2OIknhx105659; Sat, 24 Mar 2018 18:56:29 GMT Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2gwv7tr0an-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Mar 2018 18:56:28 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w2OIt4lF016576 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Mar 2018 18:55:04 GMT Received: from ubhmp0002.oracle.com (ubhmp0002.oracle.com [156.151.24.55]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w2OIt3Eb007197; Sat, 24 Mar 2018 18:55:03 GMT Received: from [10.39.216.18] (/10.39.216.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 24 Mar 2018 18:55:02 +0000 Subject: Re: [PATCH 3 PR gdb/16959] gdb hangs in infinite recursion To: Simon Marchi , Pedro Alves Cc: gdb-patches@sourceware.org References: <1521840352-75024-1-git-send-email-weimin.pan@oracle.com> <58d0f0759e471fb7862da336ba18bde6@polymtl.ca> From: Wei-min Pan Message-ID: <71719916-38d0-dd84-e79c-0e9d24dda5aa@oracle.com> Date: Sat, 24 Mar 2018 18:56:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <58d0f0759e471fb7862da336ba18bde6@polymtl.ca> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8841 signatures=668695 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803240213 X-SW-Source: 2018-03/txt/msg00487.txt.bz2 On 3/24/2018 5:33 AM, Simon Marchi wrote: > On 2018-03-24 06:10, Pedro Alves wrote: >> On 03/23/2018 09:25 PM, Weimin Pan wrote: >> >>> -  if (TYPE_CODE (type) == TYPE_CODE_STRUCT) >>> +  struct type *real_type = check_typedef (type); >>> +  if (TYPE_CODE (real_type) == TYPE_CODE_STRUCT) >>>      { >>>        CORE_ADDR *first_dont_print; >>>        CORE_ADDR addr; >>> @@ -658,15 +659,14 @@ cp_print_static_field (struct type *type, >>>        addr = value_address (val); >>>        obstack_grow (&dont_print_statmem_obstack, (char *) &addr, >>>              sizeof (CORE_ADDR)); >>> -      type = check_typedef (type); >>> -      cp_print_value_fields (type, value_enclosing_type (val), >>> +      cp_print_value_fields (real_type, value_enclosing_type (val), >> >> This is still passing the resolved type down instead of the >> original type. > > I did not point this out because cp_print_value_fields does a > check_typedef anyway, so it doesn't change anything.  But it's true > that to be consistent it would be better to always pass down the > original type, and let the callee decide whether it wants to resolve > the typedef or not.  Please consider this comment when preparing the > next version. > Please note the check_typedef() call (now redundant and removed) before calling cp_print_value_fields(). So passing the resolved type is correct. Thanks, Weimin > Thanks, > > Simon