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

Sean Callanan scallanan at apple.com
Thu Apr 1 12:52:56 PDT 2010


All right, so here's step one: adding llvm_recoverable_error() as suggested by Nick.  Does this look OK?  If so, I can update the main patch to use this function.

Sean

-------------- next part --------------
A non-text attachment was scrubbed...
Name: error-handling.diff
Type: application/octet-stream
Size: 1567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100401/8f0a3682/attachment.obj>
-------------- next part --------------

On Mar 31, 2010, at 10:50 PM, Nick Lewycky wrote:

> Sean Callanan wrote:
>> The attached patch fixes error handling for the x86 disassembler, eliminating llvm_unreachable() and assert() in favor of using the legitimate error-handling mechanism.  The rationale is to allow clients of libEnhancedDisassembly to handle errors themselves, rather than forcing them to crash.
>> 
>> The difference is that now assert() and llvm_unreachable() will never be called (even before, this was extremely unlikely), and the proper error-handling mechanism is used instead.  Further diagnostic information is printed to stderr.
> 
> Your new error() method and assert/llvm_unreachable are not interchangeable. An assert() or llvm_unreachable() are likely to be the last thing run before undefined behaviour.
> 
> To do this properly please add llvm_recoverable_error() to llvm/Support/ErrorHandling.h and update every caller you want to be able to report a severe but optionally fatal error to use it. Then your client can install an error handler for the recoverable errors. Don't forget to audit all the calls you change to make sure that the program is correct even when it doesn't terminate at those points.
> 
> Nick
> 
>> Please let me know what you think.
>> 
>> Sean
>> 
>> 
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 



More information about the llvm-commits mailing list