From patchwork Mon Apr 28 09:59:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 715 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx22.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id B3A3F36007C for ; Mon, 28 Apr 2014 02:59:36 -0700 (PDT) Received: by homiemail-mx22.g.dreamhost.com (Postfix, from userid 14314964) id 72A90500622E; Mon, 28 Apr 2014 02:59:36 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx22.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx22.g.dreamhost.com (Postfix) with ESMTPS id 528594F91F78 for ; Mon, 28 Apr 2014 02:59:36 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; q=dns; s=default; b=HxwU0 T0smclgn8bCAg9zWBTIdKyBcAKWdjOtg9I8bBDorOXLAHCwq/4MhSMqsU7QOSyE7 dLKy+WtHRT0qgzJoLYAc58cROduJj54Mrmag4F98BfNbz8RtW22oSUzYkxT8vsZK xU3OdYZuYyut7KWJFOZa6mfRt8X/fAMa7ERuA0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; s=default; bh=Tf/sNKgNcyR zIKbVHBFuKzs9q0k=; b=VlU3vaRZ2/g/M+Ahfth+HyQFN3TLpqEx2hebhiqX4j5 TKvjFWJC54bz2WXp6gUSFfYtH/5y8g45OSCRr6tnOKB4xPdV/aLyqEz0i3r6is61 zu0CT6wfVhbl2djuixGKs4n0/vlzBN8KN5grEygzmUwnrmGJnsFTdsm93tv2RWao = 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-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 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 11:59:26 +0200 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 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14042809-2966-0000-0000-00000B13B263 X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in 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. */