From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98652 invoked by alias); 30 Nov 2016 21:16:48 -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 98621 invoked by uid 89); 30 Nov 2016 21:16:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RCVD_IN_SEMBACKSCATTER,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 30 Nov 2016 21:16:46 +0000 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAUL8mE7058650 for ; Wed, 30 Nov 2016 16:16:44 -0500 Received: from e06smtp09.uk.ibm.com (e06smtp09.uk.ibm.com [195.75.94.105]) by mx0a-001b2d01.pphosted.com with ESMTP id 2724mwwn9b-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 30 Nov 2016 16:16:44 -0500 Received: from localhost by e06smtp09.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 30 Nov 2016 21:16:42 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp09.uk.ibm.com (192.168.101.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 30 Nov 2016 21:16:40 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 3D695219005F for ; Wed, 30 Nov 2016 21:15:51 +0000 (GMT) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAULGdet66257054 for ; Wed, 30 Nov 2016 21:16:39 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id uAULGdsB024882 for ; Wed, 30 Nov 2016 14:16:39 -0700 Received: from oc8523832656.ibm.com (icon-9-164-147-155.megacenter.de.ibm.com [9.164.147.155]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id uAULGd1H024879; Wed, 30 Nov 2016 14:16:39 -0700 Received: by oc8523832656.ibm.com (Postfix, from userid 500) id BA94710BCB5; Wed, 30 Nov 2016 22:16:37 +0100 (CET) Subject: Re: [PATCH] Assert on lval_register To: qiyaoltc@gmail.com (Yao Qi) Date: Wed, 30 Nov 2016 21:16:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <1480517757-11733-1-git-send-email-yao.qi@linaro.org> from "Yao Qi" at Nov 30, 2016 02:55:57 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16113021-0036-0000-0000-0000026DF2C5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16113021-0037-0000-0000-0000137785DD Message-Id: <20161130211637.BA94710BCB5@oc8523832656.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-30_16:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611300338 X-SW-Source: 2016-11/txt/msg01024.txt.bz2 Yao Qi wrote: > This patch adds asserts where the value's lval must be lval_register. > This triggers an error in frame_register_unwind because VALUE_REGNUM > is used but value's lval is not lval_register. Makes sense to me. > This also reveals a design issue in frame_register_unwind, that is > arguments addrp and realnump are mutually exclusive, we either use > addrp (for lval_memory), or use realnump (for lval_register). This > can be done in a separate patch. I think we should simply get rid of frame_register_unwind. Callers should be changed to use frame_unwind_register_value directly, and just operate on the value. > *lvalp = VALUE_LVAL (value); > *addrp = value_address (value); > - *realnump = VALUE_REGNUM (value); > + if (*lvalp == lval_register) > + *realnump = VALUE_REGNUM (value); But as long as the above change is not done yet, maybe we ought to at least provide a defined value (e.g. -1), to avoid callers maybe making use of uninitialized variables? Bye, Ulrich -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain Ulrich.Weigand@de.ibm.com