[LLVMdev] aborting on invalid code
Jon Harrop
jonathandeanharrop at googlemail.com
Mon Oct 13 17:20:17 PDT 2008
On Saturday 11 October 2008 23:13:46 Chris Lattner wrote:
> On Oct 11, 2008, at 1:01 PM, OvermindDL1 wrote:
> > Which makes me curious, if I submitted a patch that got rid of llvms
> > use of abort()s all over the place, and replaces them with exceptions
> > what is the chance it would be accepted,
>
> There is no chance, we worked hard to eliminate exceptions and are
> aiming to eliminate the last couple remnants of RTTI. Sending invalid
> code into the backend is violating a very important invariant in the
> API. I don't see how it would be any different then passing in a null
> pointer or garbage pointer into an API that would then bus error.
One difference is that programs written in safe languages that call LLVM
should never be able to pass null or garbage pointers to LLVM but they can
pass invalid data structures or make invalid sequences of calls and it is
perfectly feasible to handle the errors gracefully if this happens.
The main issue for me is that any bug in my use of LLVM during development
causes it to die in such a way that I cannot get a stacktrace to find out
where the error occurred in my OCaml code.
>From your description, I assume the solution is to use signal handlers to
catch the "abort()" from LLVM in LLVM's OCaml bindings and raise an exception
on the OCaml side.
--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e
More information about the llvm-dev
mailing list