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

Stephen Checkoway s at pahtak.org
Fri Oct 18 12:30:30 PDT 2013


On Oct 18, 2013, at 3:14 PM, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:

> On 17 October 2013 19:12, Stephen Checkoway <s at pahtak.org> wrote:
>> 
>> On Oct 17, 2013, at 5:31 PM, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
>> 
>>> I think you forgot to attache the patch.
>> 
>> And I was just being impressed with myself for sending so many emails and remembering to attach the patches. Ah hubris. Patch attached. Thanks!
> 
> Why a unit test? Can't we use llvm-objdump to test this by feeding it
> an object with a .text section containing N zeros and a valid
> instruction? llvm-mc should be able to produce it with
> 
> .zero N
> nop
> 
> with an appropriate N for different arches (1 for x86, 4 for ppc, etc).


My thinking was that a unit test would test out-of-tree targets as well. If their disassemblers were copied from any of the in-tree targets, then they're almost certainly returning 0 bytes for invalid instructions. The unit test was designed to catch that (assuming the SubtargetInfo could be constructed from the architecture name alone).

If that's not a concern or it's the wrong way to go about it, I can add tests for each in-tree target.

Thanks,

-- 
Stephen Checkoway









More information about the llvm-commits mailing list