Some null pointer method invocations causes segmentation fault

Bryce McKinlay bryce@albatross.co.nz
Mon Mar 27 16:21:00 GMT 2000


"Rolf W. Rasmussen" wrote:

> The following program causes a segmentation fault when run, instead of
> the NullPointerException one would expect.
>
> [...]
> Program received signal SIGSEGV, Segmentation fault.
> 0x400dfef9 in java.lang.Integer.intValue (this=null)
>     at ../../../libjava/java/lang/Integer.java:60

The SIGSEGV you see in the debugger here is normal. The runtime catches
the segv and maps it into a NullPointerException. Unfortunatly, in these
cases the __throw() call in libgcc2.so is failing, which appears to be a
new regression ;-(.

Program received signal SIGABRT, Aborted.
0x40257d41 in __kill () from /lib/libc.so.6
(gdb) bt
#0  0x40257d41 in __kill () from /lib/libc.so.6
#1  0x4021b217 in raise (sig=6) at signals.c:65
#2  0x402590d8 in abort () at ../sysdeps/generic/abort.c:88
#3  0x804b59e in __default_terminate () at ../../gcc/libgcc2.c:3036
#4  0x804b5bc in __terminate () at ../../gcc/libgcc2.c:3036
#5  0x804c1fc in throw_helper (eh=@8083618, pc=@400e75ba,
my_udata=@bf7ffb0c,
    offset_p=@bf7ffb08) at ../../gcc/libgcc2.c:3170
#6  0x804c3f1 in __throw () at ../../gcc/libgcc2.c:3170
#7  0x400a98ba in Letext () at ../../../libjava/exception.cc:161
#8  0x4009f238 in catch_segv () at ../../../libjava/prims.cc:94
#9  0x400e75bb in java.lang.String.length (this=null)
    at ../../../libjava/java/lang/String.java:130
#10 0x804d97a in test.main (args=@8086ff0) at test.java:6
#11 0x40133420 in gnu::gcj::runtime::FirstThread::run (this=@8069ea0)
    at ../../../libjava/gnu/gcj/runtime/natFirstThread.cc:52
#12 0x4013e9ee in java::lang::Thread::run_ (obj=@8069ea0)
    at ../../../libjava/java/lang/natThread.cc:191
#13 0x40150821 in really_start (x=@808aff8)
    at ../../../libjava/posix-threads.cc:344
#14 0x402007aa in GC_start_routine (arg=@808bfe0)
    at ../../../boehm-gc/linux_threads.c:553
#15 0x40218b85 in pthread_start_thread (arg=@bf7ffe40) at manager.c:241


Could you enter a PR?
 http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?user=guest&password=guest&database=java&cmd=login

thanks

  [ bryce ]




More information about the Java mailing list