From: Anton Kolesov Date: Wed, 14 Sep 2016 11:20:13 +0000 (+0100) Subject: Stop the ARC disassembler from seg-faulting if initialised without a BFD present. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dce084426d75b45ef728425a880d642a604c36a7;p=binutils-gdb.git Stop the ARC disassembler from seg-faulting if initialised without a BFD present. * arc-dis.c (arc_get_disassembler): Accept a null bfd gracefully. --- diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 82eeec38421..363f441d674 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2016-09-14 Anton Kolesov + + * arc-dis.c (arc_get_disassembler): Accept a null bfd gracefully. + 2016-09-12 Andreas Krebbel * s390-mkopc.c (main): Support alternate arch strings. diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c index d69a01e4e4d..ac03b8c3f17 100644 --- a/opcodes/arc-dis.c +++ b/opcodes/arc-dis.c @@ -1238,11 +1238,16 @@ print_insn_arc (bfd_vma memaddr, disassembler_ftype arc_get_disassembler (bfd *abfd) { - /* Read the extenssion insns and registers, if any. */ - build_ARC_extmap (abfd); + /* BFD my be absent, if opcodes is invoked from the debugger that + has connected to remote target and doesn't have an ELF file. */ + if (abfd != NULL) + { + /* Read the extension insns and registers, if any. */ + build_ARC_extmap (abfd); #ifdef DEBUG - dump_ARC_extmap (); + dump_ARC_extmap (); #endif + } return print_insn_arc; }