discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with catching exceptions on ARM


From: Mathias Bauer
Subject: Re: Problem with catching exceptions on ARM
Date: Thu, 20 Feb 2014 18:27:03 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

Hi,

Am 20.02.14 16:08, schrieb Mathias Bauer:

Finally I pulled the plug and switched to the trunk version of llvm.
After solving some build problems there I finally got a usable version
of llvm. I compiled libobjc2 with it and tried the ExceptionTest.m
example. It compiles, but doesn't run properly (gets stuck somewhere
below _Unwind_RaiseException).

Now I wonder whether just using the new compiler helps, shouldn't there
be some runtime arrangements also? It seems that symbols are still taken
from the system's version of libgcc_s etc., and these libraries are
built with whatever compiler was used for the system.

Is it really enough to switch the compiler to get the exception handling
on ARM fixed (or at least improved) or does that call for more work?

To supplement this, here's where the execution gets stuck:

void objc_exception_rethrow(struct _Unwind_Exception *e)
{
        struct thread_data *td = get_thread_data_fast();
        // If this is an Objective-C exception, then
        if (td->current_exception_type == OBJC)
        {
                struct objc_exception *ex = objc_exception_from_header(e);
                assert(e->exception_class == objc_exception_class);
                assert(ex == td->caughtExceptions);
                assert(ex->catch_count > 0);
                // Negate the catch count, so that we can detect that this is a
                // rethrown exception in objc_end_catch
                ex->catch_count = -ex->catch_count;
                _Unwind_Reason_Code err = _Unwind_Resume_or_Rethrow(e);
                free(ex);

(...snip...)

The call to _Unwind_Resume_or_Rethrow(e) does not return.

I tested, that a simple @try/@catch works (an exception thrown in a function called from the @try block is caught successfully and the program exits normally). But throwing another exception in the function that caught the exception freezes the program again. It doesn't matter if the second exception is thrown inside the @catch block or outside of it.

Regards,
Mathias



reply via email to

[Prev in Thread] Current Thread [Next in Thread]