]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - opcodes/xc16x-desc.c
Avoid crash in dwarf2_init_complex_target_type
[thirdparty/binutils-gdb.git] / opcodes / xc16x-desc.c
index 6074ad52d9a927a1864edc78475e6e3f4ed2b356..d3d9c1e71c0262f77ea4dfcc336978a0d7d65ef0 100644 (file)
@@ -1,8 +1,9 @@
+/* DO NOT EDIT!  -*- buffer-read-only: t -*- vi:set ro:  */
 /* CPU data for xc16x.
 
 THIS FILE IS MACHINE GENERATED WITH CGEN.
 
-Copyright (C) 1996-2017 Free Software Foundation, Inc.
+Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 This file is part of the GNU Binutils and/or GDB, the GNU debugger.
 
@@ -3178,6 +3179,11 @@ init_tables (void)
 {
 }
 
+#ifndef opcodes_error_handler
+#define opcodes_error_handler(...) \
+  fprintf (stderr, __VA_ARGS__); fputc ('\n', stderr)
+#endif
+
 static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *);
 static void build_hw_table      (CGEN_CPU_TABLE *);
 static void build_ifield_table  (CGEN_CPU_TABLE *);
@@ -3196,7 +3202,7 @@ lookup_mach_via_bfd_name (const CGEN_MACH *table, const char *name)
        return table;
       ++table;
     }
-  abort ();
+  return NULL;
 }
 
 /* Subroutine of xc16x_cgen_cpu_open to build the hardware table.  */
@@ -3338,8 +3344,11 @@ xc16x_cgen_rebuild_tables (CGEN_CPU_TABLE *cd)
        {
          if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
            {
-             fprintf (stderr, "xc16x_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\n",
-                      cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
+             opcodes_error_handler
+               (/* xgettext:c-format */
+                _("internal error: xc16x_cgen_rebuild_tables: "
+                  "conflicting insn-chunk-bitsize values: `%d' vs. `%d'"),
+                cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
              abort ();
            }
 
@@ -3410,15 +3419,19 @@ xc16x_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
            const CGEN_MACH *mach =
              lookup_mach_via_bfd_name (xc16x_cgen_mach_table, name);
 
-           machs |= 1 << mach->num;
+           if (mach != NULL)
+             machs |= 1 << mach->num;
            break;
          }
        case CGEN_CPU_OPEN_ENDIAN :
          endian = va_arg (ap, enum cgen_endian);
          break;
        default :
-         fprintf (stderr, "xc16x_cgen_cpu_open: unsupported argument `%d'\n",
-                  arg_type);
+         opcodes_error_handler
+           (/* xgettext:c-format */
+            _("internal error: xc16x_cgen_cpu_open: "
+              "unsupported argument `%d'"),
+            arg_type);
          abort (); /* ??? return NULL? */
        }
       arg_type = va_arg (ap, enum cgen_cpu_open_arg);
@@ -3433,7 +3446,9 @@ xc16x_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
   if (endian == CGEN_ENDIAN_UNKNOWN)
     {
       /* ??? If target has only one, could have a default.  */
-      fprintf (stderr, "xc16x_cgen_cpu_open: no endianness specified\n");
+      opcodes_error_handler
+       (/* xgettext:c-format */
+        _("internal error: xc16x_cgen_cpu_open: no endianness specified"));
       abort ();
     }