discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Mysterious crash in NSRunLoop, using libobjc2 on Linux


From: David Chisnall
Subject: Re: Mysterious crash in NSRunLoop, using libobjc2 on Linux
Date: Tue, 12 Dec 2017 10:06:20 +0000

On 11 Dec 2017, at 20:10, Lobron, David <dlobron@akamai.com> wrote:
> 
>>>> If the failure is what I suspect that it is, then it’s a problem caused by 
>>>> mixing C++ and Objective-C exception unwinding, so it won’t be possible to 
>>>> reproduce in a single file.  You will need to throw an exception from 
>>>> Objective-C++ and have it pass through stack frames from an Objective-C 
>>>> compilation unit that includes an @finally block that runs some code, and 
>>>> then be caught in an Objective-C++ compilation unit.  
> 
> I created three files: a .mm file that contains main(), a .mm that throws an 
> ObjC exception, and a .m that passes the ObjC exception through from a 
> @finally block back to the .mm file that contains main.  I think I'm getting 
> closer, because my debug output now has several "Fight!" clauses (see below) 
> but all the personality classes are of type GNUCOBJC.  I haven't been able to 
> coax it to emit GNUCC++.
> 
> I've attached the three files, which I compile into separate .o files and 
> then link (compile/link command is also attached).
> 
> Do you have any other ideas for how I can get an exception of "Class: 
> GNUCC++" to appear, instead of just GNUCOBJC?

Throwing with `throw` instead of `@throw` should do that: the exception will be 
thrown by the C++ runtime, not the Objective-C one.  I thought your problem was 
the other way around though, so it might be that you need a c++ destructor to 
force the ObjC runtime to turn it into a C++ exception for delivery to C++.

David




reply via email to

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