Re: Problems debugging shared object code called from Java JNI
From: Wiseguy (noone_at_all.com)
Date: 2 Dec 2004 00:50:48 -0600
Exits Funnel <firstname.lastname@example.org> mumbled in news:khurd.464
> 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.
> 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
> 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
> gdb but I can't figure it out.
> I've tried this:
> gdb --args java MyTest
> 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.
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 =---