From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71026 invoked by alias); 17 Oct 2015 21:49:50 -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 70887 invoked by uid 89); 17 Oct 2015 21:49:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: xyzzy.0x04.net Received: from xyzzy.0x04.net (HELO xyzzy.0x04.net) (109.74.193.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 17 Oct 2015 21:49:48 +0000 Received: from hogfather.0x04.net (89-65-84-110.dynamic.chello.pl [89.65.84.110]) by xyzzy.0x04.net (Postfix) with ESMTPS id B87EF3FF35 for ; Sat, 17 Oct 2015 23:41:43 +0200 (CEST) Received: by hogfather.0x04.net (Postfix, from userid 1000) id CF7E3580131; Sat, 17 Oct 2015 23:41:26 +0200 (CEST) From: =?UTF-8?q?Marcin=20Ko=C5=9Bcielnicki?= To: gdb-patches@sourceware.org Cc: =?UTF-8?q?Marcin=20Ko=C5=9Bcielnicki?= Subject: [PATCH 05/11] gdb/linux-record: Fix msghdr parsing on 64-bit targets Date: Sat, 17 Oct 2015 21:49:00 -0000 Message-Id: <1445118081-10908-6-git-send-email-koriakin@0x04.net> In-Reply-To: <1445118081-10908-1-git-send-email-koriakin@0x04.net> References: <1445118081-10908-1-git-send-email-koriakin@0x04.net> X-SW-Source: 2015-10/txt/msg00317.txt.bz2 The code failed to account for padding between the int and subsequent pointer present on 64-bit architectures. --- gdb/linux-record.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gdb/linux-record.c b/gdb/linux-record.c index e950e8d..8832ef4 100644 --- a/gdb/linux-record.c +++ b/gdb/linux-record.c @@ -162,7 +162,9 @@ record_linux_msghdr (struct regcache *regcache, tdep->size_int, byte_order))) return -1; - a += tdep->size_int; + /* We have read an int, but skip size_pointer bytes to account for alignment + of the next field on 64-bit targets. */ + a += tdep->size_pointer; /* msg_iov msg_iovlen */ addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order); -- 2.6.1