Threads and co

Bryce McKinlay bryce@waitaki.otago.ac.nz
Tue May 28 16:03:00 GMT 2002


Andreas Tobler wrote:

> What I do not understand is this code from 
> libjava/gnu/gcj/runtime/natFirstThread.cc:46
>
>   main_func *real_main = (main_func *) meth->ncode;
>   (*real_main) (args);
>
> The meth->ncode contains a reasonable value (see below), but the 
> real_main contains rubbish.
>
> (gdb) p args
> $5 = 0x7 <Address 0x7 out of bounds>
> (gdb) p *args
> Cannot access memory at address 0x7
> (gdb)
> (gdb) p *meth
> $6 = {
>   name = 0x7c0802a6,
>   signature = 0x7d800026,
>   accflags = 55745,
>   index = 65392,
>   ncode = 0xd9e1ff78,
>   throws = 0xda01ff80
> }
> (gdb)



Did you build libgcj without optimization? You can expect degbugging to 
give confusing results if its an optimized build. It should be 
sufficient here to just touch natFirstThread.cc and "make CXXFLAGS=-g" 
or something like that.

regards

Bryce.




More information about the Java mailing list