From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67303 invoked by alias); 30 Mar 2018 21:44:02 -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 67286 invoked by uid 89); 30 Mar 2018 21:44:01 -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,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=amended, guidance, H*r:8.14.4, H*u:6.1 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; Fri, 30 Mar 2018 21:43:59 +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 w2ULhRNv180778; Fri, 30 Mar 2018 21:43:52 GMT Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2h1wde801a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Mar 2018 21:43:52 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w2ULhp36005340 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Mar 2018 21:43:51 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w2ULhoiA017532; Fri, 30 Mar 2018 21:43:50 GMT Received: from [10.132.96.98] (/10.132.96.98) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 30 Mar 2018 14:43:50 -0700 Subject: Re: [PATCH5 PR gdb/16959] gdb hangs in infinite recursion To: Simon Marchi Cc: gdb-patches@sourceware.org References: <1522269884-129860-1-git-send-email-weimin.pan@oracle.com> <20cf4b23322670e4dc513183ef2dda45@polymtl.ca> From: Weimin Pan Message-ID: <96ab9fda-2c03-a9c6-1da9-70e807e69e5c@oracle.com> Date: Fri, 30 Mar 2018 21:44: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: <20cf4b23322670e4dc513183ef2dda45@polymtl.ca> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8848 signatures=668697 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-1803300211 X-SW-Source: 2018-03/txt/msg00619.txt.bz2 On 3/29/2018 10:08 PM, Simon Marchi wrote: > On 2018-03-28 16:44, Weimin Pan wrote: >> The original problem was fixed (see related PR 22242). But using a >> typedef >> as the declared type for a static member variable, as commented in >> this PR, >> is still causing gdb to get into infinite loop when printing the static >> member's value. This problem can be reproduced as follows: >> >> % cat t.cc >> class A { >>     typedef A type; >> public: >>     bool operator==(const type& other) { return true; } >> >>     static const type INSTANCE; >> }; >> >> const A A::INSTANCE; >> >> int main() { >>     A a; >>     if (a == A::INSTANCE) { >>         return -1; >>     } >>     return 0; >> } >> % g++ -g t.cc >> % gdb -ex "start" -ex "p a" a.out >> >> The fix is rather trivial - in cp_print_static_field(), should call >> check_typedef() to get the static member's real type and use it to >> check whether it's a struct or an array. >> >> As Simon suggested, I've added a new test case to the testsuite >> and am passing the original type, not the real type, as argument >> to both cp_print_value_fields() and val_print(). >> >> Re-tested on both aarch64-linux-gnu and amd64-linux-gnu. No regressions. > > Hi Weimin, > > Could you change the title to something more descriptive about what > the change/fix is, rather than the problem being fixed?  For example, > "Fix infinite recursion when printing static member with typedef". > > It is ok to push with that fixed (feel free to ask if you still need > some guidance). > > Thanks! > > Simon Hi Simon, I just got started to work on this. Here is what I've done (I followed your lead to creat a different remote name): % git add % git commit -a % git remote add upstream ssh://sourceware.org/git/binutils-gdb.git % git fetch upstream I have a few questions:  * Do I need to do a "git merge" after "git fetch"? Or can I just    do "git pull" which is equivalent to "git fetch;git merge"?    (I was a Mercurial(hg) user, its typical workflow is like:     hg in; do work; hg commit; hg pull; hg rebase(if needed); hg push)  * In your previous email, you said:    Make sure you inserted the ChangeLog entries in the actual ChangeLog files    and amended your commit    It seems the "git commit -a" command will contain all the changes, including    those in ChangeLog files. Why do I have to insert the entries?  * Changing the commit title to be be more descriptive:    So I need to use "git commit --amend" to change the title? Thanks very much for your help. Weimin