On 02.08.2013 16:36, Riccardo Mottola wrote: > Hi, > > I have a hard time analyzing certain runtime exceptions in GNUstep. For > example, if you send a message to a non-existing method under Cocoa, you > get an NSLog, not so on GS, at least, not always. I am speaking of a Gui > app. > > Right now, I don't have a "cocoa" counterpart of the Application I'm > trying to debug, so... > > I know I get an exception, because I noticed the app misbehaving, thus I > put a breakpoi8nt in [NSException raise] and rightfully it stops: > > Breakpoint 2, 0xb6f7fd50 in -[NSException raise] (self=0xa409f28, > _cmd=0xb72521c0) at NSException.m:1056 > 1056 id info = (_reserved == 0) ? nil : _e_info; > > trace: > > (gdb) bt > #0 0xb6f7fd50 in -[NSException raise] (self=0xa409f28, _cmd=0xb72521c0) > at NSException.m:1056 > #1 0xb6f7f2c9 in +[NSException raise:format:arguments:] (self=0xb7252260, > _cmd=0xb72521a8, name=0xb7252294, format=0xb726d4c0, > argList=0xbfe8b310 > "ÿ÷\"·Ó\017\017·Ê\207&·Ìçý¶\221²è¿\233²è¿Ê\207&·ð\001ø¶\020;C\n\220j*·xj*·") > at NSException.m:1056 > #2 0xb6f80245 in +[NSException raise:format:] (self=0xb7252260, > _cmd=0xb726d280, name=0xb7252294, format=0xb726d4c0) at > NSException.m:1056 > #3 0xb6fdd69c in -[NSObject doesNotRecognizeSelector:] (self=0xa416c00, > _cmd=0xb726d370, aSelector=0xb7268d10) at NSObject.m:1425 > #4 0xb6fdbb69 in -[NSObject forwardInvocation:] (self=0xa416c00, > _cmd=0xb72a6ab0, anInvocation=0xa433b10) at NSObject.m:1765 > #5 0x0a416c00 in ?? () > #6 0xb726d370 in _OBJC_SELECTOR_TABLE () > from /System/Library/Libraries/libgnustep-base.so.1.24 > #7 0xb7268d10 in _OBJC_SELECTOR_TABLE () > from /System/Library/Libraries/libgnustep-base.so.1.24 > #8 0xb6f9f246 in -[NSInvocation setTarget:] (self=0x5c891cec, > _cmd=0xdfe81024, anObject=0x81ffece8) at GSPrivate.h:101 > Backtrace stopped: previous frame inner to this frame (corrupt stack?) > > > this gives me no real clue about where this is coming from and what is > the missing selector and where it is trying to access it. I guess it is > a wrong selector because of "doesNotRecognizeSelector". > > I tried getting up to stack #3 and print out the selector, which is a > (SEL). How may I print it out? > > However, the next step is why I get no output. > > I put a breakpoint in _NSAppKitUncaughtExceptionHandler() of > NSApplication. That exception will either re-raise it through base if > there is no graphic context or put a nice Panel. In theory. I don't get > into that method, this means the exception is sort trapped elsewhere or > not thrown in a way that ends up here! > > Ideas?
Hi Riccardo, please have a look at this method in NSApplication: - (void) _handleException: (NSException *)exception As you can see it gets the mask for exception handling from the defaults. My current setting there is 3, which means I get a log and the exception ends up in a panel. This is the best setting for a development environment, but not what you want on a user desktop. On your second question, how to print out a selector. It is as easy as po NSStringFromSelector(aSelector) But don't be surprised when you don't get a useful result. Your stack seems to be already corrupted. Hope this helps, Fred _______________________________________________ Discuss-gnustep mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnustep
