From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102245 invoked by alias); 19 Dec 2017 13:50:59 -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 102189 invoked by uid 89); 19 Dec 2017 13:50:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1425 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; Tue, 19 Dec 2017 13:50:57 +0000 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vBJDnTtR104895 for ; Tue, 19 Dec 2017 08:50:55 -0500 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ey0u89y95-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 19 Dec 2017 08:50:55 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 19 Dec 2017 13:50:52 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 19 Dec 2017 13:50:50 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vBJDooZW50331882; Tue, 19 Dec 2017 13:50:50 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A662AA4053; Tue, 19 Dec 2017 13:45:03 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 967EAA4040; Tue, 19 Dec 2017 13:45:03 +0000 (GMT) Received: from oc3748833570.ibm.com (unknown [9.152.213.29]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 19 Dec 2017 13:45:03 +0000 (GMT) Received: by oc3748833570.ibm.com (Postfix, from userid 1000) id A25D9D85C63; Tue, 19 Dec 2017 14:50:48 +0100 (CET) Subject: Re: [PATCH 1/3] Clear non-significant bits of address on memory access To: qiyaoltc@gmail.com (Yao Qi) Date: Tue, 19 Dec 2017 13:50:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <1512727471-30745-2-git-send-email-yao.qi@linaro.org> from "Yao Qi" at Dec 08, 2017 10:04:29 AM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17121913-0016-0000-0000-0000050EC449 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17121913-0017-0000-0000-0000284AEC5B Message-Id: <20171219135048.A25D9D85C63@oc3748833570.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-19_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712190200 X-SW-Source: 2017-12/txt/msg00420.txt.bz2 Yao Qi wrote: > diff --git a/gdb/target.c b/gdb/target.c > index 3b8b8ea..767a2ad 100644 > --- a/gdb/target.c > +++ b/gdb/target.c > @@ -1214,6 +1214,8 @@ memory_xfer_partial (struct target_ops *ops, enum target_object object, > if (len == 0) > return TARGET_XFER_EOF; > > + memaddr = address_significant (target_gdbarch (), memaddr); > + > /* Fill in READBUF with breakpoint shadows, or WRITEBUF with > breakpoint insns, thus hiding out from higher layers whether > there are software breakpoints inserted in the code stream. */ It turns out this breaks SPU multi-architecture debugging. The problem is that SPU memory addresses have 64 significant bits since we encode the SPU ID in the upper 32 bits. This means that spu-tdep.c needs to call set_gdbarch_significant_addr_bits -- which is fine. However, this doesn't fix the problem, since "target_gdbarch ()" at this point may well return a (32-bit) ppc architecture, and then the address is still truncated incorrectly. In general, using target_gdbarch is nearly never the right thing to do in generic code as long as we want to support multi-architecture debugging. Can this call not be pushed down further in the target stack, to below the xfer_partial implementation in the spu-multiarch target? Bye, Ulrich -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain Ulrich.Weigand@de.ibm.com