Discussion:
Problems debugging shared object code called from Java JNI
(too old to reply)
Exits Funnel
2004-12-02 04:28:48 UTC
Permalink
Hello,

I'm currently working a project which comprises a Java API layer and a
native C++ piece (which I'll call the driver). Only the java API is
exposed to our clients. Internally, the java makes calls to the C++
through JNI. We port the native stuff to several platforms including
RedHat linux on which we generate from it a shared object. I'm trying
to figure out how to use gdb to debug the driver but having no luck. I
want to be able to set a breakpoint in one of the native source files
and then launch the java process on some java test code which results in
calls into the shared object - thereby letting me do source level
debugging in the shared object. Just to be clear, I'm not trying to
debug the java code, just the shared object. I can do this in the
developer studio on Windows so I'd be surprised if I couldn't do it with
gdb but I can't figure it out.

I've tried this:

gdb --args java MyTest

run

but gdb complains about 'no debugging symbols found' and also that it
'Cannot find user-level thread for LWP 4494: generic error.'

Does anyone have any suggestions. Thanks in advance for any help.

-exits
Wiseguy
2004-12-02 06:50:48 UTC
Permalink
Post by Exits Funnel
Hello,
I'm currently working a project which comprises a Java API layer and a
native C++ piece (which I'll call the driver). Only the java API is
exposed to our clients. Internally, the java makes calls to the C++
through JNI. We port the native stuff to several platforms including
RedHat linux on which we generate from it a shared object. I'm trying
to figure out how to use gdb to debug the driver but having no luck.
I
Post by Exits Funnel
want to be able to set a breakpoint in one of the native source files
and then launch the java process on some java test code which results in
calls into the shared object - thereby letting me do source level
debugging in the shared object. Just to be clear, I'm not trying to
debug the java code, just the shared object. I can do this in the
developer studio on Windows so I'd be surprised if I couldn't do it with
gdb but I can't figure it out.
gdb --args java MyTest
run
but gdb complains about 'no debugging symbols found' and also that it
'Cannot find user-level thread for LWP 4494: generic error.'
Does anyone have any suggestions. Thanks in advance for any help.
-exits
I'm kind of shooting in the dark here because I've never done it myself,
but IIRC you can attach gdb to a running process. Maybe put some kind
of an explicit wait at the point where JNI takes over and then run gdb
as a separate task. Use gdb to attach to the process of the running
thread that will go JNI after the wait passes.



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Loading...