gnustep-dev
[Top][All Lists]
Advanced

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

Re: Newbie back again...


From: Josh Freeman
Subject: Re: Newbie back again...
Date: Tue, 20 Jun 2017 18:14:21 -0400


On Jun 20, 2017, at 5:30 AM, David Chisnall wrote:

On 19 Jun 2017, at 23:43, Josh Freeman <address@hidden> wrote:

The segmentation fault happens after Base sets the value of an NSThread ivar, because the memory location it writes to overlaps the area in memory where GUI expects to find a different ivar, due to the mismatched layouts; When GUI reads its ivar, it finds a nonzero value (garbage), and when the garbage value is sent an objc message, it crashes.

This sounds like a compiler bug. The ivar accesses should both be using the same offset variable. Are you sure that both are being compiled with the same ABI?

Both Base's & GUI's sources are compiled with -fobjc-nonfragile- abi; Here are two compile commands from yesterday's build output (gnustep-make 2017-04-08):

Base:
+ clang NSThread.m -c -MMD -MP -DGNUSTEP_TARGET_DIR="." - DGNUSTEP_TARGET_CPU="ix86" -DGNUSTEP_TARGET_OS="linux-gnu" - DGNUSTEP_IS_FLATTENED="yes" -DLIBRARY_COMBO="gnu-gnu-gnu" - DGNUSTEP_BASE_INTERNAL=1 -Wall -Wdeclaration-after-statement -Wcast- align -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_RUNTIME=1 - DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -fexceptions -fobjc- exceptions -D_NATIVE_OBJC_EXCEPTIONS -fobjc-nonfragile-abi - D_NONFRAGILE_ABI -pthread -fPIC -DDEBUG -fno-omit-frame-pointer -Wall - DGSWARN -DGSDIAGNOSE -Wno-import -g -fgnu-runtime -fgnu-runtime - fconstant-string-class=NSConstantString -I../Headers -I./. -I. -I/home/ josh/GNUstep/Library/Headers -I/usr/GNUstep/Local/Library/Headers -I/ usr/GNUstep/System/Library/Headers -I/usr/GNUstep/Local/Library/ Headers -I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/System/ Library/Headers -I/usr/GNUstep/Local/Library/Headers -I/usr/include/ libxml2 -I/usr/include/p11-kit-1 -o obj/libgnustep-base.obj/NSThread.m.o

GUI:
+ clang NSGraphicsContext.m -c -MMD -MP -DGNUSTEP_TARGET_DIR="." - DGNUSTEP_TARGET_CPU="ix86" -DGNUSTEP_TARGET_OS="linux-gnu" - DLIBRARY_COMBO="gnu-gnu-gnu" -DGNUSTEP_BASE_HAVE_LIBXML=1 - DBACKEND_BUNDLE=1 -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 - DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno- strict-aliasing -fexceptions -fobjc-exceptions - D_NATIVE_OBJC_EXCEPTIONS -fobjc-nonfragile-abi -D_NONFRAGILE_ABI - pthread -fPIC -DDEBUG -fno-omit-frame-pointer -Wall -DGSWARN - DGSDIAGNOSE -Wno-import -g -fgnu-runtime -Wall -fconstant-string- class=NSConstantString -I../Headers/Additions -I../Headers -I./. -I. - I/home/josh/GNUstep/Library/Headers -I/usr/GNUstep/Local/Library/ Headers -I/usr/GNUstep/System/Library/Headers -I/usr/include/libpng16 - o obj/libgnustep-gui.obj/NSGraphicsContext.m.o


If so, would it be possible for you to compile the relevant -gui file and NSThread.m with -S (produce assembly, don’t compile) and send me the resulting output?


The attached assembly files were created by building the GS frameworks with the --save-temps option added to gnustep-make's INTERNAL_OBJCFLAGS.

gs-assembly.tar.gz contains 3 files: NSAutoreleasePool.s, NSGraphicsContext.s, NSThread.s

The segmentation fault is the result of two events:
-[NSAutoreleasePool dealloc] in Base gets the address of GSCurrentThread()->_autorelease_vars (struct), and passes it through several local functions, which overwrite its struct values. -[NSGraphicsContext setCurrentContext:] in GUI assigns a value to GSCurrentThread()->_gcontext (the ivar right after _autorelease_vars), and crashes when sending a release message to its previous value.

SHA1(gs-assembly.tar.gz)= a7a4f3c4a0dd45a4c284e29a29d3cd8a03bb2383


Cheers,

Josh


Attachment: gs-assembly.tar.gz
Description: GNU Zip compressed data





reply via email to

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