This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] gdb/linux-record: Fix msghdr parsing on 64-bit targets
- From: Pedro Alves <palves at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 30 Oct 2015 15:54:20 -0000
- Subject: [binutils-gdb] gdb/linux-record: Fix msghdr parsing on 64-bit targets
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=933c5a623f247c63b642988a2984f5ce9b558d27
commit 933c5a623f247c63b642988a2984f5ce9b558d27
Author: Marcin KoÅ?cielnicki <koriakin@0x04.net>
Date: Fri Oct 30 15:51:58 2015 +0000
gdb/linux-record: Fix msghdr parsing on 64-bit targets
The code failed to account for padding between the int and subsequent
pointer present on 64-bit architectures.
gdb/ChangeLog:
* linux-record.c (record_linux_msghdr): Fix msg_namelen handling.
Diff:
---
gdb/ChangeLog | 4 ++++
gdb/linux-record.c | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 296e861..dacfcca 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2015-10-30 Marcin KoÅ?cielnicki <koriakin@0x04.net>
+ * linux-record.c (record_linux_msghdr): Fix msg_namelen handling.
+
+2015-10-30 Marcin KoÅ?cielnicki <koriakin@0x04.net>
+
* aarch64-linux-tdep.c (aarch64_linux_init_abi): Remove
size_dirent{,64}, add size_old_dirent.
* amd64-linux-tdep.c (amd64_linux_init_abi): Remove size_dirent{,64},
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);