[llvm-objdump] avoid crash disassembling unknown instruction
authorSjoerd Meijer <sjoerd.meijer@arm.com>
Fri, 31 Jan 2020 11:49:20 +0000 (11:49 +0000)
committerSjoerd Meijer <sjoerd.meijer@arm.com>
Fri, 31 Jan 2020 12:41:31 +0000 (12:41 +0000)
commit24f0b6b6d8e798f76621af9ea6ccda0568d28703
tree108b32cf964509c2815aa03ff0ec475683422c32
parent09217b60fcf1301e0333a69c37c6408d81c46ca5
[llvm-objdump] avoid crash disassembling unknown instruction

Disassembly of instructions can fail when llvm-objdump is not given the right set of
architecture features, for example when the source is compiled with:

  clang -march=..+ext1+ext2

and disassembly is attempted with:

  llvm-objdump -mattr=+ext1

This patch avoids further analysing unknown instructions (as was happening
before) when disassembly has failed.

Differential Revision: https://reviews.llvm.org/D73531
llvm/test/tools/llvm-objdump/ARM/unknown-instr.test [new file with mode: 0644]
llvm/tools/llvm-objdump/llvm-objdump.cpp