No, 'dbx' is a debugger similar to 'gdb'. It's not a Java debugger like
jdb.

Under Linux, try using gdb and running the 'debug' version of the JVM
(e.g., 'java_g' rather than 'java'). 

My .gdbinit has the following:

  set env THREADS_TYPE=green_threads
  set env JAVA_HOME /home/cs/mdw/src/java/download/jdk117_v3
  set env CLASSPATH .:/home/cs/mdw/src/java/download/jdk117_v3/lib/classes.zip
  set env LD_LIBRARY_PATH 
.:/home/cs/mdw/src/java/download/jdk117_v3/lib/i686/green_threads
  exec-file /home/cs/mdw/src/java/download/jdk117_v3/bin/i686/green_threads/java_g

This should allow you to say, e.g., 
        (gdb) run MyClass

You can also set breakpoints and so forth in your native code, probably by 
specifying source lines or function names before you run the JVM. Otherwise
you could have a native method which has one line:
        __asm__("int $0x3");
which will cause the program to trap to the debugger where you can set
breakpoints, examine state, etc.

Of course this isn't useful for debugging Java code -- but a huge help for 
debugging native code. (I'm using it to debug a JIT compiler which are 
written as a combination of C and Java!)

"Christian Cryder" <[EMAIL PROTECTED]> writes:
> Hi folks!
> 
> This one is stumping me: Has anyone been able to debug JNI code on Linux?
> I am having absolutely zero success :-/
> 
> I've been trying to follow the debugging examples in Rob Gordon's
> Essential JNI, and can not get any of them to work (on either NT or
> Linux). He refers to dbx for Solaris...my install of Linux doesn't have
> this. Is this the equivalent of Sun's jdb??? If so, I've been able to run
> that and actually load/execute Java classes. The problem appears to be
> that its not finding the shared library files when it does a
> System.loadLibrary() call.
> 
> The code works fine when I run it normally (ie. outside jdb).
> Suggestions? I feel like I'm really close and its bugging me :-)
> 
> Oh to see into that little black box of native code...
> Christian


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

Reply via email to