Here's what I had to do on my system to get jdb running.  It did
not run without root's help:

uname -a
Linux joi 2.2.12-20 #1 Mon Sep 27 10:40:35 EDT 1999 i686 unknown

cat /etc/issue
Red Hat Linux release 6.1 (Cartman)
Kernel 2.2.12-20 on an i686

java -version
java version "1.2.2"
Classic VM (build 1.2.2-L, green threads, nojit)

Initial attempts to run jdb all died with complaints about not 
loading libjdwp, so I had to fix that, first:

find /usr/local/java -name libjdwp.so
/usr/local/java/jdk1.2.2/lib/i386/libjdwp.so

su root
vi /etc/ld.so.conf
  append line "/usr/local/java/jdk1.2.2/lib/i386"
/sbin/ldconfig


Got past that, then it was a matter of figuring out what to put on the
command line.  I used an existing launch shell script as a guide and
ended up with this:

#!/bin/bash
#export LD_LIBRARY_PATH="/usr/local/java/jdk1.2.2/lib/i386/libjdwp.so"
#jdb -dbgtrace -tclassic -sourcepath ./src -classpath ./classes 
com.aravox.utils.ShunWizard
ROOT=/home/joi/jbproject
echo "Using $ROOT directory"
jdb -tclassic \
  -sourcepath $ROOT/JUnit/src:$ROOT/TestUtils/src:$ROOT/Utils:src \
  -classpath  $ROOT/JUnit/classes:$ROOT/TestUtils/classes:$ROOT/Utils/classes  \
  junit.textui.TestRunner com.aravox.utils.AllTests 


This is a set of JUnit tests which require the JUnit classes, the Test classes
I wrote (TestUtils), and the application under test (Utils).

 ./debug.sh 
Using /home/joi/jbproject directory
Initializing jdb...
> run
run junit.textui.TestRunner com.aravox.utils.AllTests
> 
VM Started: .........
Time: 0.019

OK (9 tests)


The application exited



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]

-- 
------------------------------------------------------------------------



--
Joi Ellis                    Software Engineer
Aravox Technologies          [EMAIL PROTECTED], [EMAIL PROTECTED]

No matter what we think of Linux versus FreeBSD, etc., the one thing I
really like about Linux is that it has Microsoft worried.  Anything
that kicks a monopoly in the pants has got to be good for something.
           - Chris Johnson


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

Reply via email to