From patchwork Tue May 9 17:46:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 20345 Received: (qmail 83742 invoked by alias); 9 May 2017 17:53:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 82615 invoked by uid 89); 9 May 2017 17:53:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=fraction 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, 09 May 2017 17:53:08 +0000 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v49Hhl06056842 for ; Tue, 9 May 2017 13:53:09 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2aba6p7sf9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 09 May 2017 13:53:09 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 9 May 2017 18:53:07 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 9 May 2017 18:53:06 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v49Hr62S20644114 for ; Tue, 9 May 2017 17:53:06 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9282C5204D for ; Tue, 9 May 2017 17:50:29 +0100 (BST) Received: from oc1027705133.ibm.com (unknown [9.152.212.109]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 78BDD5204C for ; Tue, 9 May 2017 17:50:29 +0100 (BST) From: Andreas Arnez To: gdb-patches@sourceware.org Subject: [PATCH v2 09/19] write_pieced_value: Fix buffer offset for memory pieces Date: Tue, 9 May 2017 19:46:05 +0200 In-Reply-To: <1494352015-10465-1-git-send-email-arnez@linux.vnet.ibm.com> References: <1494352015-10465-1-git-send-email-arnez@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17050917-0012-0000-0000-00000526C61E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050917-0013-0000-0000-00001865B476 Message-Id: <1494352015-10465-10-git-send-email-arnez@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-09_14:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705090097 X-IsSubscribed: yes In write_pieced_value, when transferring the data to target memory via a buffer, the bit offset within the target value is not reduced to its sub-byte fraction before using it as a bit offset into the buffer. This is fixed. gdb/ChangeLog: * dwarf2loc.c (write_pieced_value): In DWARF_VALUE_MEMORY, truncate full bytes from dest_offset_bits before using it as an offset into the buffer. --- gdb/dwarf2loc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 8b5cbc5..e1e1562 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -2056,7 +2056,7 @@ write_pieced_value (struct value *to, struct value *from) read_memory (p->v.mem.addr + dest_offset, buffer.data (), 1); read_memory (p->v.mem.addr + dest_offset + this_size - 1, &buffer[this_size - 1], 1); - copy_bitwise (buffer.data (), dest_offset_bits, + copy_bitwise (buffer.data (), dest_offset_bits % 8, contents, source_offset_bits, this_size_bits, bits_big_endian);