[Top][All Lists]

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

Re: Mysterious crash in NSRunLoop, using libobjc2 on Linux

From: Lobron, David
Subject: Re: Mysterious crash in NSRunLoop, using libobjc2 on Linux
Date: Mon, 18 Dec 2017 20:04:47 +0000

Hi David-

>> The goal here is to do what you suggested above, namely, force the ObjC 
>> runtime to turn the NSException into a C++ exception for delivery to the 
>> tryCpp method, which is a plain C++ instance method.  But the debug output 
>> (copied below) suggests that is not happening: all of the exception 
>> personalities are of class GNUCOBJC.  Am I missing a step here, or not 
>> understanding the way exception personalities are passed through frames?  
>> I'm still learning this, so maybe I'm missing something obvious.
> Try to recreate the structure of your original failure with the same mix of 
> ObjC/C++/ObjC++ stack frames and the same cleanups / catches.

I've got a working unit test in the libobjc2 Test directory, which depends only 
on libobjc2.  I'm trying to reproduce my original failure by doing the 

1. Throw an exception from a .mm file.

2. Pass it through a .m file.

3. Catch the exception in a C++ class in another .mm file.

I tried a few versions of this, including catching the exception inside a C++ 
class, but so far I have not been able to induce the runtime to coerce a 
GNUCOBJC exception into a GNUCC++ one.  The debug logs report:

New personality function called 0xd28300
LSDA: 0x4024ec
Search phase...
handler: 1
New personality function called 0xd28300
LSDA: 0x4024ec
Phase 2: Fight!
Not the handler frame, looking up the cleanup again
Caught exception in C++

Are there certain code blocks that might make it more likely for the runtime to 
turn GNUCOBJC into GNUC++?  I've tried throwing the ObjC exception from inside 
a C++ try/catch block, but there's no GNUC++ exception in sight.  I've attached 
the files for this test, and the modified version of the CMakeLists.txt needed 
to build it (there's also a modified version of Test.h that separates class 
implementation from interface, since I'm using the class in multiple files for 
this test).


Attachment: Chowda1.h
Description: Chowda1.h

Attachment: Chowda1.mm
Description: Chowda1.mm

Attachment: Chowda2.h
Description: Chowda2.h

Attachment: Chowda2.m
Description: Chowda2.m

Attachment: Chowda3.mm
Description: Chowda3.mm

Attachment: Clam.h
Description: Clam.h

Attachment: Clam.mm
Description: Clam.mm

Attachment: CMakeLists.txt
Description: CMakeLists.txt

Attachment: ModTest.h
Description: ModTest.h

Attachment: ModTest.m
Description: ModTest.m

Attachment: ATT00001.txt
Description: ATT00001.txt

reply via email to

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