aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-01-05 09:11:47 +0000
committerNick Clifton <nickc@redhat.com>2017-01-05 09:11:47 +0000
commit0ae60c3ef45d41b34d40ed5c7b4fdfea289530de (patch)
tree8fc325b95728b93b6ba9538ade41c8445dfc4116
parentc0386d4d54d2cc33d6efc0b998fe6396bf92be15 (diff)
downloadgdb-0ae60c3ef45d41b34d40ed5c7b4fdfea289530de.zip
gdb-0ae60c3ef45d41b34d40ed5c7b4fdfea289530de.tar.gz
gdb-0ae60c3ef45d41b34d40ed5c7b4fdfea289530de.tar.bz2
Prevent an abort in the FRV disassembler if the target bfd name is unknown.
PR 20946 * frv-desc.c (lookup_mach_via_bfd_name): Return NULL if the name could not be matched. (frv_cgen_cpu_open): Allow for lookup_mach_via_bfd_name returning NULL.
-rw-r--r--opcodes/ChangeLog8
-rw-r--r--opcodes/frv-desc.c6
2 files changed, 11 insertions, 3 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 555a379..8494c51 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,11 @@
+2017-01-05 Nick Clifton <nickc@redhat.com>
+
+ PR 20946
+ * frv-desc.c (lookup_mach_via_bfd_name): Return NULL if the name
+ could not be matched.
+ (frv_cgen_cpu_open): Allow for lookup_mach_via_bfd_name returning
+ NULL.
+
2017-01-04 Szabolcs Nagy <szabolcs.nagy@arm.com>
* aarch64-tbl.h (RCPC, RCPC_INSN): Define.
diff --git a/opcodes/frv-desc.c b/opcodes/frv-desc.c
index ab4d7eb..bba510c 100644
--- a/opcodes/frv-desc.c
+++ b/opcodes/frv-desc.c
@@ -6173,7 +6173,7 @@ lookup_mach_via_bfd_name (const CGEN_MACH *table, const char *name)
return table;
++table;
}
- abort ();
+ return NULL;
}
/* Subroutine of frv_cgen_cpu_open to build the hardware table. */
@@ -6386,8 +6386,8 @@ frv_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
const char *name = va_arg (ap, const char *);
const CGEN_MACH *mach =
lookup_mach_via_bfd_name (frv_cgen_mach_table, name);
-
- machs |= 1 << mach->num;
+ if (mach != NULL)
+ machs |= 1 << mach->num;
break;
}
case CGEN_CPU_OPEN_ENDIAN :