GCJ application runs not too bad with shared libs, but crashes with static libs
Scott Gilbertson
scottg@mantatest.com
Thu Nov 21 13:12:00 GMT 2002
> Are you using incremental garbage collection?
>
> - a
I don't think so, since I can't find any calls to GC_enable_incremental in
gcj or libjava.
>
> "Scott Gilbertson" <scottg@mantatest.com> writes:
> > I'm working on an AWT application with libgcjx. I know that sounds
> > dangerous, but I've been able to hack the library enough to make it go,
> > since I'm using all custom components, and therefore only need
Component,
> > Container, Frame and a few layouts.
> >
> > The problem is that if I build it with "-static", it crashes a lot.
Running
> > gdb with a breakpoint on "abort", it usually stops in __libc_write or
> > sigsuspend, sometimes right away, and sometimes after you bang at the
> > application for a while. Any little thing seems to change the result.
For
> > example, I did "gdb mts5000.bin | tee gdb1.tmp", and the thing ran for
about
> > 10 minutes without crashing before I finally gave up. Redirecting the
> > output to /dev/null also seems to improve things. When I run the
program on
> > my target embedded system, however, it always crashes within 20 seconds
or
> > so of operation.
> >
> > When I build gcc 3.2.1, I used the following configuration (then
> > hand-modified the Makefile as described in my earlier posting).
> > ../gcc.orig/configure
> > --prefix=/usr
> > --mandir=/usr/share/man
> > --infodir=/usr/share/info
> > --enable-shared
> > --enable-threads=posix
> > --disable-checking
> > --host=i386-redhat-linux
> > --enable-java-awt=xlib
> > --enable-libgcj
> > --enable-languages=java
> > --with-system-zlib
> > --enable-__cxa_atexit
> >
> >
> > The shared-library version uses the following libraries (according to
ldd):
> > libgcjx.so.3 => /usr/lib/libgcjx.so.3 (0x4002f000)
> > libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40060000)
> > libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4013e000)
> > libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x401e8000)
> > libgcj.so.3 => /usr/lib/libgcj.so.3 (0x401f0000)
> > libm.so.6 => /lib/i686/libm.so.6 (0x407e2000)
> > libpthread.so.0 => /lib/i686/libpthread.so.0 (0x40804000)
> > libz.so.1 => /usr/lib/libz.so.1 (0x40835000)
> > libdl.so.2 => /lib/libdl.so.2 (0x40843000)
> > libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
> > libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40846000)
> > libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x4084f000)
> > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> >
> > Here are my compile and link commands:
> > gcj -O2 -c -o mts5000.o mts5000.jar
> > gcj --main=Main -g -o mts5000.bin -static -static-libgcc
> >
./libgcjx.o -Dawt.toolkit=gnu.awt.xlib.XToolkit -L/usr/X11R6/lib -lX11 -lstd
> > c++ mts5000.o
> >
> > Here is a typical debug output:
> > [root@mts5000dev1 java]# gdb mts5000.bin
> > GNU gdb Red Hat Linux (5.2.1-4)
> > 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 "i386-redhat-linux"...
> > (gdb) set args PC
> > (gdb) break abort
> > Breakpoint 1 at 0x80a71ca: file ../../../gcc/libjava/exception.cc, line
29.
> > (gdb) run
> > Starting program: /home/scott/mts5000/java/mts5000.bin PC
> > ... lots of application-generated stuff...
> > Program received signal SIGABRT, Aborted.
> > 0x0817b8e4 in __libc_write ()
> > (gdb) where
> > #0 0x0817b8e4 in __libc_write ()
> > #1 0x00000018 in ?? ()
> > #2 0x081155ca in java::io::FileDescriptor::write(JArray<char>*, int,
int)
> > (this=0x83cffc8, b=0x840edb8, offset=24,
> > len=1) at java/io/natFileDescriptor.cc:164
> > #3 0x080ce147 in java.io.BufferedOutputStream.flush() (this=0x840a1c0)
> > at ../../../gcc/libjava/java/io/BufferedOutputStream.java:141
> > #4 0x080cfc22 in java.io.PrintStream.flush() (this=0x83f3fa8) at
> > ../../../gcc/libjava/java/io/PrintStream.java:57
> > #5 0x080cfcc6 in java.io.PrintStream.print(java.lang.String, boolean)
> > (this=0x83f3fa8, str=0x8580270, println=true)
> > at ../../../gcc/libjava/java/io/PrintStream.java:77
> > #6 0x080d01a0 in java.io.PrintStream.println(java.lang.String)
> > (this=0x83f3fa8, str=0x8580270)
> > at ../../../gcc/libjava/java/io/PrintStream.java:219
> > #7 0x0809a107 in
> > manta::mts5000::Main::dumpComponentContents(java::awt::Component*, int,
> > java::lang::String*) ()
> > #8 0x0809a279 in
> > manta::mts5000::Main::dumpComponentContents(java::awt::Component*, int,
> > java::lang::String*) ()
> > #9 0x0809a279 in
> > manta::mts5000::Main::dumpComponentContents(java::awt::Component*, int,
> > java::lang::String*) ()
> > #10 0x0809a279 in
> > manta::mts5000::Main::dumpComponentContents(java::awt::Component*, int,
> > java::lang::String*) ()
> > #11 0x08099fee in
manta::mts5000::Main::Main(JArray<java::lang::String*>*)
> > ()
> > #12 0x08099cc2 in
manta::mts5000::Main::main(JArray<java::lang::String*>*)
> > ()
> > #13 0x081151a2 in gnu::gcj::runtime::FirstThread::call_main()
> > (this=0x8410ea0)
> > at ../../../gcc/libjava/gnu/gcj/runtime/natFirstThread.cc:46
> > #14 0x080c27d9 in _Jv_ThreadRun(java::lang::Thread*) (thread=0x8410ea0)
> > at ../../../gcc/libjava/java/lang/natThread.cc:285
> > #15 0x0809e8c4 in _Jv_RunMain(java::lang::Class*, char const*, int, char
> > const**, bool) (klass=0x8279900, name=0x0,
> > argc=2, argv=0x8410ea0, is_jar=false) at
> > ../../../gcc/libjava/prims.cc:1010
> > #16 0x0809e9b4 in JvRunMain (klass=0x8279900, argc=2, argv=0xbffff954)
at
> > ../../../gcc/libjava/prims.cc:1020
> > #17 0x080481fd in main (argc=2, argv=0xbffff954) at /tmp/cc30GAd5.i:12
> > #18 0x0815b1aa in __libc_start_main ()
> > (gdb)
> >
> > Any idea what's going on here?
> > Thanks.
> >
> >
> >
>
> --
>
More information about the Java
mailing list