This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 07/11] gdb/linux-record: Fix [sg]etgroups16 syscall
- From: Marcin KoÅcielnicki <koriakin at 0x04 dot net>
- To: gdb-patches at sourceware dot org
- Cc: Marcin KoÅcielnicki <koriakin at 0x04 dot net>
- Date: Sat, 17 Oct 2015 23:41:17 +0200
- Subject: [PATCH 07/11] gdb/linux-record: Fix [sg]etgroups16 syscall
- Authentication-results: sourceware.org; auth=none
- References: <1445118081-10908-1-git-send-email-koriakin at 0x04 dot net>
Memory size for getgroups16 needs to be multiplied by entry count, and only
needs recording if the pointer is non-NULL. setgroups16, on the other hand,
doesn't write to user memory and doesn't need special handling at all.
---
gdb/linux-record.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index dbd8f14..25cbda1 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -628,16 +628,19 @@ record_linux_system_call (enum gdb_syscall syscall,
case gdb_sys_getgroups16:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
- if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
- tdep->size_old_gid_t))
- return -1;
+ if (tmpulongest)
+ {
+ ULONGEST gidsetsize;
+
+ regcache_raw_read_unsigned (regcache, tdep->arg1,
+ &gidsetsize);
+ tmpint = tdep->size_old_gid_t * (int) gidsetsize;
+ if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
+ return -1;
+ }
break;
case gdb_sys_setgroups16:
- regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
- if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
- tdep->size_old_gid_t))
- return -1;
break;
case gdb_old_select:
--
2.6.1