Can't get Throwable.printStackTrace when statically linked

Jim Redman jim@ergotech.com
Fri Nov 22 12:18:00 GMT 2002


I have this problem with any code I compile with the "stock" gcj that 
comes with RH8:

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.spec
rename spec lib to liborig
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man 
--infodir=/usr/share/info --enable-shared --enable-threads=posix 
--disable-checking --host=i386-redhat-linux --with-system-zlib 
--enable-__cxa_atexit
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)


On 2002.11.22 11:16 Scott Gilbertson wrote:
> I don't get stack dumps when there's a Java exception in my
> statically-linked binary (works fine in dynamic linked version).  The
> following backtrace is from a core file generated from a Java
> exception.
> Since there's no stack dump printed, I don't know the original cause
> of the
> exception.
> 
> I see the following line in UnicodeToBytes.java:
>   String className = "gnu.gcj.convert.Output_" + encoding;
> so I assume it's failing to find Output_something.class.
> 
> Does anyone know a simple way to ensure that all the classes I need
> are in
> the executable, or do I just have to add "-u" entries to my link
> arguments
> whenever I find one missing?
> 
> UnicodeToBytes.getDefaultEncoder has a try/catch that should have
> caught the
> classloader failure, resulting in "return new Output_8859_1();", so
> why did
> the program abort?
> 
> Thanks,
> Scott.
> 
> (gdb) bt
> #0  0x08168c51 in kill ()
> #1  0x08155876 in raise ()
> #2  0x08168fad in abort ()
> #3  0x080a7264 in _Jv_Throw (value=0x83ecff0) at
> ../../../gcc/libjava/exception.cc:110
> #4  0x0809d60c in catch_segv (_dummy=138334192) at
> ../../../gcc/libjava/prims.cc:112
> #5  0x0809d621 in catch_segv(int) () at
> ../../../gcc/libjava/prims.cc:121
> #6  <signal handler called>
> #7  0x08184006 in __current_locale_name ()
> #8  0x081659bd in guess_category_value ()
> #9  0x08164fd6 in __dcigettext ()
> #10 0x08164d52 in dcgettext ()
> #11 0x08175cbe in strerror_r ()
> #12 0x08175bc4 in strerror ()
> #13 0x0815aba4 in dlerror ()
> #14 0x081120f4 in sys_dl_open (loader_data=0x0, filename=0xbf5ff84c
> "lib-gnu-gcj-convert-Output_ASCII")
>     at ../../../../gcc/libjava/libltdl/ltdl.c:299
> #15 0x0811264f in tryall_dlopen (handle=0xbf5ff7e4,
> filename=0xbf5ff84c
> "lib-gnu-gcj-convert-Output_ASCII")
>     at ../../../../gcc/libjava/libltdl/ltdl.c:937
> #16 0x08113269 in lt_dlopen (filename=0xbf5ff84c
> "lib-gnu-gcj-convert-Output_ASCII")
>     at ../../../../gcc/libjava/libltdl/ltdl.c:1511
> #17 0x08113daf in lt_dlopenext (filename=0xbf5ff84c
> "lib-gnu-gcj-convert-Output_ASCII")
>     at ../../../../gcc/libjava/libltdl/ltdl.c:1573
> #18 0x080bf45b in
> java::lang::Runtime::loadLibraryInternal(java::lang::String*)
> (this=0x40,
> lib=0x848b640)
>     at ../../../gcc/libjava/java/lang/natRuntime.cc:195
> #19 0x080bd0ff in
> gnu::gcj::runtime::VMClassLoader::findClass(java::lang::String*)
> (this=0x83f3f90, name=0x848b730)
>     at ../../../gcc/libjava/java/lang/natClassLoader.cc:211
> #20 0x080c627e in java.lang.ClassLoader.loadClass(java.lang.String,
> boolean)
> (this=0x83f3f90, name=0x848b730,
>     link=false) at ../../../gcc/libjava/java/lang/ClassLoader.java:120
> #21 0x080bd68f in _Jv_FindClass(_Jv_Utf8Const*,
> java::lang::ClassLoader*)
> (name=0x84190f0, loader=0x0)
>     at ../../../gcc/libjava/java/lang/natClassLoader.cc:535
> #22 0x080ba6e2 in java::lang::Class::forName(java::lang::String*,
> bool,
> java::lang::ClassLoader*) (
>     className=0x840f610, initialize=1 '\001', loader=0x0) at
> ../../../gcc/libjava/java/lang/natClass.cc:86
> #23 0x080ba77a in java::lang::Class::forName(java::lang::String*)
> (className=0x840f610)
>     at ../../../gcc/libjava/java/lang/natClass.cc:103
> #24 0x08101c41 in gnu.gcj.convert.UnicodeToBytes.getDefaultEncoder()
> ()
>     at ../../../gcc/libjava/gnu/gcj/convert/UnicodeToBytes.java:49
> #25 0x08122803 in
> java.io.OutputStreamWriter.OutputStreamWriter(java.io.OutputStream)
> (this=0x8470a08, out=0x83f3ea0)
>     at ../../../gcc/libjava/java/io/OutputStreamWriter.java:50
> #26 0x080d046c in 
> java.io.PrintWriter.PrintWriter(java.io.OutputStream)
> (this=0x840f690, out=0x83f3ea0)
>     at ../../../gcc/libjava/java/io/PrintWriter.java:122
> #27 0x080cd848 in 
> java.lang.Throwable.printStackTrace(java.io.PrintStream)
> (this=0x83ecff0, ps=0x83f3ea0)
>     at ../../../gcc/libjava/java/lang/Throwable.java:122
> #28 0x08092f74 in 
> manta::mts5000::hardware::TimingBoardDriver::eventRxLoop()
> ()
> #29 0x0809193a in manta::mts5000::hardware::TimingBoardDriver$1::run()
> ()
> #30 0x080c2815 in _Jv_ThreadRun(java::lang::Thread*)
> (thread=0x83f7910)
>     at ../../../gcc/libjava/java/lang/natThread.cc:285
> #31 0x08106aa3 in really_start (x=0x8415ff0) at
> ../../../gcc/libjava/posix-threads.cc:375
> #32 0x0810b432 in GC_start_routine (arg=0x83d5fc0) at
> ../../../gcc/boehm-gc/linux_threads.c:1372
> #33 0x081537b1 in pthread_start_thread ()
> 

-- 

Jim Redman
(505) 662 5156
http://www.ergotech.com



More information about the Java mailing list