From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27521 invoked by alias); 7 Nov 2016 14:36:38 -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 27507 invoked by uid 89); 7 Nov 2016 14:36:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=uweigand@de.ibm.com, uweiganddeibmcom X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 07 Nov 2016 14:36:36 +0000 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uA7EXdqH103135 for ; Mon, 7 Nov 2016 09:36:34 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 26ju4n98ru-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 07 Nov 2016 09:36:34 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 7 Nov 2016 14:36:33 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 7 Nov 2016 14:36:30 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 9DF67219005E for ; Mon, 7 Nov 2016 14:35:44 +0000 (GMT) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uA7EaUF88061190 for ; Mon, 7 Nov 2016 14:36:30 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id uA7EaT2G031982 for ; Mon, 7 Nov 2016 07:36:29 -0700 Received: from oc8523832656.ibm.com (dyn-9-152-213-198.boeblingen.de.ibm.com [9.152.213.198]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id uA7EaTLF031977; Mon, 7 Nov 2016 07:36:29 -0700 Received: by oc8523832656.ibm.com (Postfix, from userid 500) id 91FBF10B7A7; Mon, 7 Nov 2016 15:36:28 +0100 (CET) Subject: Re: [PATCH 2/2] Remove parameter valaddr from la_val_print To: qiyaoltc@gmail.com (Yao Qi) Date: Mon, 07 Nov 2016 14:36:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org (gdb-patches@sourceware.org) In-Reply-To: from "Yao Qi" at Nov 07, 2016 02:24:54 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: 16110714-0008-0000-0000-000002EEE553 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16110714-0009-0000-0000-00001AA0790C Message-Id: <20161107143628.91FBF10B7A7@oc8523832656.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-07_06:,, 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-1611070268 X-SW-Source: 2016-11/txt/msg00136.txt.bz2 Yao Qi wrote: > On Mon, Nov 7, 2016 at 1:18 PM, Ulrich Weigand wrote: > > Yao Qi wrote: > > > >> Nowadays, we pass both val and return value of > >> value_contents_for_printing (val) to la_val_print. The latter is > >> unnecessary. This patch removes the second parameter of la_val_print, > >> and get valaddr in each language's implementation by calling > >> value_contents_for_printing_const. This change makes a little > >> difference, because value_contents_for_printing calls value_fetch_lazy > >> additionally, so I call value_fetch_lazy in the caller of val_print > >> if needed. > > > > Can you explain why all those value_fetch_lazy calls are needed? > > Did you add them only to keep the behavior the same as currently, > > or does printing not work correctly if they are omitted? > > > > The former. Without my change, we pass the return value of > value_contents_for_printing to val_print, like this, > > val_print (elttype, value_contents_for_printing (v0), > > and, value_contents_for_printing calls value_fetch_lazy. After my > change, we start to use value_contents_for_printing_const in val_print > of each language, because VAL passed to val_print is const, so we > need to call value_fetch_lazy explicitly in the caller of val_print. Ah, I didn't notice the "const". Maybe the right fix would then be to simply remove the "const" (the value parameter in value_print isn't const either), and simply use value_contents_for_printing wherever needed. Bye, Ulrich -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain Ulrich.Weigand@de.ibm.com