Remove argument pc in get_next_pcs
authorYao Qi <yao.qi@linaro.org>
Tue, 26 Jan 2016 14:08:26 +0000 (14:08 +0000)
committerYao Qi <yao.qi@linaro.org>
Tue, 26 Jan 2016 14:08:26 +0000 (14:08 +0000)
Nowadays, get_next_pcs in linux_target_ops has two parameters PC
and REGCACHE.  Parameter PC looks redundant because it can be go
from REGCACHE.  The patch is to remove PC from the arguments for
various functions.

gdb:

2016-01-26  Yao Qi  <yao.qi@linaro.org>

* arch/arm-get-next-pcs.c (thumb_deal_with_atomic_sequence_raw):
Remove argument pc.  Get pc by regcache_read_pc.  Callers updated.
(arm_deal_with_atomic_sequence_raw): Likewise.
(thumb_get_next_pcs_raw): Likewise.
(arm_get_next_pcs_raw): Likewise.
(arm_get_next_pcs): Remove argument pc.  Callers updated.
* arch/arm-get-next-pcs.h (arm_get_next_pcs): Update declaration.

gdb/gdbserver:

2016-01-26  Yao Qi  <yao.qi@linaro.org>

* linux-arm-low.c (arm_gdbserver_get_next_pcs): Remove argument pc.
* linux-low.c (install_software_single_step_breakpoints): Don't
call regcache_read_pc.
* linux-low.h (struct linux_target_ops) <get_next_pcs>: Remove
argument pc.

gdb/ChangeLog
gdb/arch/arm-get-next-pcs.c
gdb/arch/arm-get-next-pcs.h
gdb/arm-linux-tdep.c
gdb/arm-tdep.c
gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-arm-low.c
gdb/gdbserver/linux-low.c
gdb/gdbserver/linux-low.h

index 8a4453cfe5311d625cdc0ac55ad10d430ec06b32..099c10c81e464fe69d0c9eca02d30845a647feca 100644 (file)
@@ -1,3 +1,13 @@
+2016-01-25  Yao Qi  <yao.qi@linaro.org>
+
+       * arch/arm-get-next-pcs.c (thumb_deal_with_atomic_sequence_raw):
+       Remove argument pc.  Get pc by regcache_read_pc.  Callers updated.
+       (arm_deal_with_atomic_sequence_raw): Likewise.
+       (thumb_get_next_pcs_raw): Likewise.
+       (arm_get_next_pcs_raw): Likewise.
+       (arm_get_next_pcs): Remove argument pc.  Callers updated.
+       * arch/arm-get-next-pcs.h (arm_get_next_pcs): Update declaration.
+
 2016-01-25  Mark Wielaard  <mjw@redhat.com>
 
        * ada-lang.c (ada_evaluate_subexp): Add proper else block.
index 6b8f38a0d511a41d8e6a81779efb1051784139fe..e84014742ebff69343617581d9e6b05e87395390 100644 (file)
@@ -46,11 +46,11 @@ arm_get_next_pcs_ctor (struct arm_get_next_pcs *self,
    added to the next_pcs list.  */
 
 static VEC (CORE_ADDR) *
-thumb_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self,
-                                    CORE_ADDR pc)
+thumb_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
 {
   int byte_order_for_code = self->byte_order_for_code;
   CORE_ADDR breaks[2] = {-1, -1};
+  CORE_ADDR pc = regcache_read_pc (self->regcache);
   CORE_ADDR loc = pc;
   unsigned short insn1, insn2;
   int insn_count;
@@ -183,11 +183,11 @@ thumb_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self,
    added to the next_pcs list.  */
 
 static VEC (CORE_ADDR) *
-arm_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self,
-                                  CORE_ADDR pc)
+arm_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
 {
   int byte_order_for_code = self->byte_order_for_code;
   CORE_ADDR breaks[2] = {-1, -1};
+  CORE_ADDR pc = regcache_read_pc (self->regcache);
   CORE_ADDR loc = pc;
   unsigned int insn;
   int insn_count;
@@ -261,10 +261,11 @@ arm_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self,
 /* Find the next possible PCs for thumb mode.  */
 
 static VEC (CORE_ADDR) *
-thumb_get_next_pcs_raw (struct arm_get_next_pcs *self, CORE_ADDR pc)
+thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
 {
   int byte_order = self->byte_order;
   int byte_order_for_code = self->byte_order_for_code;
+  CORE_ADDR pc = regcache_read_pc (self->regcache);
   unsigned long pc_val = ((unsigned long) pc) + 4;     /* PC after prefetch */
   unsigned short inst1;
   CORE_ADDR nextpc = pc + 2;           /* Default is next instruction.  */
@@ -641,7 +642,7 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self, CORE_ADDR pc)
    address in GDB and arm_addr_bits_remove in GDBServer.  */
 
 static VEC (CORE_ADDR) *
-arm_get_next_pcs_raw (struct arm_get_next_pcs *self, CORE_ADDR pc)
+arm_get_next_pcs_raw (struct arm_get_next_pcs *self)
 {
   int byte_order = self->byte_order;
   int byte_order_for_code = self->byte_order_for_code;
@@ -650,6 +651,7 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self, CORE_ADDR pc)
   unsigned long status;
   CORE_ADDR nextpc;
   struct regcache *regcache = self->regcache;
+  CORE_ADDR pc = regcache_read_pc (self->regcache);
   VEC (CORE_ADDR) *next_pcs = NULL;
 
   pc_val = (unsigned long) pc;
@@ -904,21 +906,21 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self, CORE_ADDR pc)
 /* See arm-get-next-pcs.h.  */
 
 VEC (CORE_ADDR) *
-arm_get_next_pcs (struct arm_get_next_pcs *self, CORE_ADDR pc)
+arm_get_next_pcs (struct arm_get_next_pcs *self)
 {
   VEC (CORE_ADDR) *next_pcs = NULL;
 
   if (self->ops->is_thumb (self))
     {
-      next_pcs = thumb_deal_with_atomic_sequence_raw (self, pc);
+      next_pcs = thumb_deal_with_atomic_sequence_raw (self);
       if (next_pcs == NULL)
-       next_pcs = thumb_get_next_pcs_raw (self, pc);
+       next_pcs = thumb_get_next_pcs_raw (self);
     }
   else
     {
-      next_pcs = arm_deal_with_atomic_sequence_raw (self, pc);
+      next_pcs = arm_deal_with_atomic_sequence_raw (self);
       if (next_pcs == NULL)
-       next_pcs = arm_get_next_pcs_raw (self, pc);
+       next_pcs = arm_get_next_pcs_raw (self);
     }
 
   return next_pcs;
index 4a0fc16814f6a59474a4e44e33797d0759ad8e33..7cb0858cc70998910337b9d0b1f51082af225669 100644 (file)
@@ -57,7 +57,6 @@ void arm_get_next_pcs_ctor (struct arm_get_next_pcs *self,
                            struct regcache *regcache);
 
 /* Find the next possible PCs after the current instruction executes.  */
-VEC (CORE_ADDR) *arm_get_next_pcs (struct arm_get_next_pcs *self,
-                                  CORE_ADDR pc);
+VEC (CORE_ADDR) *arm_get_next_pcs (struct arm_get_next_pcs *self);
 
 #endif /* ARM_GET_NEXT_PCS_H */
index f6a831ad31eb72c4bad52671b5d68304f157165f..3421f3b6ea05e3a1bc71600cde38ffd9e13fb3c5 100644 (file)
@@ -947,7 +947,7 @@ arm_linux_software_single_step (struct frame_info *frame)
                         1,
                         regcache);
 
-  next_pcs = arm_get_next_pcs (&next_pcs_ctx, regcache_read_pc (regcache));
+  next_pcs = arm_get_next_pcs (&next_pcs_ctx);
 
   for (i = 0; VEC_iterate (CORE_ADDR, next_pcs, i, pc); i++)
     {
index ccc2a038a094eadad9a7930e4f18353d4e39dc95..5a2d490df77905d6cf6a82041c7304b57581a82d 100644 (file)
@@ -6186,7 +6186,7 @@ arm_software_single_step (struct frame_info *frame)
                         0,
                         regcache);
 
-  next_pcs = arm_get_next_pcs (&next_pcs_ctx, regcache_read_pc (regcache));
+  next_pcs = arm_get_next_pcs (&next_pcs_ctx);
 
   for (i = 0; VEC_iterate (CORE_ADDR, next_pcs, i, pc); i++)
     arm_insert_single_step_breakpoint (gdbarch, aspace, pc);
index 8c1677de8215c7a0cbf868d6c633d3f02729321e..e511de99be9026b02c1af88f682f2a6a709a7d72 100644 (file)
@@ -1,3 +1,11 @@
+2016-01-26  Yao Qi  <yao.qi@linaro.org>
+
+       * linux-arm-low.c (arm_gdbserver_get_next_pcs): Remove argument pc.
+       * linux-low.c (install_software_single_step_breakpoints): Don't
+       call regcache_read_pc.
+       * linux-low.h (struct linux_target_ops) <get_next_pcs>: Remove
+       argument pc.
+
 2016-01-26  Yao Qi  <yao.qi@linaro.org>
 
        * linux-low.c (install_software_single_step_breakpoints): Call
index c4f43bb247b45bc537fd49d91cd8f16449c82ed3..0f627069e0ed6678b3a11ce733c199c719d1a813 100644 (file)
@@ -923,7 +923,7 @@ arm_arch_setup (void)
 /* Fetch the next possible PCs after the current instruction executes.  */
 
 static VEC (CORE_ADDR) *
-arm_gdbserver_get_next_pcs (CORE_ADDR pc, struct regcache *regcache)
+arm_gdbserver_get_next_pcs (struct regcache *regcache)
 {
   struct arm_get_next_pcs next_pcs_ctx;
   VEC (CORE_ADDR) *next_pcs = NULL;
@@ -936,7 +936,7 @@ arm_gdbserver_get_next_pcs (CORE_ADDR pc, struct regcache *regcache)
                         1,
                         regcache);
 
-  next_pcs = arm_get_next_pcs (&next_pcs_ctx, pc);
+  next_pcs = arm_get_next_pcs (&next_pcs_ctx);
 
   return next_pcs;
 }
index b35b5693e94c4d8ba92e9e7eeefe75cf10facdb2..bce7580dec4ac5c7e2f153bf85710dddeb3e4a68 100644 (file)
@@ -4103,9 +4103,7 @@ install_software_single_step_breakpoints (struct lwp_info *lwp)
   VEC (CORE_ADDR) *next_pcs = NULL;
   struct cleanup *old_chain = make_cleanup (VEC_cleanup (CORE_ADDR), &next_pcs);
 
-  pc = regcache_read_pc (regcache);
-
-  next_pcs = (*the_low_target.get_next_pcs) (pc, regcache);
+  next_pcs = (*the_low_target.get_next_pcs) (regcache);
 
   for (i = 0; VEC_iterate (CORE_ADDR, next_pcs, i, pc); ++i)
     set_reinsert_breakpoint (pc);
index 4845862df7ffb746e187c0662799ada62b4899e4..0d9eb4008c44e133e4df7492b9f437c8af29b3ac 100644 (file)
@@ -154,7 +154,7 @@ struct linux_target_ops
   const gdb_byte *(*sw_breakpoint_from_kind) (int kind, int *size);
 
   /* Find the next possible PCs after the current instruction executes.  */
-  VEC (CORE_ADDR) *(*get_next_pcs) (CORE_ADDR pc, struct regcache *regcache);
+  VEC (CORE_ADDR) *(*get_next_pcs) (struct regcache *regcache);
 
   int decr_pc_after_break;
   int (*breakpoint_at) (CORE_ADDR pc);
This page took 0.035371 seconds and 4 git commands to generate.