aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Kolesov <Anton.Kolesov@synopsys.com>2016-09-14 12:20:13 +0100
committerNick Clifton <nickc@redhat.com>2016-09-14 12:20:13 +0100
commitdce084426d75b45ef728425a880d642a604c36a7 (patch)
tree26196485cafe17b714dc9fbfd71ba600b6c1663f
parent29063f8bfb9d68a213efd1d0ab7a66f97ed9a013 (diff)
downloadgdb-dce084426d75b45ef728425a880d642a604c36a7.zip
gdb-dce084426d75b45ef728425a880d642a604c36a7.tar.gz
gdb-dce084426d75b45ef728425a880d642a604c36a7.tar.bz2
Stop the ARC disassembler from seg-faulting if initialised without a BFD present.
* arc-dis.c (arc_get_disassembler): Accept a null bfd gracefully.
-rw-r--r--opcodes/ChangeLog4
-rw-r--r--opcodes/arc-dis.c11
2 files changed, 12 insertions, 3 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 82eeec3..363f441 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -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.
diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c
index d69a01e..ac03b8c 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;
}