From patchwork Mon Feb 15 14:26:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 10860 Received: (qmail 6160 invoked by alias); 15 Feb 2016 14:27:03 -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 6130 invoked by uid 89); 15 Feb 2016 14:27:02 -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=2387 X-HELO: mail-pf0-f176.google.com Received: from mail-pf0-f176.google.com (HELO mail-pf0-f176.google.com) (209.85.192.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 15 Feb 2016 14:27:00 +0000 Received: by mail-pf0-f176.google.com with SMTP id q63so88234855pfb.0 for ; Mon, 15 Feb 2016 06:27:00 -0800 (PST) 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=48SFbPVJO9/H6b2KawMYUF0Ui9mAL0q8LhJ3WRLKNBQ=; b=GBwwltFvsbMT316/cPYORgnDVAw1K6dab8opSPliQlmPj/oEGvBgepY97mjECFO0O6 A3KWwcMDGhijy1b7Kqog3Fv18kffv7wN8pMzfrMNqludx06sTyl/qOs1LkrtIoZaGFs0 MIoint2deMWPNYRo+hoPGFXTV/PtH1YMfFlEFWzeOtzYVMx8QmGhrqVruj0VTT0wuOsF 17lMDJMDwD2Yft6t6wxYYrZfMI46fmlqL5cI2tAGUglty9iIiTP06b1emeMMLha0q9me bSeSso4YrJArM4/usjCIjRZwFwQSIYvoaXaFj4TTUV7MGtCn8+wQ4wL8BTHCB69D+JyM lRwQ== X-Gm-Message-State: AG10YOTe+vfVmq58cfbQGYa16KP5lpV/BUMJ9dGYB58K7DqL/r9RjAki7Sb3hHBgPV/AvQ== X-Received: by 10.98.70.28 with SMTP id t28mr23766623pfa.110.1455546419155; Mon, 15 Feb 2016 06:26:59 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id x10sm39081789pas.37.2016.02.15.06.26.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Feb 2016 06:26:58 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] Remove PC from syscall_next_pc Date: Mon, 15 Feb 2016 14:26:55 +0000 Message-Id: <1455546415-19101-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes Method syscall_next_pc of struct arm_get_next_pcs_ops has an argument PC, which is not necessary, because PC can be got from regcache in 'struct arm_get_next_pcs'. This patch removes the PC argument of syscall_next_pc. Regression tested on arm-linux. gdb: 2016-02-15 Yao Qi * arch/arm-get-next-pcs.h (struct arm_get_next_pcs_ops) : Remove argument PC. Callers updated. * arm-linux-tdep.c (arm_linux_get_next_pcs_syscall_next_pc): Remove argument PC. Get pc from regcache_read_pc. * arm-tdep.c (arm_get_next_pcs_syscall_next_pc): Remove argument PC. gdb/gdbserver: 2016-02-15 Yao Qi * linux-arm-low.c (get_next_pcs_syscall_next_pc): Remove argument PC. Get pc from regcache_read_pc. --- gdb/arch/arm-get-next-pcs.c | 4 ++-- gdb/arch/arm-get-next-pcs.h | 2 +- gdb/arm-linux-tdep.c | 7 +++---- gdb/arm-tdep.c | 6 ++---- gdb/gdbserver/linux-arm-low.c | 6 +++--- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/gdb/arch/arm-get-next-pcs.c b/gdb/arch/arm-get-next-pcs.c index 8404869..f3e9fd9 100644 --- a/gdb/arch/arm-get-next-pcs.c +++ b/gdb/arch/arm-get-next-pcs.c @@ -417,7 +417,7 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self) unsigned long cond = bits (inst1, 8, 11); if (cond == 0x0f) /* 0x0f = SWI */ { - nextpc = self->ops->syscall_next_pc (self, pc); + nextpc = self->ops->syscall_next_pc (self); } else if (cond != 0x0f && condition_true (cond, status)) nextpc = pc_val + (sbits (inst1, 0, 7) << 1); @@ -889,7 +889,7 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self) break; case 0xf: /* SWI */ { - nextpc = self->ops->syscall_next_pc (self, pc); + nextpc = self->ops->syscall_next_pc (self); } break; diff --git a/gdb/arch/arm-get-next-pcs.h b/gdb/arch/arm-get-next-pcs.h index e038982..5525ee2 100644 --- a/gdb/arch/arm-get-next-pcs.h +++ b/gdb/arch/arm-get-next-pcs.h @@ -28,7 +28,7 @@ struct arm_get_next_pcs; struct arm_get_next_pcs_ops { ULONGEST (*read_mem_uint) (CORE_ADDR memaddr, int len, int byte_order); - CORE_ADDR (*syscall_next_pc) (struct arm_get_next_pcs *self, CORE_ADDR pc); + CORE_ADDR (*syscall_next_pc) (struct arm_get_next_pcs *self); CORE_ADDR (*addr_bits_remove) (struct arm_get_next_pcs *self, CORE_ADDR val); int (*is_thumb) (struct arm_get_next_pcs *self); diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index e416e28..46d54bc 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -266,8 +266,7 @@ static const gdb_byte arm_linux_thumb2_le_breakpoint[] = { 0xf0, 0xf7, 0x00, 0xa #define ARM_RT_SIGRETURN 173 static CORE_ADDR - arm_linux_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self, - CORE_ADDR pc); + arm_linux_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self); /* Operation function pointers for get_next_pcs. */ static struct arm_get_next_pcs_ops arm_linux_get_next_pcs_ops = { @@ -872,10 +871,10 @@ arm_linux_get_syscall_number (struct gdbarch *gdbarch, } static CORE_ADDR -arm_linux_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self, - CORE_ADDR pc) +arm_linux_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self) { CORE_ADDR next_pc = 0; + CORE_ADDR pc = regcache_read_pc (self->regcache); int is_thumb = arm_is_thumb (self->regcache); ULONGEST svc_number = 0; struct gdbarch *gdbarch = get_regcache_arch (self->regcache); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 048406a..9bd48a2 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -238,8 +238,7 @@ static void arm_neon_quad_write (struct gdbarch *gdbarch, int regnum, const gdb_byte *buf); static CORE_ADDR - arm_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self, - CORE_ADDR pc); + arm_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self); /* get_next_pcs operations. */ @@ -6139,8 +6138,7 @@ arm_get_next_pcs_addr_bits_remove (struct arm_get_next_pcs *self, /* Wrapper over syscall_next_pc for use in get_next_pcs. */ static CORE_ADDR -arm_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self, - CORE_ADDR pc) +arm_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self) { return 0; } diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c index 365f1c9..57826f1 100644 --- a/gdb/gdbserver/linux-arm-low.c +++ b/gdb/gdbserver/linux-arm-low.c @@ -147,8 +147,7 @@ static ULONGEST get_next_pcs_read_memory_unsigned_integer (CORE_ADDR memaddr, static CORE_ADDR get_next_pcs_addr_bits_remove (struct arm_get_next_pcs *self, CORE_ADDR val); -static CORE_ADDR get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self, - CORE_ADDR pc); +static CORE_ADDR get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self); static int get_next_pcs_is_thumb (struct arm_get_next_pcs *self); @@ -786,9 +785,10 @@ arm_sigreturn_next_pc (struct regcache *regcache, int svc_number, /* When PC is at a syscall instruction, return the PC of the next instruction to be executed. */ static CORE_ADDR -get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self, CORE_ADDR pc) +get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self) { CORE_ADDR next_pc = 0; + CORE_ADDR pc = regcache_read_pc (self->regcache); int is_thumb = arm_is_thumb_mode (); ULONGEST svc_number = 0; struct regcache *regcache = self->regcache;