From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15307 invoked by alias); 28 Apr 2014 09:59:34 -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 15297 invoked by uid 89); 28 Apr 2014 09:59:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp13.uk.ibm.com Received: from e06smtp13.uk.ibm.com (HELO e06smtp13.uk.ibm.com) (195.75.94.109) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 28 Apr 2014 09:59:33 +0000 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 28 Apr 2014 10:59:30 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 28 Apr 2014 10:59:28 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 1670617D8047 for ; Mon, 28 Apr 2014 11:00:29 +0100 (BST) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps4075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s3S9xRIp66257072 for ; Mon, 28 Apr 2014 09:59:27 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s3SAxRtn010175 for ; Mon, 28 Apr 2014 04:59:27 -0600 Received: from br87z6lw.de.ibm.com (dyn-9-152-212-188.boeblingen.de.ibm.com [9.152.212.188]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s3SAxRVn010150; Mon, 28 Apr 2014 04:59:27 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Cc: Yao Qi Subject: [RFC 19/23] NIOS2 Linux: Fill 'collect_regset' in regset structure References: <87eh0h6bkq.fsf@br87z6lw.de.ibm.com> Date: Mon, 28 Apr 2014 09:59:00 -0000 In-Reply-To: <87eh0h6bkq.fsf@br87z6lw.de.ibm.com> (Andreas Arnez's message of "Mon, 28 Apr 2014 11:35:33 +0200") Message-ID: <871twh3hc1.fsf@br87z6lw.de.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14042809-2966-0000-0000-00000B13B263 X-IsSubscribed: yes X-SW-Source: 2014-04/txt/msg00579.txt.bz2 gdb/ * nios2-linux-tdep.c (NIOS2_GREGS_SIZE): New macro. (nios2_collect_gregset): New function. (nios2_core_regset): Add collect method. --- gdb/nios2-linux-tdep.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/gdb/nios2-linux-tdep.c b/gdb/nios2-linux-tdep.c index 84ab576..f4cacf6 100644 --- a/gdb/nios2-linux-tdep.c +++ b/gdb/nios2-linux-tdep.c @@ -51,6 +51,8 @@ static const int reg_offsets[NIOS2_NUM_REGS] = -1, -1, -1, -1, -1, -1, -1, -1 }; +#define NIOS2_GREGS_SIZE (4 * 31) + /* Implement the supply_regset hook for core files. */ static void @@ -73,11 +75,26 @@ nios2_supply_gregset (const struct regset *regset, } } +static void +nios2_collect_gregset (const struct regset *regset, + const struct regcache *regcache, + int regnum, void *gregs_buf, size_t len) +{ + gdb_byte *gregs = gregs_buf; + int regno; + + for (regno = NIOS2_Z_REGNUM; regno <= NIOS2_MPUACC_REGNUM; regno++) + if (regnum == -1 || regnum == regno) + { + if (reg_offsets[regno] != -1) + regcache_raw_collect (regcache, regno, + gregs + 4 * reg_offsets[regno]); + } +} + static const struct regset nios2_core_regset = { - NULL, - nios2_supply_gregset, - NULL, + NULL, nios2_supply_gregset, nios2_collect_gregset }; /* Implement the regset_from_core_section gdbarch method. */ -- 1.8.4.2