[llvm-commits] Error-handling fixes for the x86 disassembler

Chris Lattner clattner at apple.com
Wed Mar 31 20:50:49 PDT 2010


On Mar 31, 2010, at 6:13 PM, Sean Callanan wrote:
>> However, I don't see how error messages from the disassembler are going to be very useful.  Errors like:
>> 
>> Corrupt table!  Unknown modrm_type
>> Cannot have Mod = 0b11 and a SIB byte
>> Expected a REG or R/M encoding in fixupReg
>> No modifier but an operand expects one.
>> 
>> Are not going to mean anything to anyone.  I don't think there is such thing as a useful error message that can come out of a disassembler other than "unrecognized instruction".  Given this, I don't see the value in an error reporting api at all here.
> 
> I'll just have error() call fprintf(stderr) unless NDEBUG is defined.  New patch attached.

As daniel mentioned, nothing in lib can use printf.

Why not have this abort if assertions are enabled?  Causing a printout to happen (presumably as a debugging aid) does not make any sense if linked into a random app that uses the disassembler.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100331/ad2a6f98/attachment.html>


More information about the llvm-commits mailing list