Hey David-

>>> 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?

Thank you,

David

Attachment: compile.sh
Description: compile.sh

Attachment: ExceptionPersonality.mm
Description: ExceptionPersonality.mm

Attachment: RunTest.mm
Description: RunTest.mm

Attachment: TestExceptionPersonality.m
Description: TestExceptionPersonality.m


Debug output when running the attached code:

2017-12-11 20:07:47.504 RunTest[10350:10350] Starting test
2017-12-11 20:07:47.504 RunTest[10350:10350] Starting poke
2017-12-11 20:07:47.504 RunTest[10350:10350] Finally cause - poking
Throwing 0x14d71a0
New personality function called 0x14de2f0
Class: GNUCOBJC
LSDA: 0x403b1c
Search phase...
Filter: 1
Class name: NSException
0x7fc9e46cbde8 type: 1
found handler for NSException
handler: 4
Found handler! 4
New personality function called 0x14de2f0
Class: GNUCOBJC
LSDA: 0x403b1c
Phase 2: Fight!
Installing context, selector 1
Beginning catch 0x14de2f0
objc catch
Throwing 0x14d71a0
New personality function called 0x14de350
Class: GNUCOBJC
LSDA: 0x403b1c
Search phase...
handler: 1
New personality function called 0x14de350
Class: GNUCOBJC
LSDA: 0x403b1c
Phase 2: Fight!
Not the handler frame, looking up the cleanup again
handler! 1 0
Installing cleanup...
Installing context, selector 0
Ending catch
New personality function called 0x14de350
Class: GNUCOBJC
LSDA: 0x403b1c
Phase 2: Fight!
Not the handler frame, looking up the cleanup again
2017-12-11 20:07:47.505 RunTest[10350:10350] Caught ObjC exception
2017-12-11 20:07:47.505 RunTest[10350:10350] Running the finally section
2017-12-11 20:07:47.505 RunTest[10350:10350] Starting poke
2017-12-11 20:07:47.505 RunTest[10350:10350] Finally cause - poking
Throwing 0x14de470
New personality function called 0x14de620
Class: GNUCOBJC
LSDA: 0x403b1c
Search phase...
Filter: 1
Class name: NSException
0x7fc9e46cbde8 type: 1
found handler for NSException
handler: 4
Found handler! 4
New personality function called 0x14de620
Class: GNUCOBJC
LSDA: 0x403b1c
Phase 2: Fight!
Installing context, selector 1
Beginning catch 0x14de620
objc catch
Throwing 0x14de470
New personality function called 0x14de680
Class: GNUCOBJC
LSDA: 0x403b1c
Search phase...
handler: 1
New personality function called 0x14de680
Class: GNUCOBJC
LSDA: 0x403b1c
Phase 2: Fight!
Not the handler frame, looking up the cleanup again
handler! 1 0
Installing cleanup...
Installing context, selector 0
Ending catch
New personality function called 0x14de680
Class: GNUCOBJC
LSDA: 0x403b1c
Phase 2: Fight!
Not the handler frame, looking up the cleanup again
2017-12-11 20:07:47.505 RunTest[10350:10350] Caught ObjC exception
2017-12-11 20:07:47.505 RunTest[10350:10350] Caught Cpp exception
2017-12-11 20:07:47.505 RunTest[10350:10350] Running the finally section
2017-12-11 20:07:47.505 RunTest[10350:10350] Caught Cpp exception
_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to