For jdb 
the command use <dir> should work for most class files I just tried
1.2.2 fcs and it
worked ok (perhaps run strace to see why it is not working)

I managed to use oldjdb with 1.3 and use worked ok there for simple
.class files too

For gdb you'll need to handle SIGUSR1 (the following works for 1.3)

Here is my .gdbinit file, I cd into the Java2Demo directory
export APPHOME=/export/d1/jdk1.3
export
LD_LIBRARY_PATH=/export/d1/jdk1.3/jre/lib/i386/native_threads:/export/d1/jdk1.3/jre/lib/i386:/export/d1/jdk1.3/jre/lib/i386/hotspot

file /export/d1/jdk1.3/jre/lib/i386/native_threads/java
break main
run -jar Java2Demo.jar
handle SIGUSR1 nostop noprint pass
handle SIGSEGV nostop noprint pass
handle SIGILL  nostop noprint pass
handle SIGQUIT nostop noprint pass

regards
calvin

Kris Heyrman wrote:
> 
> Hi,
> 
> I think I am getting stupid: I just spent a day trying to find out how best to
> debug a project that is getting fairly complicated, in Java. I did not find out
> how, so I am asking the question. Hopefully, somebody can give me a hint.
> 
> 1. I am using Sun JDK 1.2.2 ("Java 2 Standard Edition JDK 1.2.2 RC1") on Linux
> Red Hat 6.2 and my source files are spread out over a directory tree. Kernel is
> 2.2.14-12 and glibc is 2.1.3-15.
> 
> 2. Sun's JDB works but stubbornly refuses to find my source files. Used either
> with the option 'sourcepath .:mydirs' or with the JDB command 'use .:mydirs',
> it fails to find the .java files and debugging is no fun like that.
> 
> When asked which sourcepath it uses, it always says: '.'.
> 
> 3. I also have Sun's JDK 1.3 beta but it has the same JDB (99/06/11) and it
> does not work at all. (Sun says so in its announcement).
> 
> 4. I tried using gdb with a complex arrangement involving green threads:
>      export JAVA_HOME=$JAVA
>      export JAVA_COMPILER=NONE
>      export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/classes.zip
>      export LD_LIBRARY_PATH=\
>      $JAVA_HOME/jre/lib/$PROCESSOR/native_threads:\
>      $JAVA_HOME/jre/lib/$PROCESSOR/classic:\
>      $JAVA_HOME/jre/lib/$PROCESSOR:\
>      $LD_LIBRARY_PATH:
>      COMMAND="gdb $JAVA_HOME/bin/$PROCESSOR/native_threads/java"
> 
>     When running, it give a lot of unwanted dumps of SIGQUIT scrolling over the
> screen.
> 
> 5. I did the same with native_threads: I gives a
> 
> (gdb) run
> Starting program: /usr/local/jdk1.2.2/bin/i386/native_threads/java
> [New Thread 18444 (manager thread)]
> [New Thread 18437 (initial thread)]
> [New Thread 18445]
> [Switching to Thread 18445]
> 
> Program received signal SIGSYS, Bad system call.
> 0x400c7deb in __sigsuspend (set=0xbf7ffc94)
>     at ../sysdeps/unix/sysv/linux/sigsuspend.c:48
> 48      ../sysdeps/unix/sysv/linux/sigsuspend.c: No such file or directory.
> 
> 6. Tried the IBM jikes debugger, but it will only run with JDK 1.1.6.
> 
> 7. Saw that GNU has a new java compiler jcl and a simple HOWTO on how to use it
> with gdb, but it will not compile even JDK 1.1 features like anonymous inner
> classes.
> 
> I would be thankful to anybody who can spot my mistakes, or even better:
> suggest how to do useful debugging of Java on Linux in my situation.
> 
> Kind Regards,
> 
> --
> Kris Heyrman.
> Ottergemsesteenweg 337, B-9000 Gent.      Phone:  +32.9.221.79.69
>                                           Mobile: +32.495.380.128
> "L'an 0. On arrète tout, puis on réflechit. Et c'est pas triste."
> 
> ----------------------------------------------------------------------
> 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