If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

gdb + native code + Java + linux

Hi
My question is about Java, C, and Debugging with gdb under Linux
So I am not shure in which group should I post it.

I have a Java Program (Proba.java) that loads the native library
(libmydll.so)
I generate the native library (libmydll.so) from a file Proba.cpp. So I have
both
the code for the Java Program and the code for the native library.
Now I have a problem with the code in the native library and I want to debug
it.
The jdb (Java Debugger) obviously do not fit my needs.

I am trying gdb (The GNU Debugger). I am trying the following
1.Start the Java application.
java Proba
2. Wait for the native library to load
3. See what the PID of the Java process is
ps -a
4. Start the 'gdb' with two parameters. The java executable file and the PID
of the process
gdb <java_executable_file> <PID>
5. The 'gdb' connects to the process and the Java application freezes, couse
it is being debugged
6. I try to put a breakpoint in Proba.cpp at line 330 and I receive the
following response from 'gdb'

(gdb) break Proba.cpp:330
No symbol table is loaded. Use the "file" command.
(gdb)
7. I try to use the 'file' command In the following way

(gdb) file libmydll.so
A program is being debugged already. Kill it? (y or n) n
Program not killed.
(gdb)

Obviously I choose 'no'
8. I try the load command in the 'gdb'

(gdb) load libmudll.so
You can't do that when your target is `multi-thread'
(gdb)

9. I give up.

Does anybody know how can I debug this. I have the code of the Java-App and
the
code of the native library, but I do not have the code of the JVM.