discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: applications segfaulting in gnustep-back on OpenBSD sparc64


From: Sebastian Reitenbach
Subject: Re: applications segfaulting in gnustep-back on OpenBSD sparc64
Date: Fri, 04 Nov 2011 20:08:11 +0100
User-agent: SOGoMail 1.3.9

Hi Eric,
 
On Friday, November 4, 2011 19:07 CET, Eric Wasylishen <ewasylishen@gmail.com> 
wrote: 
 
> That code forgets to check that XRenderFindVisualFormat returns non-NULL. I 
> committed a fix.

I was also just sitting with gdb, and trying to figure out what the real 
problem is. I thought that even XRenderFindVisualFormat may have a problem, 
since it returned NULL.
I wasn't aware that it is safe for it to return NULL.

So, your fix fixed this problem, but now the next one:

I tried starting Affiche, LapisPuzzle, or AddressManager, all show this 
exception either on the console, or in a popup window:

NSInternalInconsistencyException REASON:expected array count 32 and got 0 
INFO:(null)

running LapisPuzze in gdb, I see this:

(gdb) break -[NSException raise]
Breakpoint 1 at 0x20406e404: file NSException.m, line 956.
(gdb) bt
#0  -[NSException raise] (self=0x2024e9b48, _cmd=0x2018087b8) at 
NSException.m:956
#1  0x00000002012495f4 in +[NSException raise:format:arguments:] 
(self=0x201808470, _cmd=0x201808788, name=0x201807f68, format=0x201837118, 
    argList=0xfffffffffffc4590) at NSException.m:849
#2  0x00000002012494ac in +[NSException raise:format:] (self=0x201808470, 
_cmd=0x201837d58, name=0x201807f68, format=0x201837118) at NSException.m:835
#3  0x000000020130dd40 in -[NSPortCoder decodeArrayOfObjCType:count:at:] 
(self=0x20a914208, _cmd=0x201854480, type=0x2016aaa48 "S", expected=32, 
    buf=0x2024e9b00) at NSPortCoder.m:451
#4  0x000000020139d624 in -[NSString initWithCoder:] (self=0x20240b7a8, 
_cmd=0x201837ed8, aCoder=0x20a914208) at NSString.m:5091
#5  0x000000020130e914 in -[NSPortCoder decodeValueOfObjCType:at:] 
(self=0x20a914208, _cmd=0x201808848, type=0x20169d8c0 "@", address=0x2024e9050)
    at NSPortCoder.m:611
#6  0x000000020124a894 in -[NSException initWithCoder:] (self=0x2024e9048, 
_cmd=0x201837ed8, aDecoder=0x20a914208) at NSException.m:1060
#7  0x000000020130e914 in -[NSPortCoder decodeValueOfObjCType:at:] 
(self=0x20a914208, _cmd=0x2017f05a8, type=0x201698410 "@", 
address=0xfffffffffffc4b58)
    at NSPortCoder.m:611
#8  0x00000002011b5234 in -[NSCoder decodeObject] (self=0x20a914208, 
_cmd=0x2017f71f0) at NSCoder.m:221
#9  0x00000002011d3e84 in -[NSConnection(GNUstepExtensions) 
forwardInvocation:forProxy:] (self=0x20c755648, _cmd=0x2018045d0, 
inv=0x20a914308, 
    object=0x204164a08) at NSConnection.m:2096
#10 0x000000020123f628 in -[NSDistantObject forwardInvocation:] 
(self=0x204164a08, _cmd=0x2018857a8, anInvocation=0x20a914308) at 
NSDistantObject.m:606
#11 0x00000002014591d4 in GSFFIInvocationCallback (cif=0x2024a9200, 
retp=0xfffffffffffc5170, args=0xfffffffffffc5010, user=0x2024e8308)
    at GSFFIInvocation.m:637
#12 0x0000000205b7d508 in ffi_closure_sparc_inner_v9 (closure=0x20413e000, 
rvalue=0xfffffffffffc5170, gpr=0xfffffffffffc5290, fpr=0xfffffffffffc5190)
    at ../src/sparc/ffi.c:665
#13 0x0000000205b7d880 in ffi_closure_v9 () from /usr/local/lib/libffi.so.0.0
#14 0x000000020124444c in -[NSDistributedNotificationCenter 
addObserver:selector:name:object:suspensionBehavior:] (self=0x2024e8988, 
_cmd=0x2018065b8, 
    anObserver=0x20c76ede8, aSelector=0x206ebecb0, notificationName=0x0, 
anObject=0x206ebd4d8, suspensionBehavior=2) at 
NSDistributedNotificationCenter.m:343
#15 0x0000000201243e78 in -[NSDistributedNotificationCenter 
addObserver:selector:name:object:] (self=0x2024e8988, _cmd=0x206ebecc0, 
anObserver=0x20c76ede8, 
    aSelector=0x206ebecb0, notificationName=0x0, anObject=0x206ebd4d8) at 
NSDistributedNotificationCenter.m:267
#16 0x0000000206a85ac8 in -[_GSWorkspaceCenter init] (self=0x20c76ede8, 
_cmd=0x20182e9b8) at NSWorkspace.m:292
#17 0x00000002012df170 in +[NSObject new] (self=0x206ebe9c8, _cmd=0x206ebebc0) 
at NSObject.m:1300
#18 0x0000000206a8790c in -[NSWorkspace init] (self=0x20f36e388, 
_cmd=0x206ebec90) at NSWorkspace.m:692
#19 0x0000000206a874c4 in +[NSWorkspace sharedWorkspace] (self=0x206ebe820, 
_cmd=0x206dc23c8) at NSWorkspace.m:644
#20 0x000000020671d940 in -[NSApplication finishLaunching] (self=0x20a8a3808, 
_cmd=0x206dc2608) at NSApplication.m:1093
#21 0x0000000206721048 in -[NSApplication run] (self=0x20a8a3808, 
_cmd=0x206db34b0) at NSApplication.m:1540
#22 0x00000002066e35d0 in NSApplicationMain (argc=1, argv=0xfffffffffffc5d88) 
at Functions.m:91
#23 0x00000000001016d4 in gnustep_base_user_main (argc=1, 
argv=0xfffffffffffc5d88) at main.m:28
#24 0x000000020132b328 in main (argc=1, argv=0xfffffffffffc5d88, 
env=0xfffffffffffc5d98) at NSProcessInfo.m:978
#25 0x00000000001013cc in _start ()
#26 0x00000000001013cc in _start ()
Previous frame identical to this frame (corrupt stack?)
(gdb) frame 4
#4  0x000000020139d624 in -[NSString initWithCoder:] (self=0x20240b7a8, 
_cmd=0x201837ed8, aCoder=0x20a914208) at NSString.m:5091
5091                  [aCoder decodeArrayOfObjCType: @encode(unichar)
(gdb) list
5086              if (enc == NSUnicodeStringEncoding)
5087                {
5088                  unichar   *chars;
5089            
5090                  chars = NSZoneMalloc(zone, count*sizeof(unichar));
5091                  [aCoder decodeArrayOfObjCType: @encode(unichar)
5092                                          count: count
5093                                             at: chars];
5094                  self = [self initWithCharactersNoCopy: chars
5095                                                 length: count
(gdb) print count*sizeof(unichar)
$1 = 64
(gdb) print chars
$2 = (unichar *) 0x2024e9b00
(gdb) print *chars
$3 = 0
(gdb) print count
$4 = 32
(gdb) frame 3
#3  0x000000020130dd40 in -[NSPortCoder decodeArrayOfObjCType:count:at:] 
(self=0x20a914208, _cmd=0x201854480, type=0x2016aaa48 "S", expected=32, 
    buf=0x2024e9b00) at NSPortCoder.m:451
451           [NSException raise: NSInternalInconsistencyException
(gdb) list
446           [NSException raise: NSInternalInconsistencyException
447                       format: @"expected array and got %s", 
typeToName2(info)];
448         }
449       if (count != expected)
450         {
451           [NSException raise: NSInternalInconsistencyException
452                       format: @"expected array count %u and got %u",
453                             expected, count];
454         }
455     
(gdb) print i
$5 = 2
(gdb) print offset
$6 = 0
(gdb) print size
$7 = 2
(gdb) print count
$8 = 0
(gdb) print expected
$9 = 32
(gdb)

Since there is sth. with unichar, I tried with the default C locale, and also 
with export LC_CTYPE='en_US.UTF-8'.
With both, its the same where it now aborts.


Sebastian

> 
> Eric
> 
> On 2011-11-04, at 2:12 AM, Sebastian Reitenbach wrote:
> 
> > 
> > On Thursday, November 3, 2011 18:20 CET, "Sebastian Reitenbach" 
> > <sebastia@l00-bugdead-prods.de> wrote: 
> > 
> >> Hi,
> >> 
> >> with my adventures on getting gnustep to work on the sparc64 OpenBSD 
> >> platform, and even with the warnings I still get with -base, I thought I 
> >> compile a couple of apps, and try how it works. However, all segfault in 
> >> the same spot in gnustep-back, below an example of Affiche. I use gnustep 
> >> from svn, together with libobjc2, using cairo backend.
> > 
> > I'm logged in via ssh -X in case it matters.
> > 
> > Sebastian
> > 
> > 
> >> 
> >> (gdb) r 
> >> Starting program: /usr/local/bin/Affiche 
> >> 2011-11-03 18:06:17.840 Affiche[26421] Did not find correct version of 
> >> backend (libgnustep-back-020.bundle), falling back to std 
> >> (libgnustep-back.bundle).
> >> 
> >> Program received signal SIGSEGV, Segmentation fault.
> >> 0x0000000212716348 in bestContext (dpy=0x2051f6db0, screen_number=0, 
> >> context=0x20a35ff00) at context.c:841
> >> 841                 if ((pictFormat->type == PictTypeDirect)
> >> (gdb) thread apply all bt
> >> (gdb) bt
> >> #0  0x0000000212716348 in bestContext (dpy=0x2051f6db0, screen_number=0, 
> >> context=0x20a35ff00) at context.c:841
> >> #1  0x0000000212715ea0 in RCreateContext (dpy=0x2051f6db0, 
> >> screen_number=0, attribs=0x0) at context.c:701
> >> #2  0x00000002127226a0 in -[XGScreenContext initForDisplay:screen:] 
> >> (self=0x207fd6c28, _cmd=0x2129859b0, dpy=0x2051f6db0, 
> >>    screen_number=0) at XGServer.m:180
> >> #3  0x00000002127244dc in -[XGServer _screenContextForScreen:] 
> >> (self=0x20fa6fc08, _cmd=0x2129859c0, screen_number=0)
> >>    at XGServer.m:519
> >> #4  0x00000002127245dc in -[XGServer xrContextForScreen:] 
> >> (self=0x20fa6fc08, _cmd=0x212988b68, screen_number=0) at XGServer.m:534
> >> #5  0x0000000212739ed8 in -[XGServer(WindowOps) window::::] 
> >> (self=0x20fa6fc08, _cmd=0x2027e0b10, frame=
> >>        {origin = {x = 0, y = 0}, size = {width = 0, height = 0}}, 
> >> type=NSBackingStoreRetained, style=64, screen=0)
> >>    at XGServerWindow.m:1965
> >> #6  0x00000002023852b8 in -[NSWindow _initBackendWindow] 
> >> (self=0x205240e08, _cmd=0x2027e0c70) at NSWindow.m:916
> >> #7  0x0000000202386678 in -[NSWindow 
> >> initWithContentRect:styleMask:backing:defer:] (self=0x205240e08, 
> >> _cmd=0x2027e0970, 
> >>    contentRect={origin = {x = 0, y = 0}, size = {width = 0, height = 0}}, 
> >> aStyle=64, bufferingType=NSBackingStoreRetained, 
> >>    flag=0 '\0') at NSWindow.m:1063
> >> #8  0x00000002023869e0 in -[NSWindow 
> >> initWithContentRect:styleMask:backing:defer:screen:] (self=0x205240e08, 
> >> _cmd=0x2026eae88, 
> >>    contentRect={origin = {x = 0, y = 0}, size = {width = 0, height = 0}}, 
> >> aStyle=64, bufferingType=NSBackingStoreRetained, 
> >>    flag=0 '\0', aScreen=0x0) at NSWindow.m:1113
> >> #9  0x0000000202055e68 in -[NSApplication(Private) _appIconInit] 
> >> (self=0x205161708, _cmd=0x2026ea288) at NSApplication.m:3789
> >> #10 0x0000000202044b6c in -[NSApplication _init] (self=0x205161708, 
> >> _cmd=0x2026ea2a8) at NSApplication.m:921
> >> #11 0x0000000210308d1c in -[NSObject performSelector:withObject:] 
> >> (self=0x205161708, _cmd=0x21087fa28, aSelector=0x2026ea2a8, 
> >>    anObject=0x205161708) at NSObject.m:2011
> >> #12 0x00000002103d1ff0 in -[NSObject(NSThreadPerformAdditions) 
> >> performSelector:onThread:withObject:waitUntilDone:modes:] (
> >>    self=0x205161708, _cmd=0x21087fb68, aSelector=0x2026ea2a8, 
> >> aThread=0x205160408, anObject=0x205161708, aFlag=1 '\001', 
> >>    anArray=0x211492748) at NSThread.m:1239
> >> #13 0x00000002103d1e00 in -[NSObject(NSThreadPerformAdditions) 
> >> performSelectorOnMainThread:withObject:waitUntilDone:modes:] (
> >>    self=0x205161708, _cmd=0x21087fb78, aSelector=0x2026ea2a8, 
> >> anObject=0x205161708, aFlag=1 '\001', anArray=0x211492748)
> >>    at NSThread.m:1194
> >> #14 0x00000002103d1ea4 in -[NSObject(NSThreadPerformAdditions) 
> >> performSelectorOnMainThread:withObject:waitUntilDone:] (
> >>    self=0x205161708, _cmd=0x2026ea2b8, aSelector=0x2026ea2a8, 
> >> anObject=0x205161708, aFlag=1 '\001') at NSThread.m:1205
> >> #15 0x0000000202044dd4 in -[NSApplication init] (self=0x205161708, 
> >> _cmd=0x2026e9d88) at NSApplication.m:975
> >> #16 0x0000000202044360 in +[NSApplication sharedApplication] 
> >> (self=0x2026e90b0, _cmd=0x326c30) at NSApplication.m:847
> >> #17 0x000000000010b178 in gnustep_base_user_main (argc=1, 
> >> argv=0xfffffffffffd72e8, env=0xfffffffffffd72f8) at Affiche.m:678
> >> #18 0x0000000210353310 in main (argc=1, argv=0xfffffffffffd72e8, 
> >> env=0xfffffffffffd72f8) at NSProcessInfo.m:978
> >> #19 0x0000000000101eac in _start ()
> >> #20 0x0000000000101eac in _start ()
> >> Previous frame identical to this frame (corrupt stack?)
> >> (gdb) frame 0
> >> #0  0x0000000212716348 in bestContext (dpy=0x2051f6db0, screen_number=0, 
> >> context=0x20a35ff00) at context.c:841
> >> 841                 if ((pictFormat->type == PictTypeDirect)
> >> (gdb) list
> >> 836           {
> >> 837             for (i=numvis-1, best = -1; i>=0; i--)
> >> 838               {
> >> 839                 XRenderPictFormat* pictFormat = 
> >> 840                     XRenderFindVisualFormat (dpy, vinfo[i].visual);
> >> 841                 if ((pictFormat->type == PictTypeDirect)
> >> 842                     && (pictFormat->direct.alphaMask))
> >> 843                   {
> >> 844                     best = i;       
> >> 845                   }
> >> (gdb) print dpy
> >> $1 = (Display *) 0x2051f6db0
> >> (gdb) print vinfo
> >> $2 = (XVisualInfo *) 0x20c462000
> >> (gdb) print i
> >> $3 = 0
> >> (gdb) print numvis
> >> $4 = 1
> >> (gdb) print vinfo[i].visual
> >> $5 = (Visual *) 0x200bd27c0
> >> (gdb) print *vinfo[i].visual
> >> $6 = {ext_data = 0x0, visualid = 82, class = 4, red_mask = 16711680, 
> >> green_mask = 65280, blue_mask = 255, bits_per_rgb = 8, 
> >>  map_entries = 256}
> >> (gdb) print *dpy
> >> $7 = <incomplete type>
> >> (gdb)
> >> 
> >> _______________________________________________
> >> Discuss-gnustep mailing list
> >> Discuss-gnustep@gnu.org
> >> https://lists.gnu.org/mailman/listinfo/discuss-gnustep
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > Discuss-gnustep mailing list
> > Discuss-gnustep@gnu.org
> > https://lists.gnu.org/mailman/listinfo/discuss-gnustep
> 
> 
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep
 
 
 
 



reply via email to

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