On Tuesday, June 14, 2011 01:26 CEST, Stuart Henderson <[email protected]>
wrote:
> iirc libexecinfo doesn't exactly work correctly. You could try
So its of more harm than of use. I guess using the __BUILTIN_HACK for all
architectures, makes it at least working, but kind of useless ;)
However, I played a bit around, and found with attached patch, it doesn't crash
anymore for me. But I have no idea, whether this would break other stuff....
> linking it with marco's backtrace library instead,
seems like worth a try, I'll take a look.
thanks,
Sebastian
>
> http://opensource.conformal.com/cgi-bin/cvsweb/backtrace/backtrace/
>
> I don't know who can help with the ObjC exception handling problem
> though..
>
>
> On 2011-06-13, Sebastian Reitenbach <[email protected]> wrote:
> > Hi,
> >
> > I'm trying to chase a hanger I observe in gnustep based programs. The hang
> > is related to exception handling in gnustep. When an exception is raised, a
> > backtrace is created. When backtrace() is not available, gnustep-base tries
> > to create one on its own, and while there it hangs, where I did not yet
> > figured out, what the actual problem is. However, I was pointed to
> > libexecinfo, which also provides backtrace(). So I tweaked gnustep-base a
> > bit to detect and link against libexecinfo.
> >
> > However, now the programs crash in libexecinfo. The backtrace looks like
> > sth. like this:
> >
> > Program received signal SIGSEGV, Segmentation fault.
> > [Switching to process 15312, thread 0x87c35800]
> > 0x0d95e0f1 in getreturnaddr (level=103) at stacktraverse.c:116
> > 116 case 103: return __builtin_return_address(104);
> > (gdb) bt
> > #0 0x0d95e0f1 in getreturnaddr (level=104) at stacktraverse.c:116
> > #1 0x0d95aa85 in backtrace (buffer=0x7cc42e00, size=127) at execinfo.c:60
> > #2 0x00ea5b77 in -[GSStackTrace init] (self=0x81fda7e8, _cmd=0x20e875a8)
> > at NSException.m:594
> > #3 0x00ef9b58 in +[NSObject new] (self=0x20e6e300, _cmd=0x20e6e3a0) at
> > NSObject.m:1159
> > #4 0x00ea6c7f in -[NSException raise] (self=0x81fda0a8, _cmd=0x20e6e400)
> > at NSException.m:960
> > #5 0x00ea6341 in +[NSException raise:format:arguments:] (self=0x20e6e200,
> > _cmd=0x20e6e3e8, name=0x3c005fe8, format=0x3c005ff4, argList=0xcfbd27e0 "")
> > at NSException.m:849
> > #6 0x00ea6279 in +[NSException raise:format:] (self=0x20e6e200,
> > _cmd=0x3c006648, name=0x3c005fe8, format=0x3c005ff4) at NSException.m:835
> > #7 0x1c00747b in -[Sudoku doFind:] (self=0x89023008, _cmd=0x3c006628,
> > seen=0x84c57b88) at Sudoku.m:418
> > #8 0x1c0078b5 in -[Sudoku doFind:] (self=0x89023008, _cmd=0x3c006628,
> > seen=0x84c57b88) at Sudoku.m:487
> > ...
> > #86 0x1c0078b5 in -[Sudoku doFind:] (self=0x89023008, _cmd=0x3c006628,
> > seen=0x84c57b88) at Sudoku.m:487
> > #87 0x1c0078b5 in -[Sudoku doFind:] (self=0x89023008, _cmd=0x3c006628,
> > seen=0x84c57b88) at Sudoku.m:487
> > #88 0x1c0078b5 in -[Sudoku doFind:] (self=0x89023008, _cmd=0x3c006628,
> > seen=0x84c57b88) at Sudoku.m:487
> > #89 0x1c00726a in -[Sudoku find] (self=0x89023008, _cmd=0x3c002468) at
> > Sudoku.m:371
> > #90 0x1c001dfe in -[Controller newPuzzle:] (self=0x7f69c4e8,
> > _cmd=0x3c0089f8, sender=0x87c01f08) at Controller.m:102
> > #91 0x03fa3009 in -[NSApplication sendAction:to:from:] (self=0x7f2c3688,
> > _cmd=0x23f505f8, aSelector=0x3c0089f8, aTarget=0x0, sender=0x87c01f08) at
> > NSApplication.m:2259
> > #92 0x04079380 in -[NSMenu performActionForItemAtIndex:] (self=0x87c01a88,
> > _cmd=0x23f53100, index=2) at NSMenu.m:1320
> > #93 0x04083d59 in -[NSMenuView _trackWithEvent:] (self=0x7edfb108,
> > _cmd=0x23f53188, event=0x874c6788) at NSMenuView.m:1785
> > #94 0x04083e3c in -[NSMenuView trackWithEvent:] (self=0x7edfb108,
> > _cmd=0x23f531d8, event=0x874c6f08) at NSMenuView.m:1808
> > #95 0x0408400b in -[NSMenuView mouseDown:] (self=0x7edfb108,
> > _cmd=0x23facdf0, theEvent=0x874c6f08) at NSMenuView.m:1847
> > #96 0x0416d1e1 in -[NSWindow sendEvent:] (self=0x7e088808, _cmd=0x23f01690,
> > theEvent=0x874c6f08) at NSWindow.m:3694
> > #97 0x03fa2aa8 in -[NSApplication sendEvent:] (self=0x7f2c3688,
> > _cmd=0x23f015c8, theEvent=0x874c6f08) at NSApplication.m:2134
> > #98 0x03fa1223 in -[NSApplication run] (self=0x7f2c3688, _cmd=0x23ef6d80)
> > at NSApplication.m:1591
> > #99 0x03f7ed8f in NSApplicationMain (argc=1, argv=0xcfbdc36c) at
> > Functions.m:89
> > #100 0x1c00bac0 in gnustep_base_user_main (argc=1, argv=0xcfbdc36c,
> > env=0xcfbdc374) at main.m:168
> > #101 0x00f23c3c in main (argc=1, argv=0xcfbdc36c, env=0xcfbdc374) at
> > NSProcessInfo.m:979
> > #102 0x1c001507 in ___start ()
> > #103 0x1c001487 in _start ()
> > #104 0x00000000 in ?? ()
> > (gdb) frame 0
> > #0 0x0d95e0f1 in getframeaddr (level=104) at stacktraverse.c:262
> > 262 case 104: return __builtin_frame_address(105);
> > (gdb) frame 1
> > #1 0x0d95aa85 in backtrace (buffer=0x7cc42e00, size=127) at execinfo.c:60
> > 60 for (i = 1; getframeaddr(i + 1) != NULL && i != size + 1; i++) {
> > (gdb) list
> > 56 backtrace(void **buffer, int size)
> > 57 {
> > 58 int i;
> > 59
> > 60 for (i = 1; getframeaddr(i + 1) != NULL && i != size + 1; i++) {
> > 61 buffer[i - 1] = getreturnaddr(i);
> > 62 if (buffer[i - 1] == NULL)
> > 63 break;
> > 64 }
> > 65
> >
> > This happens for me on i386, with a snapshot from beginning last week.
> > So wondering why this is crashing for me in __builtin_frame_address()
> >
> > Sebastian
> >
> >
>
Index: patches/patch-execinfo_c
===================================================================
RCS file: /cvs/ports/devel/libexecinfo/patches/patch-execinfo_c,v
retrieving revision 1.2
diff -u -r1.2 patch-execinfo_c
--- patches/patch-execinfo_c 11 Nov 2008 15:48:47 -0000 1.2
+++ patches/patch-execinfo_c 13 Jun 2011 14:38:33 -0000
@@ -1,6 +1,17 @@
$OpenBSD: patch-execinfo_c,v 1.2 2008/11/11 15:48:47 naddy Exp $
--- execinfo.c.orig Mon Jul 19 07:21:09 2004
-+++ execinfo.c Tue Nov 11 16:45:54 2008
++++ execinfo.c Mon Jun 13 16:37:03 2011
+@@ -57,8 +57,8 @@ backtrace(void **buffer, int size)
+ {
+ int i;
+
+- for (i = 1; getframeaddr(i + 1) != NULL && i != size + 1; i++) {
+- buffer[i - 1] = getreturnaddr(i);
++ for (i = 1; getframeaddr(i - 2) != NULL && i != size + 1; i++) {
++ buffer[i - 1] = getreturnaddr(i - 1);
+ if (buffer[i - 1] == NULL)
+ break;
+ }
@@ -69,7 +69,8 @@ backtrace(void **buffer, int size)
char **
backtrace_symbols(void *const *buffer, int size)