From patchwork Thu Oct 22 13:39:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marcin_Ko=C5=9Bcielnicki?= X-Patchwork-Id: 9322 Received: (qmail 51270 invoked by alias); 22 Oct 2015 13:45:18 -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 51245 invoked by uid 89); 22 Oct 2015 13:45:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS, UNSUBSCRIBE_BODY autolearn=no 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; Thu, 22 Oct 2015 13:45:16 +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 D66CC4014E; Thu, 22 Oct 2015 15:39:56 +0200 (CEST) Received: by hogfather.0x04.net (Postfix, from userid 1000) id C2D4A5800D4; Thu, 22 Oct 2015 15:39:42 +0200 (CEST) From: =?UTF-8?q?Marcin=20Ko=C5=9Bcielnicki?= To: palves@redhat.com, qiyaoltc@gmail.com Cc: gdb-patches@sourceware.org, =?UTF-8?q?Marcin=20Ko=C5=9Bcielnicki?= Subject: [PATCH v2 08/13] gdb/linux-record: Fix [gs]etgroups16 syscall Date: Thu, 22 Oct 2015 15:39:21 +0200 Message-Id: <1445521166-14492-8-git-send-email-koriakin@0x04.net> In-Reply-To: <1445521166-14492-1-git-send-email-koriakin@0x04.net> References: <5628E5D6.5020706@0x04.net> <1445521166-14492-1-git-send-email-koriakin@0x04.net> MIME-Version: 1.0 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/ChangeLog: * linux-record.c (record_linux_system_call): Fix [gs]etgroups16. --- gdb/ChangeLog | 4 ++++ gdb/linux-record.c | 17 ++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ce717ae..1c3cc04 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2015-10-22 Marcin Kościelnicki + * linux-record.c (record_linux_system_call): Fix [gs]etgroups16. + +2015-10-22 Marcin Kościelnicki + * aarch64-linux-tdep.c (aarch64_linux_init_abi): Add size_time_t. * amd64-linux-tdep.c (amd64_linux_init_abi): Add size_time_t. (amd64_x32_linux_init_abi): Add size_time_t. 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: