From patchwork Wed Apr 20 11:26:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 11816 Received: (qmail 103365 invoked by alias); 20 Apr 2016 11:26:47 -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 103354 invoked by uid 89); 20 Apr 2016 11:26:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Supply, 20, 9, HX-Received:10.66.251.132, Hx-languages-length:2652 X-HELO: mail-pa0-f51.google.com Received: from mail-pa0-f51.google.com (HELO mail-pa0-f51.google.com) (209.85.220.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 20 Apr 2016 11:26:36 +0000 Received: by mail-pa0-f51.google.com with SMTP id fs9so17187636pac.2 for ; Wed, 20 Apr 2016 04:26:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=Mqhh319qJYuDcM2MU8d9mzKLDEpo8Yz7zpcBf4/69Zs=; b=XmajQGr3r5UUr+6n09GPvgGMlL/B58+ln/q0dJZVhcooDvWfgFeEDO5bQrgagyQPPY 65VEYcWYWH0JafmSN6CebRalZsArMhG7vOV76xbWL1WCrrjCOtJGWUaPtpaLX6B4EKmW hLxRSzJSMK5d/lLczczYRkYbXOCA1b+ZsbA8rFOoyapYpnMuVp44sCbwslEGDn27LPNO RqxMI90snZKPj1FzPsoBCylxwDOWulxU07SnM6JLvEjibThpBfWaMU6muia9u6UvVEXn S2BDFmWSnHTQ3mI6qCl5e1L+DUjZcA3DK4tXO34BB+63R9S3uIJcUc3tFhV+dUasZE1I H2rw== X-Gm-Message-State: AOPr4FX6Ioz5MXROKDgMctLE10IRCoZIgZLGkEpAIOOTJikKqXJjImNr117Sllg/IyWvQg== X-Received: by 10.66.251.132 with SMTP id zk4mr11517834pac.50.1461151594149; Wed, 20 Apr 2016 04:26:34 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id fv10sm43781913pad.40.2016.04.20.04.26.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Apr 2016 04:26:33 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] Move ARM_CPSR_GREGNUM to arch/arm-linux.h Date: Wed, 20 Apr 2016 12:26:14 +0100 Message-Id: <1461151574-31818-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes This patch moves macro ARM_CPSR_GREGNUM to arch/arm-linux.h so that it can be used in GDBserver side. I'll push it in. gdb: 2016-04-20 Yao Qi * arm-linux-tdep.h (ARM_CPSR_GREGNUM): Move it to ... * arch/arm-linux.h: ... here. gdb/gdbserver: 2016-04-20 Yao Qi * linux-aarch32-low.c: Include "arch/arm-linux.h". (arm_fill_gregset): Use ARM_CPSR_GREGNUM rather than magic number 16. * linux-aarch32-low.c (arm_store_gregset): Likewise. --- gdb/arch/arm-linux.h | 3 +++ gdb/arm-linux-tdep.h | 3 --- gdb/gdbserver/linux-aarch32-low.c | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gdb/arch/arm-linux.h b/gdb/arch/arm-linux.h index dfd634c..ed83da9 100644 --- a/gdb/arch/arm-linux.h +++ b/gdb/arch/arm-linux.h @@ -20,6 +20,9 @@ #ifndef ARM_LINUX_H #define ARM_LINUX_H +/* The index to access CSPR in user_regs defined in GLIBC. */ +#define ARM_CPSR_GREGNUM 16 + /* There are a couple of different possible stack layouts that we need to support. diff --git a/gdb/arm-linux-tdep.h b/gdb/arm-linux-tdep.h index 99f1777..be18a64 100644 --- a/gdb/arm-linux-tdep.h +++ b/gdb/arm-linux-tdep.h @@ -24,9 +24,6 @@ struct regcache; + 2 * INT_REGISTER_SIZE \ + 8 + INT_REGISTER_SIZE) -/* The index to access CSPR in user_regs defined in GLIBC. */ -#define ARM_CPSR_GREGNUM 16 - /* Support for register format used by the NWFPE FPA emulator. Each register takes three words, where either the first one, two, or three hold a single, double, or extended precision value (depending diff --git a/gdb/gdbserver/linux-aarch32-low.c b/gdb/gdbserver/linux-aarch32-low.c index 2bbbb24..0c4b140 100644 --- a/gdb/gdbserver/linux-aarch32-low.c +++ b/gdb/gdbserver/linux-aarch32-low.c @@ -17,6 +17,7 @@ #include "server.h" #include "arch/arm.h" +#include "arch/arm-linux.h" #include "linux-low.h" #include "linux-aarch32-low.h" @@ -65,7 +66,7 @@ arm_fill_gregset (struct regcache *regcache, void *buf) for (i = ARM_A1_REGNUM; i <= ARM_PC_REGNUM; i++) collect_register (regcache, i, ®s[i]); - collect_register (regcache, ARM_PS_REGNUM, ®s[16]); + collect_register (regcache, ARM_PS_REGNUM, ®s[ARM_CPSR_GREGNUM]); } /* Supply GP registers contents, stored in BUF, to REGCACHE. */ @@ -84,7 +85,7 @@ arm_store_gregset (struct regcache *regcache, const void *buf) for (; i < ARM_PS_REGNUM; i++) supply_register (regcache, i, zerobuf); - supply_register (regcache, ARM_PS_REGNUM, ®s[16]); + supply_register (regcache, ARM_PS_REGNUM, ®s[ARM_CPSR_GREGNUM]); } /* Collect NUM number of VFP registers from REGCACHE to buffer BUF. */