Change inferior thread list to be a thread map
[deliverable/binutils-gdb.git] / opcodes / d30v-dis.c
index ec21305dc8c058c31330d85f98b82883c5408481..d2e0caa39d73372ac1ab57fa20beaed9fb5049c9 100644 (file)
@@ -1,6 +1,5 @@
 /* Disassemble D30V instructions.
-   Copyright 1997, 1998, 2000, 2001, 2005, 2007
-   Free Software Foundation, Inc.
+   Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
    This file is part of the GNU opcodes library.
 
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
    MA 02110-1301, USA.  */
 
-#include <stdio.h>
 #include "sysdep.h"
+#include <stdio.h>
 #include "opcode/d30v.h"
-#include "dis-asm.h"
+#include "disassemble.h"
 #include "opintl.h"
+#include "libiberty.h"
 
 #define PC_MASK 0xFFFFFFFF
 
@@ -34,7 +34,7 @@
 static int
 lookup_opcode (struct d30v_insn *insn, long num, int is_long)
 {
-  int i = 0, index;
+  int i = 0, op_index;
   struct d30v_format *f;
   struct d30v_opcode *op = (struct d30v_opcode *) d30v_opcode_table;
   int op1 = (num >> 25) & 0x7;
@@ -56,11 +56,11 @@ lookup_opcode (struct d30v_insn *insn, long num, int is_long)
   while (op->op1 == op1 && op->op2 == op2)
     {
       /* Scan through all the formats for the opcode.  */
-      index = op->format[i++];
+      op_index = op->format[i++];
       do
        {
-         f = (struct d30v_format *) &d30v_format_table[index];
-         while (f->form == index)
+         f = (struct d30v_format *) &d30v_format_table[op_index];
+         while (f->form == op_index)
            {
              if ((!is_long || f->form >= LONG) && (f->modifier == mod))
                {
@@ -72,7 +72,7 @@ lookup_opcode (struct d30v_insn *insn, long num, int is_long)
          if (insn->form)
            break;
        }
-      while ((index = op->format[i++]) != 0);
+      while ((op_index = op->format[i++]) != 0);
       if (insn->form)
        break;
       op++;
@@ -125,7 +125,8 @@ print_insn (struct disassemble_info *info,
 {
   int val, opnum, need_comma = 0;
   struct d30v_operand *oper;
-  int i, match, opind = 0, need_paren = 0, found_control = 0;
+  int i, match, need_paren = 0, found_control = 0;
+  unsigned int opind = 0;
 
   (*info->fprintf_func) (info->stream, "%s", insn->op->name);
 
@@ -154,7 +155,8 @@ print_insn (struct disassemble_info *info,
 
   (*info->fprintf_func) (info->stream, "\t");
 
-  while ((opnum = insn->form->operands[opind++]) != 0)
+  while (opind < ARRAY_SIZE (insn->form->operands)
+        && (opnum = insn->form->operands[opind++]) != 0)
     {
       int bits;
 
@@ -226,7 +228,9 @@ print_insn (struct disassemble_info *info,
                  val |= OPERAND_FLAG;
                  break;
                default:
-                 fprintf (stderr, "illegal id (%d)\n", id);
+                 /* xgettext: c-format */
+                 opcodes_error_handler (_("illegal id (%d)"), id);
+                 abort ();
                }
            }
          else if (oper->flags & OPERAND_ACC)
@@ -312,7 +316,9 @@ print_insn (struct disassemble_info *info,
          (*info->fprintf_func) (info->stream, "0x%x", val);
        }
       /* If there is another operand, then write a comma and space.  */
-      if (insn->form->operands[opind] && !(found_control && opind == 2))
+      if (opind < ARRAY_SIZE (insn->form->operands)
+         && insn->form->operands[opind]
+         && !(found_control && opind == 2))
        need_comma = 1;
     }
   if (need_paren)
This page took 0.026496 seconds and 4 git commands to generate.