If you want to debug JNI code, you need to run a native debugger like
gdb, not a Java debugger. It would be nice if a single debugger could
handle both, but no debugger (that I know of) can do that.

It's a bit tricky to set up. Here's a document from IBM that talks about
how to do it with the AIX debugger:

    http://www.developer.ibm.com/library/aix/jnidbx.html

and you can try something similar with gdb.

Another technique popular among Java developers is to put print statements
in the code for debugging. It's primitive, but for many problems it's
simpler than puzzling out the debugger setup.

Nathan


On Fri, Oct 19, 2001 at 10:21:27AM -0400, SRINIVASA GURUSU wrote:
> Hi ,
> i am new to JNI. I am trying to set the break point in JNI code using jdb...( 
> REdhat Linux7.1 + blackdown jdk1.3.1)
> 
> i follwed the below proceduredures....
> 
> 1.........
> setting environment for
> export LD_PRELOAD=libHelloWorld.so
> export DEBUG_PROG=jdb
> 
> then i tryed to run my program using
>       java -green HelloWorld
> 
> it did not invoke the jdb... and it's executing as if the normal program
> 
> 2........
> setting environment for
> export LD_PRELOAD=libHelloWorld.so
> export DEBUG_PROG=jdb
> 
> $ jdb
> > stop in HelloWorld.main
> Deferring breakpoint HelloWorld.main.
> It will be set after the class is loaded.
> >run HelloWorld
> run  HelloWorld
>  
> VM Started: > Set deferred breakpoint HelloWorld.main
>  
> Breakpoint hit: thread="main", HelloWorld.main(), line=4, bci=0
>   4         new HelloWorld().print();
> >stop in HelloWorld.print  ( print implemented as JNI )
> Unable to set breakpoint HelloWorld.print : Breakpoints can be located only 
> in classes. HelloWorld is an interface or array
> 
> Can anybody tell me the right procedure to set break point inside JNI code.
> 
> Thanks,
> srini
> 
> 
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> 

-- 


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to