2007-07-03 Ilko Iliev <iliev@ronetix.at>
[deliverable/binutils-gdb.git] / gdb / xtensa-tdep.c
index d2c777d0a006005953adb06a223d3adb3649e8ac..f8024a7a73a97c757944fba5e7c58b46c498e4fb 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for the Xtensa port of GDB, the GNU debugger.
 
-   Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -109,7 +109,8 @@ extern int xtensa_config_byte_order (struct gdbarch_info *);
    indicates that the instruction is an ENTRY instruction.  */
 
 #define XTENSA_IS_ENTRY(op1) \
-  ((TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) ? ((op1) == 0x6c) : ((op1) == 0x36))
+  ((gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) \
+   ? ((op1) == 0x6c) : ((op1) == 0x36))
 
 #define XTENSA_ENTRY_LENGTH  3
 
@@ -140,7 +141,7 @@ extract_call_winsize (CORE_ADDR pc)
 {
   int winsize = 4;     /* Default: No call, e.g. dummy frame.  */
   int insn;
-  char buf[4];
+  gdb_byte buf[4];
 
   DEBUGTRACE ("extract_call_winsize (pc = 0x%08x)\n", (int) pc);
 
@@ -159,7 +160,7 @@ extract_call_winsize (CORE_ADDR pc)
   /* Lookup call insn.
      (Return the default value (4) if we can't find a valid call insn.  */
 
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE)
+  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
     {
       if (((insn & 0xf) == 0x5) || ((insn & 0xcf) == 0xc0))
        winsize = (insn & 0x30) >> 2;   /* 0, 4, 8, 12  */
@@ -181,7 +182,8 @@ static const char *
 xtensa_register_name (int regnum)
 {
   /* Return the name stored in the register map.  */
-  if (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS)
+  if (regnum >= 0 && regnum < gdbarch_num_regs (current_gdbarch)
+                             + gdbarch_num_pseudo_regs (current_gdbarch))
     return REGMAP[regnum].name;
 
   /* Invalid register number.  */
@@ -207,11 +209,12 @@ xtensa_register_type (struct gdbarch *gdbarch, int regnum)
       || (regnum >= A0_BASE && regnum < A0_BASE + 16))
     return builtin_type_int;
 
-  if (regnum == PC_REGNUM || regnum == A1_REGNUM)
+  if (regnum == gdbarch_pc_regnum (current_gdbarch) || regnum == A1_REGNUM)
     return lookup_pointer_type (builtin_type_void);
 
   /* Return the stored type for all other registers.  */
-  else if (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS)
+  else if (regnum >= 0 && regnum < gdbarch_num_regs (current_gdbarch)
+                                  + gdbarch_num_pseudo_regs (current_gdbarch))
     {
       xtensa_register_t* reg = &REGMAP[regnum];
 
@@ -289,7 +292,10 @@ xtensa_reg_to_regnum (int regnum)
   if (regnum >= 0 && regnum < 16)
     return A0_BASE + regnum;
 
-  for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
+  for (i = 0;
+       i < gdbarch_num_regs (current_gdbarch)
+          + gdbarch_num_pseudo_regs (current_gdbarch);
+       i++)
     if (regnum == REGMAP[i].target_number)
       return i;
 
@@ -308,7 +314,8 @@ xtensa_reg_to_regnum (int regnum)
    (Note: The size of masked registers is always less or equal 32 bits.)  */
 
 static void
-xtensa_register_write_masked (xtensa_register_t *reg, unsigned char *buffer)
+xtensa_register_write_masked (struct regcache *regcache,
+                             xtensa_register_t *reg, const gdb_byte *buffer)
 {
   unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
 
@@ -327,7 +334,7 @@ xtensa_register_write_masked (xtensa_register_t *reg, unsigned char *buffer)
   DEBUGTRACE ("xtensa_register_write_masked ()\n");
 
   /* Copy the masked register to host byte-order.  */
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
     for (i = 0; i < bytesize; i++)
       {
        mem >>= 8;
@@ -377,10 +384,12 @@ xtensa_register_write_masked (xtensa_register_t *reg, unsigned char *buffer)
       if (r >= 0 && size > 0)
        {
          /* Don't overwrite the unmasked areas.  */
+         ULONGEST old_val;
+         regcache_cooked_read_unsigned (regcache, r, &old_val);
          m = 0xffffffff >> (32 - size) << start;
          regval <<= start;
-         regval = (regval & m) | (read_register (r) & ~m);
-         write_register (r, regval);
+         regval = (regval & m) | (old_val & ~m);
+         regcache_cooked_write_unsigned (regcache, r, regval);
        }
     }
 }
@@ -390,7 +399,8 @@ xtensa_register_write_masked (xtensa_register_t *reg, unsigned char *buffer)
    register.  */
 
 static void
-xtensa_register_read_masked (xtensa_register_t *reg, unsigned char *buffer)
+xtensa_register_read_masked (struct regcache *regcache,
+                            xtensa_register_t *reg, gdb_byte *buffer)
 {
   unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
 
@@ -413,7 +423,15 @@ xtensa_register_read_masked (xtensa_register_t *reg, unsigned char *buffer)
   for (i = 0; i < mask->count; i++)
     {
       int r = mask->mask[i].reg_num;
-      regval = (r >= 0) ? read_register (r) : 0;
+      if (r >= 0)
+       {
+         ULONGEST val;
+         regcache_cooked_read_unsigned (regcache, r, &val);
+         regval = (unsigned int) val;
+       }
+      else
+       regval = 0;
+
       start = mask->mask[i].bit_start;
       size = mask->mask[i].bit_size;
 
@@ -447,7 +465,7 @@ xtensa_register_read_masked (xtensa_register_t *reg, unsigned char *buffer)
   ptr = value;
   mem = *ptr;
 
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
     for (i = 0; i < bytesize; i++)
       {
        if ((i & 3) == 0)
@@ -484,18 +502,20 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
   /* Read aliases a0..a15.  */
   if (regnum >= A0_REGNUM && regnum <= A15_REGNUM)
     {
-      char *buf = (char *) alloca (MAX_REGISTER_SIZE);
+      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
 
       regcache_raw_read (regcache, WB_REGNUM, buf);
       regnum = AREG_NUMBER (regnum, extract_unsigned_integer (buf, 4));
     }
 
   /* We can always read 'regular' registers.  */
-  if (regnum >= 0 && regnum < NUM_REGS)
+  if (regnum >= 0 && regnum < gdbarch_num_regs (current_gdbarch))
     regcache_raw_read (regcache, regnum, buffer);
 
   /* Pseudo registers.  */
-  else if (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS)
+  else if (regnum >= 0
+           && regnum < gdbarch_num_regs (current_gdbarch)
+                       + gdbarch_num_pseudo_regs (current_gdbarch))
     {
       xtensa_register_t *reg = &REGMAP[regnum];
       xtensa_register_type_t type = reg->type;
@@ -533,7 +553,7 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
       /* We can always read mapped registers.  */
       else if (type == xtRegisterTypeMapped || type == xtRegisterTypeTieState)
         {
-         xtensa_register_read_masked (reg, (unsigned char *) buffer);
+         xtensa_register_read_masked (regcache, reg, buffer);
          return;
        }
 
@@ -565,7 +585,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
   /* Renumber register, if aliase a0..a15.  */
   if (regnum >= A0_REGNUM && regnum <= A15_REGNUM)
     {
-      char *buf = (char *) alloca (MAX_REGISTER_SIZE);
+      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
       unsigned int wb;
 
       regcache_raw_read (regcache, WB_REGNUM, buf);
@@ -574,11 +594,13 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
 
   /* We can always write 'core' registers.
      Note: We might have converted Ax->ARy.  */
-  if (regnum >= 0 && regnum < NUM_REGS)
+  if (regnum >= 0 && regnum < gdbarch_num_regs (current_gdbarch))
     regcache_raw_write (regcache, regnum, buffer);
 
   /* Pseudo registers.  */
-  else if (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS)
+  else if (regnum >= 0
+          && regnum < gdbarch_num_regs (current_gdbarch)
+                      + gdbarch_num_pseudo_regs (current_gdbarch))
     {
       xtensa_register_t *reg = &REGMAP[regnum];
       xtensa_register_type_t type = reg->type;
@@ -619,7 +641,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
       /* We can always write mapped registers.  */
       else if (type == xtRegisterTypeMapped || type == xtRegisterTypeTieState)
         {
-         xtensa_register_write_masked (reg, (unsigned char *) buffer);
+         xtensa_register_write_masked (regcache, reg, buffer);
          return;
        }
 
@@ -701,7 +723,7 @@ xtensa_register_reggroup_p (struct gdbarch *gdbarch,
   if (group == vector_reggroup || group == xtensa_vectra_reggroup)
     return rg & xtRegisterGroupVectra;
   if (group == save_reggroup || group == restore_reggroup)
-    return (regnum < NUM_REGS
+    return (regnum < gdbarch_num_regs (current_gdbarch)
            && (reg->flags & SAVE_REST_FLAGS) == SAVE_REST_VALID);
   else
     return 1;
@@ -726,10 +748,13 @@ xtensa_supply_gregset (const struct regset *regset,
 
   DEBUGTRACE ("xtensa_supply_gregset (..., regnum==%d, ...) \n", regnum);
 
-  if (regnum == PC_REGNUM || regnum == -1)
-    regcache_raw_supply (rc, PC_REGNUM, (char *) &regs->pc);
-  if (regnum == PS_REGNUM || regnum == -1)
-    regcache_raw_supply (rc, PS_REGNUM, (char *) &regs->ps);
+  if (regnum == gdbarch_pc_regnum (current_gdbarch) || regnum == -1)
+    regcache_raw_supply (rc,
+                        gdbarch_pc_regnum (current_gdbarch),
+                        (char *) &regs->pc);
+  if (regnum == gdbarch_ps_regnum (current_gdbarch) || regnum == -1)
+    regcache_raw_supply (rc, gdbarch_ps_regnum (current_gdbarch),
+                        (char *) &regs->ps);
   if (regnum == WB_REGNUM || regnum == -1)
     regcache_raw_supply (rc, WB_REGNUM, (char *) &regs->windowbase);
   if (regnum == WS_REGNUM || regnum == -1)
@@ -776,7 +801,7 @@ xtensa_regset_from_core_section (struct gdbarch *core_arch,
 {
   DEBUGTRACE ("xtensa_regset_from_core_section "
              "(..., sect_name==\"%s\", sect_size==%x) \n",
-             sect_name, sect_size);
+             sect_name, (int) sect_size);
 
   if (strcmp (sect_name, ".reg") == 0
       && sect_size >= sizeof(xtensa_elf_gregset_t))
@@ -842,11 +867,11 @@ xtensa_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
 static CORE_ADDR
 xtensa_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
-  char buf[8];
+  gdb_byte buf[8];
 
   DEBUGTRACE ("xtensa_unwind_pc (next_frame = %p)\n", next_frame);
 
-  frame_unwind_register (next_frame, PC_REGNUM, buf);
+  frame_unwind_register (next_frame, gdbarch_pc_regnum (current_gdbarch), buf);
 
   DEBUGINFO ("[xtensa_unwind_pc] pc = 0x%08x\n", (unsigned int)
             extract_typed_address (buf, builtin_type_void_func_ptr));
@@ -859,7 +884,7 @@ static struct frame_id
 xtensa_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
   CORE_ADDR pc, fp;
-  char buf[4];
+  gdb_byte buf[4];
 
   /* next_frame->prev is a dummy frame. Return a frame ID of that frame.  */
 
@@ -896,14 +921,15 @@ xtensa_frame_cache (struct frame_info *next_frame, void **this_cache)
   /* Get windowbase, windowstart, ps, and pc.  */
   wb = frame_unwind_register_unsigned (next_frame, WB_REGNUM);
   ws = frame_unwind_register_unsigned (next_frame, WS_REGNUM);
-  ps = frame_unwind_register_unsigned (next_frame, PS_REGNUM);
-  pc = frame_unwind_register_unsigned (next_frame, PC_REGNUM);
+  ps = frame_unwind_register_unsigned (next_frame,
+                                      gdbarch_ps_regnum (current_gdbarch));
+  pc = frame_unwind_register_unsigned (next_frame,
+                                      gdbarch_pc_regnum (current_gdbarch));
 
   op1 = read_memory_integer (pc, 1);
-  if (XTENSA_IS_ENTRY (op1) || !windowing_enabled (read_register (PS_REGNUM)))
+  if (XTENSA_IS_ENTRY (op1) || !windowing_enabled (ps))
     {
-      int callinc = CALLINC (frame_unwind_register_unsigned (next_frame,
-                                                            PS_REGNUM));
+      int callinc = CALLINC (ps);
       ra = frame_unwind_register_unsigned (next_frame,
                                           A0_REGNUM + callinc * 4);
 
@@ -914,7 +940,7 @@ xtensa_frame_cache (struct frame_info *next_frame, void **this_cache)
       cache->callsize = 0;
       cache->wb = wb;
       cache->ws = ws;
-      cache->prev_sp = read_register (A1_REGNUM);
+      cache->prev_sp = frame_unwind_register_unsigned (next_frame, A1_REGNUM);
     }
   else
     {
@@ -924,7 +950,7 @@ xtensa_frame_cache (struct frame_info *next_frame, void **this_cache)
       cache->ws = ws & ~(1 << wb);
     }
 
-  cache->pc = ((frame_func_unwind (next_frame) & 0xc0000000)
+  cache->pc = ((frame_func_unwind (next_frame, NORMAL_FRAME) & 0xc0000000)
               | (ra & 0x3fffffff));
   cache->ps = (ps & ~PS_CALLINC_MASK) | ((WINSIZE(ra)/4) << PS_CALLINC_SHIFT);
 
@@ -977,7 +1003,7 @@ xtensa_frame_cache (struct frame_info *next_frame, void **this_cache)
 
          int regnum = AREG_NUMBER (A1_REGNUM, cache->wb);
 
-         cache->prev_sp = read_register (regnum);
+         cache->prev_sp = frame_unwind_register_unsigned (next_frame, regnum);
        }
     }
 
@@ -1001,8 +1027,8 @@ xtensa_frame_this_id (struct frame_info *next_frame,
   struct xtensa_frame_cache *cache =
     xtensa_frame_cache (next_frame, this_cache);
 
-  DEBUGTRACE ("xtensa_frame_this_id (next 0x%08x, *this 0x%08x)\n",
-             (unsigned int) next_frame, (unsigned int) *this_cache);
+  DEBUGTRACE ("xtensa_frame_this_id (next %p, *this %p)\n",
+             next_frame, *this_cache);
 
   if (cache->prev_sp == 0)
     return;
@@ -1026,10 +1052,10 @@ xtensa_frame_prev_register (struct frame_info *next_frame,
   CORE_ADDR saved_reg = 0;
   int done = 1;
 
-  DEBUGTRACE ("xtensa_frame_prev_register (next 0x%08x, "
-             "*this 0x%08x, regnum %d (%s), ...)\n",
-             (unsigned int) next_frame,
-             *this_cache? (unsigned int) *this_cache : 0, regnum,
+  DEBUGTRACE ("xtensa_frame_prev_register (next %p, "
+             "*this %p, regnum %d (%s), ...)\n",
+             next_frame,
+             *this_cache ? *this_cache : 0, regnum,
              xtensa_register_name (regnum));
 
   if (regnum == WS_REGNUM)
@@ -1041,9 +1067,9 @@ xtensa_frame_prev_register (struct frame_info *next_frame,
     }
   else if (regnum == WB_REGNUM)
     saved_reg = cache->wb;
-  else if (regnum == PC_REGNUM)
+  else if (regnum == gdbarch_pc_regnum (current_gdbarch))
     saved_reg = cache->pc;
-  else if (regnum == PS_REGNUM)
+  else if (regnum == gdbarch_ps_regnum (current_gdbarch))
     saved_reg = cache->ps;
   else
     done = 0;
@@ -1148,7 +1174,8 @@ xtensa_extract_return_value (struct type *type,
   gdb_assert(len > 0);
 
   /* First, we have to find the caller window in the register file.  */
-  regcache_raw_read_unsigned (regcache, PC_REGNUM, &pc);
+  regcache_raw_read_unsigned (regcache,
+                             gdbarch_pc_regnum (current_gdbarch), &pc);
   callsize = extract_call_winsize (pc);
 
   /* On Xtensa, we can return up to 4 words (or 2 when called by call12).  */
@@ -1163,7 +1190,7 @@ xtensa_extract_return_value (struct type *type,
 
   DEBUGINFO ("[xtensa_extract_return_value] areg %d len %d\n", areg, len);
 
-  if (len < 4 && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+  if (len < 4 && gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
     offset = 4 - len;
 
   for (; len > 0; len -= 4, areg++, valbuf += 4)
@@ -1191,7 +1218,8 @@ xtensa_store_return_value (struct type *type,
   DEBUGTRACE ("xtensa_store_return_value (...)\n");
 
   regcache_raw_read_unsigned (regcache, WB_REGNUM, &wb);
-  regcache_raw_read_unsigned (regcache, PC_REGNUM, &pc);
+  regcache_raw_read_unsigned (regcache,
+                             gdbarch_pc_regnum (current_gdbarch), &pc);
   callsize = extract_call_winsize (pc);
 
   if (len > (callsize > 8 ? 8 : 16))
@@ -1202,7 +1230,7 @@ xtensa_store_return_value (struct type *type,
   DEBUGTRACE ("[xtensa_store_return_value] callsize %d wb %d\n",
               callsize, (int) wb);
 
-  if (len < 4 && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+  if (len < 4 && gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
     offset = 4 - len;
 
   areg = AREG_NUMBER (A2_REGNUM + callsize, wb);
@@ -1265,7 +1293,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
 {
   int i;
   int size, onstack_size;
-  char *buf = (char *) alloca (16);
+  gdb_byte *buf = (gdb_byte *) alloca (16);
   CORE_ADDR ra, ps;
   struct argument_info
   {
@@ -1299,8 +1327,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
         {
          struct value *arg = args[i];
          struct type *arg_type = check_typedef (value_type (arg));
-         fprintf_unfiltered (gdb_stdlog, "%2d: 0x%08x %3d ",
-                             i, (int) arg, TYPE_LENGTH (arg_type));
+         fprintf_unfiltered (gdb_stdlog, "%2d: %p %3d ",
+                             i, arg, TYPE_LENGTH (arg_type));
          switch (TYPE_CODE (arg_type))
            {
            case TYPE_CODE_INT:
@@ -1313,8 +1341,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
              fprintf_unfiltered (gdb_stdlog, "%3d", TYPE_CODE (arg_type));
              break;
            }
-         fprintf_unfiltered (gdb_stdlog, " 0x%08x\n",
-                             (unsigned int) value_contents (arg));
+         fprintf_unfiltered (gdb_stdlog, " %p\n",
+                             value_contents (arg));
        }
     }
 
@@ -1419,7 +1447,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
             word in big-endian mode and require a shift.  This only
             applies for structures smaller than one word.  */
 
-         if (n < REGISTER_SIZE && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+         if (n < REGISTER_SIZE
+             && gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
            offset += (REGISTER_SIZE - n);
 
          write_memory (offset, info->contents, info->length);
@@ -1437,7 +1466,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
             than REGISTER_SIZE; for larger odd-sized structures the excess
             will be left-aligned in the register on both endiannesses.  */
 
-         if (n < REGISTER_SIZE && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+         if (n < REGISTER_SIZE
+             && gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
            {
              ULONGEST v = extract_unsigned_integer (cp, REGISTER_SIZE);
              v = v >> ((REGISTER_SIZE - n) * TARGET_CHAR_BIT);
@@ -1455,7 +1485,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
                /* ULONGEST v = extract_unsigned_integer (cp, REGISTER_SIZE);*/
                regcache_cooked_write (regcache, r, cp);
 
-               /* write_register (r, v); */
+               /* regcache_cooked_write_unsigned (regcache, r, v); */
                cp += REGISTER_SIZE;
                n -= REGISTER_SIZE;
                r++;
@@ -1469,10 +1499,12 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
      saved in the dummy frame, so we can savely overwrite A0 here.  */
 
   ra = (bp_addr & 0x3fffffff) | 0x40000000;
-  regcache_raw_read (regcache, PS_REGNUM, buf);
+  regcache_raw_read (regcache, gdbarch_ps_regnum (current_gdbarch), buf);
   ps = extract_unsigned_integer (buf, 4) & ~0x00030000;
   regcache_cooked_write_unsigned (regcache, A4_REGNUM, ra);
-  regcache_cooked_write_unsigned (regcache, PS_REGNUM, ps | 0x00010000);
+  regcache_cooked_write_unsigned (regcache,
+                                 gdbarch_ps_regnum (current_gdbarch),
+                                 ps | 0x00010000);
 
   /* Set new stack pointer and return it.  */
   regcache_cooked_write_unsigned (regcache, A1_REGNUM, sp);
@@ -1493,16 +1525,16 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
 const unsigned char *
 xtensa_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
 {
-  static char big_breakpoint[] = BIG_BREAKPOINT;
-  static char little_breakpoint[] = LITTLE_BREAKPOINT;
-  static char density_big_breakpoint[] = DENSITY_BIG_BREAKPOINT;
-  static char density_little_breakpoint[] = DENSITY_LITTLE_BREAKPOINT;
+  static unsigned char big_breakpoint[] = BIG_BREAKPOINT;
+  static unsigned char little_breakpoint[] = LITTLE_BREAKPOINT;
+  static unsigned char density_big_breakpoint[] = DENSITY_BIG_BREAKPOINT;
+  static unsigned char density_little_breakpoint[] = DENSITY_LITTLE_BREAKPOINT;
 
   DEBUGTRACE ("xtensa_breakpoint_from_pc (pc = 0x%08x)\n", (int) *pcptr);
 
   if (ISA_USE_DENSITY_INSTRUCTIONS)
     {
-      if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+      if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
        {
          *lenptr = sizeof (density_big_breakpoint);
          return density_big_breakpoint;
@@ -1515,7 +1547,7 @@ xtensa_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
     }
   else
     {
-      if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+      if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
        {
          *lenptr = sizeof (big_breakpoint);
          return big_breakpoint;
This page took 0.035983 seconds and 4 git commands to generate.