I'm trying to get unwind to work.
I was unable to get an unwind example to work directly,
so I decided to compile a c program that uses setjmp
and longjmp and work backwards.
I keep running into a "Abort trap" problem, whatever "Abort
trap" is.
Anyway, here's an example of a C program that compiles
and works properly under normal gcc, but that fails with
an "Abort trap" under LLVM:
#include <setjmp.h>
long (*g_pfunc) ();
jmp_buf g_jbuf;
long foo() {
printf("Hello World!\n");
longjmp(g_jbuf, 0);
return 0;
}
main () {
g_pfunc = foo;
setjmp(g_jbuf);
g_pfunc();
}
I'm using Mac OS X version 10.3.8
I just installed and build LLVM yesterday from CVS.
First I try it with bytecodes: ~/compiler/temp$ llvmgcc sjmp01.c -o sjmp01 ~/compiler/temp$ ./sjmp01 Hello World! Abort trap Same results for lli sjmp01.bc Now I try converting to native code: ~/compiler/temp$ llc sjmp01.bc -enable-correct-eh-support -o sjmp01.s ~/compiler/temp$ gcc sjmp01.s -o sjmp01.native ~/compiler/temp$ ./sjmp01.native Hello World! Bus error ~/compiler/temp$ On Apr 20, 2005, at 3:08 PM, Chris Lattner wrote:> On Wed, 20 Apr 2005, Greg Pettyjohn wrote: >> I'm trying to get unwind to work. >> >> I was unable to get an unwind example to work directly, >> so I decided to compile a c program that uses setjmp >> and longjmp and work backwards. >> >> I keep running into a "Abort trap" problem, whatever "Abort trap" is. >> >> Anyway, here's an example of a C program that compiles >> and works properly under normal gcc, but that fails with >> an "Abort trap" under LLVM: >> >> #include <setjmp.h> >> >> long (*g_pfunc) (); >> jmp_buf g_jbuf; >> >> long foo() { >> printf("Hello World!\n"); >> longjmp(g_jbuf, 0); >> return 0; >> } >> >> main () { >> g_pfunc = foo; >> >> setjmp(g_jbuf); >> g_pfunc(); >> } >> >> I'm using Mac OS X version 10.3.8 >> I just installed and build LLVM yesterday from CVS. > > How are you compiling and running this program? > > -Chris > > -- > http://nondot.org/sabre/ > http://llvm.cs.uiuc.edu/ > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
On Wed, 20 Apr 2005, Greg Pettyjohn wrote:> I'm trying to get unwind to work. > > I was unable to get an unwind example to work directly, > so I decided to compile a c program that uses setjmp > and longjmp and work backwards. > > I keep running into a "Abort trap" problem, whatever "Abort trap" is. > > Anyway, here's an example of a C program that compiles > and works properly under normal gcc, but that fails with > an "Abort trap" under LLVM: > > #include <setjmp.h> > > long (*g_pfunc) (); > jmp_buf g_jbuf; > > long foo() { > printf("Hello World!\n"); > longjmp(g_jbuf, 0); > return 0; > } > > main () { > g_pfunc = foo; > > setjmp(g_jbuf); > g_pfunc(); > } > > I'm using Mac OS X version 10.3.8 > I just installed and build LLVM yesterday from CVS.How are you compiling and running this program? -Chris -- http://nondot.org/sabre/ http://llvm.cs.uiuc.edu/