Stop the ARC disassembler from seg-faulting if initialised without a BFD present.
authorAnton Kolesov <Anton.Kolesov@synopsys.com>
Wed, 14 Sep 2016 11:20:13 +0000 (12:20 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 14 Sep 2016 11:20:13 +0000 (12:20 +0100)
* arc-dis.c (arc_get_disassembler): Accept a null bfd gracefully.

opcodes/ChangeLog
opcodes/arc-dis.c

index 82eeec384211aafc78a017016757fe37cddafcec..363f441d6741b131e2b13fd3bdaad32a6b6c6d08 100644 (file)
@@ -1,3 +1,7 @@
+2016-09-14  Anton Kolesov  <Anton.Kolesov@synopsys.com>
+
+       * arc-dis.c (arc_get_disassembler): Accept a null bfd gracefully.
+
 2016-09-12  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
 
        * s390-mkopc.c (main): Support alternate arch strings.
index d69a01e4e4d568f17ac643ed3f7486cd228a8aba..ac03b8c3f17f81f95b8cb11b4ae629937207c501 100644 (file)
@@ -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;
 }
This page took 0.029562 seconds and 4 git commands to generate.