gas: blackfin: handle multibyte symbols
[deliverable/binutils-gdb.git] / gdb / xtensa-tdep.c
index 0ca54e403ff2cd8fbd8c642ad1e883767d336ac0..e09a90e08b6e91fcf59b830792464bf871d0fc0a 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for the Xtensa port of GDB, the GNU debugger.
 
-   Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009
+   Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -35,7 +35,7 @@
 #include "regset.h"
 
 #include "dummy-frame.h"
-#include "elf/dwarf2.h"
+#include "dwarf2.h"
 #include "dwarf2-frame.h"
 #include "dwarf2loc.h"
 #include "frame.h"
@@ -165,6 +165,7 @@ windowing_enabled (CORE_ADDR ps)
 static int
 extract_call_winsize (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int winsize = 4;
   int insn;
   gdb_byte buf[4];
@@ -173,7 +174,7 @@ extract_call_winsize (struct gdbarch *gdbarch, CORE_ADDR pc)
 
   /* Read the previous instruction (should be a call[x]{4|8|12}.  */
   read_memory (pc-3, buf, 3);
-  insn = extract_unsigned_integer (buf, 3);
+  insn = extract_unsigned_integer (buf, 3, byte_order);
 
   /* Decode call instruction:
      Little Endian
@@ -183,7 +184,7 @@ extract_call_winsize (struct gdbarch *gdbarch, CORE_ADDR pc)
        call{0,4,8,12}   0101 || {00,01,10,11} || OFFSET
        callx{0,4,8,12}  0000 || {00,01,10,11} || 11 || OFFSET.  */
 
-  if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
+  if (byte_order == BFD_ENDIAN_LITTLE)
     {
       if (((insn & 0xf) == 0x5) || ((insn & 0xcf) == 0xc0))
        winsize = (insn & 0x30) >> 2;   /* 0, 4, 8, 12.  */
@@ -214,33 +215,27 @@ xtensa_register_name (struct gdbarch *gdbarch, int regnum)
 
 /* Return the type of a register.  Create a new type, if necessary.  */
 
-static struct ctype_cache
-{
-  struct ctype_cache *next;
-  int size;
-  struct type *virtual_type;
-} *type_entries = NULL;
-
 static struct type *
 xtensa_register_type (struct gdbarch *gdbarch, int regnum)
 {
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
   /* Return signed integer for ARx and Ax registers.  */
-  if ((regnum >= gdbarch_tdep (gdbarch)->ar_base
-      && regnum < gdbarch_tdep (gdbarch)->ar_base
-                   + gdbarch_tdep (gdbarch)->num_aregs)
-      || (regnum >= gdbarch_tdep (gdbarch)->a0_base
-      && regnum < gdbarch_tdep (gdbarch)->a0_base + 16))
+  if ((regnum >= tdep->ar_base
+       && regnum < tdep->ar_base + tdep->num_aregs)
+      || (regnum >= tdep->a0_base
+         && regnum < tdep->a0_base + 16))
     return builtin_type (gdbarch)->builtin_int;
 
   if (regnum == gdbarch_pc_regnum (gdbarch)
-      || regnum == gdbarch_tdep (gdbarch)->a0_base + 1)
+      || regnum == tdep->a0_base + 1)
     return builtin_type (gdbarch)->builtin_data_ptr;
 
   /* Return the stored type for all other registers.  */
   else if (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch)
                                   + gdbarch_num_pseudo_regs (gdbarch))
     {
-      xtensa_register_t* reg = &gdbarch_tdep (gdbarch)->regmap[regnum];
+      xtensa_register_t* reg = &tdep->regmap[regnum];
 
       /* Set ctype for this register (only the first time).  */
 
@@ -254,27 +249,27 @@ xtensa_register_type (struct gdbarch *gdbarch, int regnum)
          switch (size)
            {
            case 1:
-             reg->ctype = builtin_type_uint8;
+             reg->ctype = builtin_type (gdbarch)->builtin_uint8;
              break;
 
            case 2:
-             reg->ctype = builtin_type_uint16;
+             reg->ctype = builtin_type (gdbarch)->builtin_uint16;
              break;
 
            case 4:
-             reg->ctype = builtin_type_uint32;
+             reg->ctype = builtin_type (gdbarch)->builtin_uint32;
              break;
 
            case 8:
-             reg->ctype = builtin_type_uint64;
+             reg->ctype = builtin_type (gdbarch)->builtin_uint64;
              break;
 
            case 16:
-             reg->ctype = builtin_type_uint128;
+             reg->ctype = builtin_type (gdbarch)->builtin_uint128;
              break;
 
            default:
-             for (tp = type_entries; tp != NULL; tp = tp->next)
+             for (tp = tdep->type_entries; tp != NULL; tp = tp->next)
                if (tp->size == size)
                  break;
 
@@ -282,14 +277,13 @@ xtensa_register_type (struct gdbarch *gdbarch, int regnum)
                {
                  char *name = xmalloc (16);
                  tp = xmalloc (sizeof (struct ctype_cache));
-                 tp->next = type_entries;
-                 type_entries = tp;
+                 tp->next = tdep->type_entries;
+                 tdep->type_entries = tp;
                  tp->size = size;
 
                  sprintf (name, "int%d", size * 8);
-                 tp->virtual_type = init_type (TYPE_CODE_INT, size,
-                                               TYPE_FLAG_UNSIGNED, name,
-                                               NULL);
+                 tp->virtual_type
+                   = arch_integer_type (gdbarch, size * 8, 1, xstrdup (name));
                }
 
              reg->ctype = tp->virtual_type;
@@ -509,6 +503,8 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
                             int regnum,
                             gdb_byte *buffer)
 {
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+
   DEBUGTRACE ("xtensa_pseudo_register_read (... regnum = %d (%s) ...)\n",
              regnum, xtensa_register_name (gdbarch, regnum));
 
@@ -525,7 +521,7 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
 
       regcache_raw_read (regcache, gdbarch_tdep (gdbarch)->wb_regnum, buf);
       regnum = arreg_number (gdbarch, regnum,
-                            extract_unsigned_integer (buf, 4));
+                            extract_unsigned_integer (buf, 4, byte_order));
     }
 
   /* We can always read non-pseudo registers.  */
@@ -605,6 +601,8 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
                              int regnum,
                              const gdb_byte *buffer)
 {
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+
   DEBUGTRACE ("xtensa_pseudo_register_write (... regnum = %d (%s) ...)\n",
              regnum, xtensa_register_name (gdbarch, regnum));
 
@@ -623,7 +621,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
       regcache_raw_read (regcache,
                         gdbarch_tdep (gdbarch)->wb_regnum, buf);
       regnum = arreg_number (gdbarch, regnum,
-                            extract_unsigned_integer (buf, 4));
+                            extract_unsigned_integer (buf, 4, byte_order));
     }
 
   /* We can always write 'core' registers.
@@ -813,7 +811,7 @@ xtensa_supply_gregset (const struct regset *regset,
   struct gdbarch *gdbarch = get_regcache_arch (rc);
   int i;
 
-  DEBUGTRACE ("xtensa_supply_gregset (..., regnum==%d, ...) \n", regnum);
+  DEBUGTRACE ("xtensa_supply_gregset (..., regnum==%d, ...)\n", regnum);
 
   if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1)
     regcache_raw_supply (rc, gdbarch_pc_regnum (gdbarch), (char *) &regs->pc);
@@ -871,7 +869,7 @@ xtensa_regset_from_core_section (struct gdbarch *core_arch,
                                 size_t sect_size)
 {
   DEBUGTRACE ("xtensa_regset_from_core_section "
-             "(..., sect_name==\"%s\", sect_size==%x) \n",
+             "(..., sect_name==\"%s\", sect_size==%x)\n",
              sect_name, (unsigned int) sect_size);
 
   if (strcmp (sect_name, ".reg") == 0
@@ -1018,7 +1016,8 @@ xtensa_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
   gdb_byte buf[8];
   CORE_ADDR pc;
 
-  DEBUGTRACE ("xtensa_unwind_pc (next_frame = %p)\n", next_frame);
+  DEBUGTRACE ("xtensa_unwind_pc (next_frame = %s)\n", 
+               host_address_to_string (next_frame));
 
   frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
   pc = extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
@@ -1047,7 +1046,8 @@ xtensa_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 /* Returns the best guess about which register is a frame pointer
    for the function containing CURRENT_PC.  */
 
-#define XTENSA_ISA_BSZ 32          /* Instruction buffer size.  */
+#define XTENSA_ISA_BSZ         32              /* Instruction buffer size.  */
+#define XTENSA_ISA_BADPC       ((CORE_ADDR)0)  /* Bad PC value.  */
 
 static unsigned int
 xtensa_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR current_pc)
@@ -1084,7 +1084,8 @@ xtensa_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR current_pc)
          ba = ia;
          bt = (ba + XTENSA_ISA_BSZ) < current_pc
            ? ba + XTENSA_ISA_BSZ : current_pc;
-         read_memory (ba, ibuf, bt - ba);
+         if (target_read_memory (ba, ibuf, bt - ba) != 0)
+           RETURN_FP;
        }
 
       xtensa_insnbuf_from_chars (isa, ins, &ibuf[ia-ba], 0);
@@ -1179,6 +1180,7 @@ xtensa_frame_cache (struct frame_info *this_frame, void **this_cache)
   xtensa_frame_cache_t *cache;
   CORE_ADDR ra, wb, ws, pc, sp, ps;
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   unsigned int fp_regnum;
   char op1;
   int  windowed;
@@ -1203,7 +1205,7 @@ xtensa_frame_cache (struct frame_info *this_frame, void **this_cache)
       ws = get_frame_register_unsigned (this_frame,
                                        gdbarch_tdep (gdbarch)->ws_regnum);
 
-      op1 = read_memory_integer (pc, 1);
+      op1 = read_memory_integer (pc, 1, byte_order);
       if (XTENSA_IS_ENTRY (gdbarch, op1))
        {
          int callinc = CALLINC (ps);
@@ -1241,7 +1243,7 @@ xtensa_frame_cache (struct frame_info *this_frame, void **this_cache)
          cache->wd.ws = ws & ~(1 << wb);
 
          cache->pc = get_frame_func (this_frame);
-         cache->ra = (cache->pc & 0xc0000000) | (ra & 0x3fffffff);
+         cache->ra = (pc & 0xc0000000) | (ra & 0x3fffffff);
          cache->ps = (ps & ~PS_CALLINC_MASK)
            | ((WINSIZE(ra)/4) << PS_CALLINC_SHIFT);
        }
@@ -1264,8 +1266,8 @@ xtensa_frame_cache (struct frame_info *this_frame, void **this_cache)
              /* Set A4...A7/A11.  */
              /* Get the SP of the frame previous to the previous one.
                 To achieve this, we have to dereference SP twice.  */
-             sp = (CORE_ADDR) read_memory_integer (sp - 12, 4);
-             sp = (CORE_ADDR) read_memory_integer (sp - 12, 4);
+             sp = (CORE_ADDR) read_memory_integer (sp - 12, 4, byte_order);
+             sp = (CORE_ADDR) read_memory_integer (sp - 12, 4, byte_order);
              sp -= cache->wd.callsize * 4;
 
              for ( i = 4; i < cache->wd.callsize; i++, sp += 4)
@@ -1285,7 +1287,7 @@ xtensa_frame_cache (struct frame_info *this_frame, void **this_cache)
                 We can read caller's SP from the proper spill loction.  */
              sp = get_frame_register_unsigned
                (this_frame, gdbarch_tdep (gdbarch)->a0_base + 1);
-             cache->prev_sp = read_memory_integer (sp - 12, 4); 
+             cache->prev_sp = read_memory_integer (sp - 12, 4, byte_order);
            }
          else
            {
@@ -1597,6 +1599,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
                        int struct_return,
                        CORE_ADDR struct_addr)
 {
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int i;
   int size, onstack_size;
   gdb_byte *buf = (gdb_byte *) alloca (16);
@@ -1633,8 +1636,9 @@ 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%lx %3d ",
-                             i, (unsigned long) arg, TYPE_LENGTH (arg_type));
+         fprintf_unfiltered (gdb_stdlog, "%2d: %s %3d ", i,
+                             host_address_to_string (arg),
+                             TYPE_LENGTH (arg_type));
          switch (TYPE_CODE (arg_type))
            {
            case TYPE_CODE_INT:
@@ -1647,8 +1651,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
              fprintf_unfiltered (gdb_stdlog, "%3d", TYPE_CODE (arg_type));
              break;
            }
-         fprintf_unfiltered (gdb_stdlog, " 0x%lx\n",
-                             (unsigned long) value_contents (arg));
+         fprintf_unfiltered (gdb_stdlog, " %s\n",
+                             host_address_to_string (value_contents (arg)));
        }
     }
 
@@ -1740,7 +1744,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
 
   if (struct_return)
     {
-      store_unsigned_integer (buf, REGISTER_SIZE, struct_addr);
+      store_unsigned_integer (buf, REGISTER_SIZE, byte_order, struct_addr);
       regcache_cooked_write (regcache, ARG_1ST (gdbarch), buf);
     }
 
@@ -1776,13 +1780,13 @@ 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
-             && gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
+         if (n < REGISTER_SIZE && byte_order == BFD_ENDIAN_BIG)
            {
-             ULONGEST v = extract_unsigned_integer (cp, REGISTER_SIZE);
+             ULONGEST v;
+             v = extract_unsigned_integer (cp, REGISTER_SIZE, byte_order);
              v = v >> ((REGISTER_SIZE - n) * TARGET_CHAR_BIT);
 
-             store_unsigned_integer (buf, REGISTER_SIZE, v);
+             store_unsigned_integer (buf, REGISTER_SIZE, byte_order, v);
              regcache_cooked_write (regcache, r, buf);
 
              cp += REGISTER_SIZE;
@@ -1809,7 +1813,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
     {
       ra = (bp_addr & 0x3fffffff) | 0x40000000;
       regcache_raw_read (regcache, gdbarch_ps_regnum (gdbarch), buf);
-      ps = extract_unsigned_integer (buf, 4) & ~0x00030000;
+      ps = extract_unsigned_integer (buf, 4, byte_order) & ~0x00030000;
       regcache_cooked_write_unsigned
        (regcache, gdbarch_tdep (gdbarch)->a0_base + 4, ra);
       regcache_cooked_write_unsigned (regcache,
@@ -1822,9 +1826,9 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
         is only one register window corresponding to WINDOWEBASE.  */
 
       regcache_raw_read (regcache, gdbarch_tdep (gdbarch)->wb_regnum, buf);
-      regcache_cooked_write_unsigned (regcache,
-                                     gdbarch_tdep (gdbarch)->ws_regnum,
-                                     1 << extract_unsigned_integer (buf, 4));
+      regcache_cooked_write_unsigned
+       (regcache, gdbarch_tdep (gdbarch)->ws_regnum,
+        1 << extract_unsigned_integer (buf, 4, byte_order));
     }
   else
     {
@@ -1976,10 +1980,12 @@ call0_classify_opcode (xtensa_isa isa, xtensa_opcode opc)
    the stack frame.  */
 
 static void
-call0_track_op (xtensa_c0reg_t dst[], xtensa_c0reg_t src[],
+call0_track_op (struct gdbarch *gdbarch,
+               xtensa_c0reg_t dst[], xtensa_c0reg_t src[],
                xtensa_insn_kind opclass, int nods, unsigned odv[],
                CORE_ADDR pc, CORE_ADDR litbase, int spreg)
 {
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   unsigned litaddr, litval;
 
   switch (opclass)
@@ -2033,7 +2039,7 @@ call0_track_op (xtensa_c0reg_t dst[], xtensa_c0reg_t src[],
       litaddr = litbase & 1
                  ? (litbase & ~1) + (signed)odv[1]
                  : (pc + 3  + (signed)odv[1]) & ~3;
-      litval = read_memory_integer(litaddr, 4);
+      litval = read_memory_integer (litaddr, 4, byte_order);
       dst[odv[0]].fr_reg = C0_CONST;
       dst[odv[0]].fr_ofs = litval;
       break;
@@ -2052,7 +2058,7 @@ call0_track_op (xtensa_c0reg_t dst[], xtensa_c0reg_t src[],
        }
       break;
     default:
-       gdb_assert (0);
+       gdb_assert_not_reached ("unexpected instruction kind");
     }
 }
 
@@ -2086,7 +2092,8 @@ call0_track_op (xtensa_c0reg_t dst[], xtensa_c0reg_t src[],
       because they begin with default assumptions that analysis may change.  */
 
 static CORE_ADDR
-call0_analyze_prologue (CORE_ADDR start, CORE_ADDR pc, CORE_ADDR litbase,
+call0_analyze_prologue (struct gdbarch *gdbarch,
+                       CORE_ADDR start, CORE_ADDR pc, CORE_ADDR litbase,
                        int nregs, xtensa_c0reg_t rt[], int *call0)
 {
   CORE_ADDR ia;                    /* Current insn address in prologue.  */
@@ -2121,7 +2128,7 @@ call0_analyze_prologue (CORE_ADDR start, CORE_ADDR pc, CORE_ADDR litbase,
      Assume we may be in the prologue until we hit a flow control instr.  */
 
   rtmp = NULL;
-  body_pc = INT_MAX;
+  body_pc = UINT_MAX;
   end_pc = 0;
 
   /* Find out, if we have an information about the prologue from DWARF.  */
@@ -2167,6 +2174,8 @@ call0_analyze_prologue (CORE_ADDR start, CORE_ADDR pc, CORE_ADDR litbase,
          ba = ia;
          bt = (ba + XTENSA_ISA_BSZ) < body_pc ? ba + XTENSA_ISA_BSZ : body_pc;
          read_memory (ba, ibuf, bt - ba);
+         /* If there is a memory reading error read_memory () will report it
+            and then throw an exception, stopping command execution.  */
        }
 
       /* Decode format information.  */
@@ -2277,7 +2286,8 @@ call0_analyze_prologue (CORE_ADDR start, CORE_ADDR pc, CORE_ADDR litbase,
            }
 
          /* Track register movement and modification for this operation.  */
-         call0_track_op (rt, rtmp, opclass, nods, odv, ia, litbase, 1);
+         call0_track_op (gdbarch, rt, rtmp, opclass,
+                         nods, odv, ia, litbase, 1);
        }
     }
 done:
@@ -2285,7 +2295,7 @@ done:
             (unsigned)ia, fail ? "failed" : "succeeded");
   xtensa_insnbuf_free(isa, slot);
   xtensa_insnbuf_free(isa, ins);
-  return fail ? 0 : ia;
+  return fail ? XTENSA_ISA_BADPC : ia;
 }
 
 /* Initialize frame cache for the current frame in CALL0 ABI.  */
@@ -2295,6 +2305,7 @@ call0_frame_cache (struct frame_info *this_frame,
                   xtensa_frame_cache_t *cache, CORE_ADDR pc, CORE_ADDR litbase)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR start_pc;          /* The beginning of the function.  */
   CORE_ADDR body_pc=UINT_MAX;  /* PC, where prologue analysis stopped.  */
   CORE_ADDR sp, fp, ra;
@@ -2305,9 +2316,14 @@ call0_frame_cache (struct frame_info *this_frame,
 
   if (find_pc_partial_function (pc, NULL, &start_pc, NULL))
     {
-      body_pc = call0_analyze_prologue (start_pc, pc, litbase, C0_NREGS,
+      body_pc = call0_analyze_prologue (gdbarch, start_pc, pc, litbase,
+                                       C0_NREGS,
                                        &cache->c0.c0_rt[0],
                                        &cache->call0);
+
+      if (body_pc == XTENSA_ISA_BADPC)
+       error (_("Xtensa-specific internal error: CALL0 prologue \
+analysis failed in this frame. GDB command execution stopped."));
     }
   
   sp = get_frame_register_unsigned
@@ -2360,7 +2376,8 @@ call0_frame_cache (struct frame_info *this_frame,
   to_stk = cache->c0.c0_rt[C0_RA].to_stk;
   if (to_stk != C0_NOSTK)
     ra = (CORE_ADDR) 
-      read_memory_integer (sp + c0_frmsz + cache->c0.c0_rt[C0_RA].to_stk, 4);
+      read_memory_integer (sp + c0_frmsz + cache->c0.c0_rt[C0_RA].to_stk,
+                          4, byte_order);
 
   else if (cache->c0.c0_rt[C0_RA].fr_reg == C0_CONST
           && cache->c0.c0_rt[C0_RA].fr_ofs == 0)
@@ -2445,7 +2462,7 @@ call0_frame_cache (struct frame_info *this_frame,
 
 /* #define DONT_SKIP_PROLOGUE  */
 
-CORE_ADDR
+static CORE_ADDR
 xtensa_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
 {
   struct symtab_and_line prologue_sal;
@@ -2479,7 +2496,7 @@ xtensa_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
     }
 
   /* No debug line info.  Analyze prologue for Call0 or simply skip ENTRY.  */
-  body_pc = call0_analyze_prologue(start_pc, 0, 0, 0, NULL, NULL);
+  body_pc = call0_analyze_prologue (gdbarch, start_pc, 0, 0, 0, NULL, NULL);
   return body_pc != 0 ? body_pc : start_pc;
 }
 
@@ -2490,7 +2507,7 @@ xtensa_verify_config (struct gdbarch *gdbarch)
   struct ui_file *log;
   struct cleanup *cleanups;
   struct gdbarch_tdep *tdep;
-  long dummy;
+  long length;
   char *buf;
 
   tdep = gdbarch_tdep (gdbarch);
@@ -2523,9 +2540,9 @@ xtensa_verify_config (struct gdbarch *gdbarch)
   if (tdep->a0_base == -1)
     fprintf_unfiltered (log, _("\n\ta0_base: No Ax registers"));
 
-  buf = ui_file_xstrdup (log, &dummy);
+  buf = ui_file_xstrdup (log, &length);
   make_cleanup (xfree, buf);
-  if (strlen (buf) > 0)
+  if (length > 0)
     internal_error (__FILE__, __LINE__,
                    _("the following are invalid: %s"), buf);
   do_cleanups (cleanups);
@@ -2534,7 +2551,7 @@ xtensa_verify_config (struct gdbarch *gdbarch)
 
 /* Derive specific register numbers from the array of registers.  */
 
-void
+static void
 xtensa_derive_tdep (struct gdbarch_tdep *tdep)
 {
   xtensa_register_t* rmap;
@@ -2706,6 +2723,9 @@ xtensa_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
   error (_("xtensa_dump_tdep(): not implemented"));
 }
 
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+extern initialize_file_ftype _initialize_xtensa_tdep;
+
 void
 _initialize_xtensa_tdep (void)
 {
This page took 0.031112 seconds and 4 git commands to generate.