This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GDB and Java JNI

I've recently started encountering issues when using GDB to try to
debug java native interface code. The native interface code was compiled
with GCC 2.96 ( with -g )as a 'c' language shared object library. The Java
program was compiled with Sun's JSDK 1.4 RC1.

I used to do the following steps :

    put a printout in the JNI code where I wish to stop to dump the 
process ID

    put a while loop into the code where I wish to be stopped  ie. 
while( stop==1 );

    run the java program  ( /usr/javabin/java MyProg )

    look up the name of the executable associated with the printed 
process ID
        ( this is because the java executable used to suprise me by being
            diffrerent from the java program(script) I ran )

    run: gdb process_name processID

Once I attached to the program, I would set the loop variable to 0, set some
breakpoints and continue. This worked great for me, but recently I have 
not been
able to get this to work. Several things have changed since I last did 
this successfully.
I used to do this against Sun's java1.2, I don't remeber if I did it 
agaist 1.3, and now I am
using Sun's java1.4 release candidate1. I also do not remeber which gdb 
version I last used
successfully, but I am now using GNU gdb Red Hat Linux (5.1-1). I am 
running red-hat linux 7.2
with kernel version 2.4.17.

The message I get when I follow the above procedure is :
(gdb) [dcook@cookie snmp]$ gdb /usr/java/j2sdk1.4.0/bin/java 2553
GNU gdb Red Hat Linux (5.1-1)
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(no debugging symbols found)...
/opt/projects/sable/ucdjni.2/edu/ucdavis/snmp/2553: No such file or 
Attaching to program: /usr/java/j2sdk1.4.0/bin/java, process 2553
Child process unexpectedly missing: No child processes.

Program terminated with signal ?, Unknown signal.
The program no longer exists.

If someone could give me some tips to get me debugging again I sure
would appreciate it!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]