gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / arch / arm-get-next-pcs.c
index 3178bf311c1b4e32740ec48ac4e6baa99443ea0b..0c49a77245bfa796baf796ffeae5d5c6739429a2 100644 (file)
@@ -1,6 +1,6 @@
 /* Common code for ARM software single stepping support.
 
-   Copyright (C) 1988-2018 Free Software Foundation, Inc.
+   Copyright (C) 1988-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "common-defs.h"
-#include "gdb_vecs.h"
-#include "common-regcache.h"
+#include "gdbsupport/common-defs.h"
+#include "gdbsupport/gdb_vecs.h"
+#include "gdbsupport/common-regcache.h"
 #include "arm.h"
 #include "arm-get-next-pcs.h"
+#include "count-one-bits.h"
 
 /* See arm-get-next-pcs.h.  */
 
@@ -271,7 +272,6 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
   unsigned long pc_val = ((unsigned long) pc) + 4;     /* PC after prefetch */
   unsigned short inst1;
   CORE_ADDR nextpc = pc + 2;           /* Default is next instruction.  */
-  unsigned long offset;
   ULONGEST status, itstate;
   struct regcache *regcache = self->regcache;
   std::vector<CORE_ADDR> next_pcs;
@@ -409,7 +409,8 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
 
       /* Fetch the saved PC from the stack.  It's stored above
          all of the other registers.  */
-      offset = bitcount (bits (inst1, 0, 7)) * INT_REGISTER_SIZE;
+      unsigned long offset
+       = count_one_bits (bits (inst1, 0, 7)) * ARM_INT_REGISTER_SIZE;
       sp = regcache_raw_get_unsigned (regcache, ARM_SP_REGNUM);
       nextpc = self->ops->read_mem_uint (sp + offset, 4, byte_order);
     }
@@ -450,7 +451,7 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
              j1 = bit (inst2, 13);
              j2 = bit (inst2, 11);
 
-             offset = ((imm1 << 12) + (imm2 << 1));
+             unsigned long offset = ((imm1 << 12) + (imm2 << 1));
              offset ^= ((!j2) << 22) | ((!j1) << 23);
 
              nextpc = pc_val + offset;
@@ -477,7 +478,8 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
                  j1 = bit (inst2, 13);
                  j2 = bit (inst2, 11);
 
-                 offset = (sign << 20) + (j2 << 19) + (j1 << 18);
+                 unsigned long offset
+                   = (sign << 20) + (j2 << 19) + (j1 << 18);
                  offset += (imm1 << 12) + (imm2 << 1);
 
                  nextpc = pc_val + offset;
@@ -495,7 +497,7 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
              /* LDMIA or POP */
              if (!bit (inst2, 15))
                load_pc = 0;
-             offset = bitcount (inst2) * 4 - 4;
+             offset = count_one_bits (inst2) * 4 - 4;
            }
          else if (!bit (inst1, 7) && bit (inst1, 8))
            {
@@ -863,7 +865,7 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self)
                    {
                      /* up */
                      unsigned long reglist = bits (this_instr, 0, 14);
-                     offset = bitcount (reglist) * 4;
+                     offset = count_one_bits_l (reglist) * 4;
                      if (bit (this_instr, 24))         /* pre */
                        offset += 4;
                    }
This page took 0.025824 seconds and 4 git commands to generate.