[Debian GNUstep maintainers] Bug#493250: [libgnustep-base1.16] NSInvocation breaks exception handling

Matthias Andreas Benkard mulk at gmx.net
Fri Aug 1 15:16:26 UTC 2008


Package: libgnustep-base1.16
Version: 1.16.3-2
Severity: important

The program below, which does little more than raising an exception
from a method invoked by means of an NSInvocation object, crashes with
a SIGABRT by calling abort() from objc_exception_throw() as indicated
by the attached gdb output.

With either libgnustep-base1.16-libffi or a manually compiled stable
GNUstep Base (1.16.3), as well as with a current Subversion checkout
of GNUstep Base (both compiled using ffcall, not libffi), the program
instead handles the exception as intended:

~/Dokumente/Objective-C% obj/invocation_exception_test
2008-08-01 16:45:46.387 invocation_exception_test[16624] Oops.  An
exception has occurred.
~/Dokumente/Objective-C%

What follows are the program text and the output of gdb.

*** PROGRAM TEXT FOLLOWS ***

#import <Foundation/Foundation.h>

@interface  MLKInvocationExceptionTest : NSObject
+(void) test;
+(void) raiseException;
@end


@implementation MLKInvocationExceptionTest
+(void) test
{
  NSMethodSignature *sig = [self
methodSignatureForSelector:@selector(raiseException)];
  NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:sig];

  [invocation setTarget:self];
  [invocation setSelector:@selector(raiseException)];

  NS_DURING
    {
      [invocation invoke];
    }
  NS_HANDLER
    {
      NSLog (@"Oops.  An exception has occurred.");
    }
  NS_ENDHANDLER;
}

+(void) raiseException
{
  [NSException raise:@"MLKException"
               format:@"Something weird is going on."];
}
@end


int main (int argc, char **argv)
{
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  [MLKInvocationExceptionTest test];
  [pool release];
  return 0;
}

*** PROGRAM TEXT END ***

*** GDB TRANSCRIPT FOLLOWS ***

(gdb) run
Starting program: /home/mulk/Dokumente/Objective-C/obj/invocation_exception_test
[Thread debugging using libthread_db enabled]
[New Thread 0xb766d6b0 (LWP 24453)]

Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb766d6b0 (LWP 24453)]
0xb7fd8424 in __kernel_vsyscall ()
(gdb) bt
#0  0xb7fd8424 in __kernel_vsyscall ()
#1  0xb799a5e0 in raise () from /lib/i686/cmov/libc.so.6
#2  0xb799bfb8 in abort () from /lib/i686/cmov/libc.so.6
#3  0xb7b0de8f in objc_exception_throw (value=0x89cd5e8)
    at /scratch/packages/gcc/4.3/gcc-4.3-4.3.1/src/libobjc/exception.c:375
#4  0xb7c884f4 in -[NSException raise] (self=0x89cd5e8, _cmd=0xb7f03940)
    at NSException.m:827
#5  0xb7c87fcf in +[NSException raise:format:arguments:] (self=0xb7f03720,
    _cmd=0xb7f03928, name=0x804928c, format=0x8049298,
    argList=0xbf9f2740 "\002") at NSException.m:765
#6  0xb7c87f0c in +[NSException raise:format:] (self=0xb7f03720,
    _cmd=0x80493b0, name=0x804928c, format=0x8049298) at NSException.m:751
#7  0x08048a7d in +[MLKInvocationExceptionTest raiseException] (
    self=0x8049340, _cmd=0x8049380) at MLKInvocationExceptionTest.m:30
#8  0xb775c537 in __builtin_avcall () from /usr/lib/libavcall.so.0
#9  0xb7d8a92d in GSFFCallInvokeWithTargetAndImp (_inv=0x89cc828,
    anObject=0x8049340,
    imp=0x8048a23 <+[MLKInvocationExceptionTest raiseException]>)
    at GSFFCallInvocation.m:708
#10 0xb7d8acf6 in -[GSFFCallInvocation invokeWithTarget:] (self=0x89cc828,
    _cmd=0xb7f0b220, anObject=0x8049340) at GSFFCallInvocation.m:778
#11 0xb7ca084a in -[NSInvocation invoke] (self=0x89cc828, _cmd=0x80493a8)
    at NSInvocation.m:655
#12 0x080489f3 in +[MLKInvocationExceptionTest test] (self=0x8049340,
    _cmd=0x80493c8) at MLKInvocationExceptionTest.m:19
#13 0x08048b30 in main () at MLKInvocationExceptionTest.m:39

*** GDB TRANSCRIPT END ***

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.25-2-686 (SMP w/2 CPU cores)
Locale: LANG=de_AT, LC_CTYPE=de_AT (charmap=UTF-8) (ignored: LC_ALL
set to de_AT.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libgnustep-base1.16 depends on:
ii  gnustep-base-common    1.16.3-2          GNUstep Base library - common file
ii  gnustep-common [gnuste 2.0.6-2           Common files for the core GNUstep
ii  libavahi-compat-libdns 0.6.23-2          Avahi Apple Bonjour compatibility
ii  libc6                  2.7-12            GNU C Library: Shared libraries
ii  libffcall1             1.10+2.41-3       Foreign Function Call Libraries
ii  libgcc1                1:4.3.1-8         GCC support library
ii  libgnutls26            2.4.1-1           the GNU TLS library - runtime libr
ii  libobjc2               4.3.1-8           Runtime library for GNU Objective-
ii  libxml2                2.6.32.dfsg-2     GNOME XML library
ii  libxslt1.1             1.1.24-1          XSLT processing library - runtime
ii  zlib1g                 1:1.2.3.3.dfsg-12 compression library - runtime

Versions of packages libgnustep-base1.16 recommends:
ii  gnustep-base-runtime          1.16.3-2   GNUstep Base library

libgnustep-base1.16 suggests no packages.





More information about the pkg-GNUstep-maintainers mailing list