[Mono-dev] Re: Abort with Non-Typical Exception Handler Layout on Mono 1.1.13.6

Robert Jordan robertj at gmx.net
Sun Jun 11 12:56:01 EDT 2006


Almann T. Goo wrote:
> I am working on exception handler translation for JaCIL (CLI to JVM
> byte-code compiler) so I've been writing some sample cases in CIL to better
> understand the handler semantics in the CLI.  When running up this CIL code
> in Mono 1.1.13.6, the run time aborted on an assertion error.

Maybe the code doesn't pass verification. Test the assembly with pedump
or MS.NET's PEVerify.

Robert


> 
>    T_START:
>        ldstr   "Start"
>        call    void [mscorlib]System.Console::WriteLine(string)
>        leave.s COMPLETE
>    T1_END:
>        nop
>    T2_END:
> 
>    COMPLETE:
>        ret
> 
>    F1_START:
>        ldstr   "Finally1"
>        call    void [mscorlib]System.Console::WriteLine(string)
>        endfinally
>    F1_END:
> 
>    F2_START:
>        ldstr   "Finally2"
>        call    void [mscorlib]System.Console::WriteLine(string)
>        endfinally
>    F2_END:
> 
>    .try T_START to T1_END finally handler F1_START to F1_END
>    .try T_START to T2_END finally handler F2_START to F2_END
> 
> The error returned when trying to execute this code in Mono is:
> 
> $ mono sample.exe
> 
> ** ERROR **: file mini.c: line 9517 (mini_method_compile): assertion 
> failed:
> (tblock->native_offset)
> aborting...
> Aborted
> 
> If I move the method return and its label past the last finally handler the
> above code works (probably how most compilers would probably generate this
> type of code).  From what I understand of ECMA-335, it is legitimate to 
> have
> this case, and it indeed works in .NET Framework and Portable .NET as shown
> below:
> 
> D:\tmp> sample.exe
> Start
> Finally1
> Finally2
> 
> I could be missing something in ECMA-335 (which has parts of the handler
> spec in Partitions I, II, and III making more room for confusion) and PNet
> and .NET Framework are just simply lax in this regard.  This is certainly
> not a show stopper for my work, but I was wondering if anyone else has run
> into anything similar on Mono with regard to exception handlers.
> 
> Best regards,
> Almann
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list