bugGNUstep - Bugs: bug #22514, Stacktrace fails on NetBSD...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #22514: Stacktrace fails on NetBSD 4.0/amd64

Submitted by:  David Wetzel <dwetzel>
Submitted on:  Sat 08 Mar 2008 11:15:04 AM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

(Jump to the original submission Jump to the original submission)

Fri 30 Jan 2009 07:32:58 PM UTC, comment #6:

No feedback ... assuming it's all working.

Richard Frith-Macdonald <CaS>
Project Member
Sat 11 Oct 2008 06:14:34 AM UTC, comment #5:

Are you sure you are using an up to date version of GNUstep?
I ask because the bug report referred to says that the crash is a segmentation fault in NSCountFrames, yet the code for that method in the current stable release uses the signal() system call to catch segmentation faults caused when gcc's __builtin_frame_address() runs off the end of the stack (and it seems highly unlikely that the signal() system call provided by your operating system would be faulty)...

unsigned NSCountFrames(void)
{
jbuf_type *env;

env = jbuf();
if (setjmp(env->buf) == 0)
{
env->segv = signal(SIGSEGV, recover);
env->bus = signal(SIGBUS, recover);
env->addr = 0;

#define _NS_COUNT_HACK(X) if (__builtin_frame_address(X + 1) == 0) \
goto done; else env->addr = (void*)(X + 1);

_NS_COUNT_HACK(0); _NS_COUNT_HACK(1); _NS_COUNT_HACK(2);
_NS_COUNT_HACK(3); _NS_COUNT_HACK(4); _NS_COUNT_HACK(5);

Richard Frith-Macdonald <CaS>
Project Member
Sun 16 Mar 2008 06:19:23 PM UTC, comment #4:

OK ... I have modified the code in svn trunk so that it should handle a sigbus as well as a sigsegv (assuming I didn't make any mistake). Please give it a try and let me know if this fixes the problem.

Richard Frith-Macdonald <CaS>
Project Member
Sun 16 Mar 2008 05:46:04 PM UTC, comment #3:

Ah ... I think I see the problem ... the GNUstep code catches sigsegv and you are getting sigbus ... I guess different systems will cause different signals when falling off the end of the stack.
I'll change the code to catch both signals.

Richard Frith-Macdonald <CaS>
Project Member
Sun 16 Mar 2008 02:11:56 PM UTC, comment #2:

it breaks with today's SVN

dave@amd64>./obj/general
PASS: -count returns zero for an empty array
PASS: -hash returns zero for an empty array
PASS: -containsObject works
PASS: -indexOfObject: finds object
PASS: -indexOfObjectIdenticalTo: finds identical object
PASS: -objectEnumerator: is ok for empty array
PASS: -objectEnumerator: enumerates the array
PASS: -description gives us a text property-list (empty array)
PASS: -description gives us a text property-list
PASS: -count returns two for an array with two objects
PASS: -hash returns two for an array with two objects
PASS: -indexOfObject: gives NSNotFound for a nil object
PASS: -indexOfObject: gives NSNotFound for a object not in the array
PASS: Array is equal to itself using -isEqualToArray:
PASS: Similar arrays are not equal using -isEqualToArray:
PASS: -subarrayWithRange: seems ok
Bus error (core dumped)

and with gdb:

dave@amd64>gdb ./obj/general
GNU gdb 5.3nb1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64--netbsd"...
(gdb) r
Starting program: /Users/dave/projects/testsuite/trunk/base/NSArray/obj/general
/usr/games/fortune: Command not found.
PASS: -count returns zero for an empty array
PASS: -hash returns zero for an empty array
PASS: -containsObject works
PASS: -indexOfObject: finds object
PASS: -indexOfObjectIdenticalTo: finds identical object
PASS: -objectEnumerator: is ok for empty array
PASS: -objectEnumerator: enumerates the array
PASS: -description gives us a text property-list (empty array)
PASS: -description gives us a text property-list
PASS: -count returns two for an array with two objects
PASS: -hash returns two for an array with two objects
PASS: -indexOfObject: gives NSNotFound for a nil object
PASS: -indexOfObject: gives NSNotFound for a object not in the array
PASS: Array is equal to itself using -isEqualToArray:
PASS: Similar arrays are not equal using -isEqualToArray:
PASS: -subarrayWithRange: seems ok

Program received signal SIGBUS, Bus error.
0x00007f7ffd9bfaa7 in NSCountFrames () at NSDebug.m:995
995 _NS_COUNT_HACK(9); _NS_COUNT_HACK(10); _NS_COUNT_HACK(11);
(gdb) bt
#0 0x00007f7ffd9bfaa7 in NSCountFrames () at NSDebug.m:995
#1 0x00007f7ffd9c7e03 in GSPrivateStackAddresses () at NSDebug.m:1112
#2 0x00007f7ffd9de2f7 in -[NSException raise] (self=0x62c7d0,
_cmd=0x7f7ffdd71e80) at NSException.m:819
#3 0x00007f7ffd9dddcb in +[NSException raise:format:arguments:] (
self=0x7f7ffdd71a20, _cmd=0x7f7ffdd71e50, name=0x7f7ffdd71560,
format=0x7f7ffdd4b840, argList=0x7f7fffffdfa0) at NSException.m:762
#4 0x00007f7ffd9ddd01 in +[NSException raise:format:] (self=0x7f7ffdd71a20,
_cmd=0x7f7ffdd4cbd0, name=0x7f7ffdd71560, format=0x7f7ffdd4b840)
at NSException.m:748
#5 0x00007f7ffd96d6d1 in -[NSArray subarrayWithRange:] (self=0x5d0c90,
_cmd=0x50aa30, aRange={location = 1, length = 2}) at NSArray.m:1113
#6 0x00000000004049c0 in gnustep_base_user_main () at general.m:72
#7 0x00007f7ffda4ac0e in main (argc=1, argv=0x7f7fffffe330,
env=0x7f7fffffe340) at NSProcessInfo.m:913
(gdb)

this is in ...testsuite/trunk/base/NSArray

dave

David Wetzel <dwetzel>
Project Member
Sun 16 Mar 2008 12:04:01 PM UTC, comment #1:

Is this with current code?
I ask because there's a known bug/feature that the stack address functions provided by gcc can sometimes run off the end of the stack and cause bus errors etc, but to handle this problem the stack trace code uses setjmp and a signal handler to recover from running off the end of the stack ... so while running under debug will get a SIGBUS signal and stop the debugger, this should not mean that there is a problem with the running code.

Richard Frith-Macdonald <CaS>
Project Member
Sat 08 Mar 2008 11:15:04 AM UTC, original submission:

That is the NSArray test. As long as a program is not raising an exception most stuff is ok.

PASS: -subarrayWithRange: seems ok

Program received signal SIGBUS, Bus error.
0x00007f7ffd9bd373 in NSCountFrames () at NSDebug.m:995
995 _NS_COUNT_HACK(9); _NS_COUNT_HACK(10); _NS_COUNT_HACK(11);
(gdb) bt
#0 0x00007f7ffd9bd373 in NSCountFrames () at NSDebug.m:995
#1 0x00007f7ffd9c56cf in GSPrivateStackAddresses () at NSDebug.m:1112
#2 0x00007f7ffd9dbbc3 in -[NSException raise] (self=0x62b7d0,
_cmd=0x7f7ffdd6daa0) at NSException.m:819
#3 0x00007f7ffd9db697 in +[NSException raise:format:arguments:] (
self=0x7f7ffdd6d640, _cmd=0x7f7ffdd6da70, name=0x7f7ffdd6d180,
format=0x7f7ffdd47760, argList=0x7f7fffffdfa0) at NSException.m:762
#4 0x00007f7ffd9db5cd in +[NSException raise:format:] (self=0x7f7ffdd6d640,
_cmd=0x7f7ffdd488d0, name=0x7f7ffdd6d180, format=0x7f7ffdd47760)
at NSException.m:748
#5 0x00007f7ffd96c411 in -[NSArray subarrayWithRange:] (self=0x5cec90,
_cmd=0x50aa30, aRange={location = 1, length = 2}) at NSArray.m:1111
#6 0x00000000004049c0 in gnustep_base_user_main () at general.m:72
#7 0x00007f7ffda47fba in main (argc=1, argv=0x7f7fffffe330,
env=0x7f7fffffe340) at NSProcessInfo.m:913

cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM)2 Duo CPU T7700 @ 2.40GHz, 2394.27 MHz
cpu0: features: 2ffbfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR>
cpu0: features: 2ffbfbff<PGE,MCA,CMOV,PAT,PSE36,CFLUSH,B20,DS,ACPI,MMX>
cpu0: features: 2ffbfbff<FXSR,SSE,SSE2,SS,TM>
cpu0: features2: 2211<SSE3,DS-CPL>
cpu0: features3: 2ffbfbff<SYSCALL/SYSRET,XD,EM64T>
cpu0: L2 cache 4 MB 64B/line 16-way

dave@amd64#uname -a
NetBSD amd64 4.0 NetBSD 4.0 (GENERIC) #0: Sat Dec 15 22:25:31 PST 2007 builds@wb28:/home/builds/ab/netbsd-4-0-RELEASE/amd64/200712160005Z-obj/home/builds/ab/netbsd-4-0-RELEASE/src/sys/arch/amd64/compile/GENERIC amd64

If somebody wants to fix this, I can create a ssh account.

David Wetzel <dwetzel>
Project Member

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by CaS (Posted a comment)
  • -unavailable- added by dwetzel (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 30 Jan 2009 07:32:58 PM UTCCaSOpen/ClosedIn Test=>Closed
    Sun 16 Mar 2008 06:19:23 PM UTCCaSStatusNone=>Fixed
      Open/ClosedOpen=>In Test

    Back to the top


    Powered by Savane 3.1-cleanup1