|
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 following: 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 Class: GNUCOBJC LSDA: 0x4024ec Search phase... handler: 1 New personality function called 0xd28300 Class: GNUCOBJC 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). --David
Chowda1.h
Description: Chowda1.h
Chowda1.mm
Description: Chowda1.mm
Chowda2.h
Description: Chowda2.h
Chowda2.m
Description: Chowda2.m
Chowda3.mm
Description: Chowda3.mm
Clam.h
Description: Clam.h
Clam.mm
Description: Clam.mm
CMakeLists.txt
Description: CMakeLists.txt
ModTest.h
Description: ModTest.h
ModTest.m
Description: ModTest.m
ATT00001.txt
Description: ATT00001.txt
[Prev in Thread] | Current Thread | [Next in Thread] |