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: Lobron, David
Subject: Re: Mysterious crash in NSRunLoop, using libobjc2 on Linux
Date: Mon, 11 Dec 2017 16:57:02 +0000

Hi David-

>> Thanks, David!  I will try to make a reduced test case, based on this.  I'll 
>> start with a simple program that throws an ObjC exception in an NS_HANDLER, 
>> where the whole thing resides in a .mm file.  BTW, I've enabled native 
>> exceptions here.  I will let you guys know when I've got something.
> 
> Just use @try and @catch.  If you can find a smallish test case, please file 
> a bug on GitHub and I’ll take a look.  Ideally, a test case shouldn’t depend 
> on anything other than libobjc2 - take a look at the existing EH tests and 
> see if you can make a similar one that shows the issue.

I've been trying combinations of C++ and ObjC exceptions in a .mm file, and so 
far I haven't been able to reproduce the abort behavior.  I've attached my 
latest code, which throws ObjC and C++ exceptions from C++ and ObjC classes, 
and catches them.  Please let me know if you can think of any variations I 
haven't tried here.  

I tried setting breakpoints on -[NSException raise] and 
objc_exception_throw/objc_exception_rethrow: the stack traces looked similar to 
the ones from the program that was crashing (copied below).  At the least, I 
don't see anything obvious in those stack traces to suggest where the bug might 
lie.

--David

Breakpoint 1, -[NSException raise] (self=0x747070, _cmd=0x7ffff7d29130 
<.objc_selector_list+256>) at NSException.m:1137
1137      if (_reserved == 0)
(gdb) bt
#0  -[NSException raise] (self=0x747070, _cmd=0x7ffff7d29130 
<.objc_selector_list+256>) at NSException.m:1137
#1  0x00007ffff7874ac0 in +[NSException raise:format:] (self=0x747070, 
_cmd=<optimized out>, name=0x73f148, format=0x3) at NSException.m:1016
#2  0x0000000000401325 in -[ObjcClass poke] ()
#3  0x0000000000401507 in main ()

Breakpoint 4, objc_exception_throw (object=0x747070) at 
/home/dlobron/build/clangport/akamai/libobjc2/libobjc2-1.8.1/eh_personality.c:163
163             SEL rethrow_sel = sel_registerName("rethrow");
(gdb) bt
#0  objc_exception_throw (object=0x747070) at 
/home/dlobron/build/clangport/akamai/libobjc2/libobjc2-1.8.1/eh_personality.c:163
#1  0x00007ffff7875158 in -[NSException raise] (self=0x747070, _cmd=<optimized 
out>) at NSException.m:1148
#2  0x00007ffff7874ac0 in +[NSException raise:format:] (self=0x747070, 
_cmd=<optimized out>, name=0x7ffff66e6778 <main_arena+24>, format=0x7470a0) at 
NSException.m:1016
#3  0x0000000000401325 in -[ObjcClass poke] ()
#4  0x0000000000401507 in main ()

Breakpoint 4, objc_exception_throw (object=0x8f4630) at 
/home/dlobron/build/clangport/akamai/libobjc2/libobjc2-1.8.1/eh_personality.c:163
163             SEL rethrow_sel = sel_registerName("rethrow");
(gdb) bt
#0  objc_exception_throw (object=0x8f4630) at 
/home/dlobron/build/clangport/akamai/libobjc2/libobjc2-1.8.1/eh_personality.c:163
#1  0x00007ffff7875158 in -[NSException raise] (self=0x8f4630, _cmd=<optimized 
out>) at NSException.m:1148
#2  0x00007ffff7874ac0 in +[NSException raise:format:] (self=0x8f4630, 
_cmd=<optimized out>, name=0x7ffff66e6778 <main_arena+24>, format=0x82f520) at 
NSException.m:1016
#3  0x0000000000401900 in CppClass::poke() const ()
#4  0x000000000040156f in main ()


Attachment: ExceptionPersonality.mm
Description: ExceptionPersonality.mm


reply via email to

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