This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Segfault with trivial SWT snippet
- From: Andrew Haley <aph-gcc at littlepinkcloud dot COM>
- To: Carl Worth <cworth at cworth dot org>
- Cc: java at gcc dot gnu dot org
- Date: Tue, 13 Nov 2007 11:33:33 +0000
- Subject: Re: Segfault with trivial SWT snippet
- References: <87bq9z6qs8.wl%cworth@cworth.org>
Carl Worth writes:
> I'm trying my first-ever[*] attempt at using gcj, and trying to get a
> minimal SWT program (attached) to work.
>
> I'm compiling it with:
>
> gcj -I /usr/share/java/swt-gtk-3.3.1.jar -lswt -lswt-pi \
> --main=Snippet1 -o Snippet1 Snippet1.java
>
> which works, but running the resulting binary just segfaults with the
> following backtrace:
>
> #0 0xb65494f1 in _Jv_equalUtf8Consts (a=0x0, b=0xb6fd92ba)
> at ../../../src/libjava/prims.cc:211
> #1 0xb6593e17 in _Jv_GetMethodLocal (klass=0xb74845e0, name=0x0,
> signature=0x0)
> at ../../../src/libjava/java/lang/natClass.cc:1631
> #2 0xb6596203 in java::lang::Class::initializeClass (this=0xb74845e0)
> at ../../../src/libjava/java/lang/natClass.cc:778
> #3 0xb65961e3 in java::lang::Class::initializeClass (this=0xb75ed260)
> at ../../../src/libjava/java/lang/Class.h:742
> #4 0xb65961e3 in java::lang::Class::initializeClass (this=0xb75e6280)
> at ../../../src/libjava/java/lang/Class.h:742
> #5 0xb65961e3 in java::lang::Class::initializeClass (this=0xb75e75e0)
> at ../../../src/libjava/java/lang/Class.h:742
> #6 0xb65961e3 in java::lang::Class::initializeClass (this=0xb75e53c0)
> at ../../../src/libjava/java/lang/Class.h:742
> #7 0xb654b717 in _Jv_AllocObjectNoFinalizer (klass=0xb75e53c0)
> at ../../../src/libjava/java/lang/Class.h:742
> #8 0xb654b746 in _Jv_AllocObject (klass=0xb75e53c0)
> at ../../../src/libjava/prims.cc:597
> #9 0xb6598364 in _Jv_CheckABIVersion (value=3086296000)
> at ../../../src/libjava/java/lang/natClassLoader.cc:221
> #10 0xb659852b in _Jv_RegisterClasses (classes=0xb7f3f048)
> at ../../../src/libjava/java/lang/natClassLoader.cc:238
> #11 0xb7d19f41 in ?? () from /usr/lib/libswt.so.3.3
> #12 0xb7f3f010 in ?? () from /usr/lib/libswt.so.3.3
> #13 0xb7f40c0c in ?? () from /usr/lib/libswt.so.3.3
> #14 0xbfe16988 in ?? ()
> #15 0xb7d0b7db in _init () from /usr/lib/libswt.so.3.3
> Backtrace stopped: frame did not save the PC
>
> This is on a Debian system with the following package versions:
>
> gcj (GCC) 4.2.3 20071014 (prerelease) (Debian 4.2.2-3)
> libgcj8-1: 4.2.2-3
> libswt-gtk-3.3: 3.3.1-1
>
> Meanwhile, installing the eclipse-gcj package gives me a native
> eclipse binary that links against all the same libgcj and swt
> libraries as my test program, but it does seem to run fine.
>
> Anyone have any ideas for how I might debug this situation further?
>
> If anyone could try to replicate this, then success or failure reports
> from that might be very useful.
Try compiling with -findirect-dispatch -fpic.
Andrew.