[PATCH] Change llvm-objdump to print (bad) for invalid instructions

Stephen Checkoway s at pahtak.org
Thu Oct 17 11:18:38 PDT 2013


On Oct 16, 2013, at 7:13 PM, Jim Grosbach <grosbach at apple.com> wrote:

> Looks like there’s something addition that may need cleaned up in that interface. The assertion is firing in test case "MC/ARM/AlignedBundling/group-bundle-arm.s”. Can you have a look and see what’s up?


Good catch. The other disassemblers were setting Size to 0 when they failed to disassemble the instruction.

The attached patch changes all of the targets in the tree with disassemblers and adds a unittest to check that each target with a disassembler (and for which we can trivially construct an MCSubtargetInfo) returns a nonzero size when it fails to disassemble an instruction. It's a pretty limited check since it only tries to disassemble 0x00 and it's certainly possible that an architecture has an instruction that is simply 0x00 (e.g., Z80's NOP is 0x00).

Can you think of a better way to test this, particularly for out-of-tree targets that may need to change?

After this, the llvm-objdump and the header comment patches should apply cleanly.

-- 
Stephen Checkoway









More information about the llvm-commits mailing list