Re: Problems debugging shared object code called from Java JNI

From: Wiseguy (noone_at_all.com)
Date: 12/02/04

  • Next message: AA: "/etc/fstab auto not auto-mounting"
    Date: 2 Dec 2004 00:50:48 -0600
    
    

    Exits Funnel <exitsfunnel@noyahoospam.com> mumbled in news:khurd.464
    $wk4.54@fe12.lga:

    > 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
    >

    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 =---


  • Next message: AA: "/etc/fstab auto not auto-mounting"

    Relevant Pages

    • JNI and buffer overflows (was java and buffer overflows)
      ... Here is how the JNI overflow situation plays out... ... # javah -jni HelloWorld ... Writing java dump to javacore14629.1025210621.txt ... ... GNU gdb Red Hat Linux 7.x ...
      (Vuln-Dev)
    • Problems debugging shared object code called from Java JNI
      ... Only the java API is ... RedHat linux on which we generate from it a shared object. ... to figure out how to use gdb to debug the driver but having no luck. ...
      (comp.os.linux)
    • Re: Apple is deprecating Java
      ... JNI and JNA leave a bit to be desired... ... large portion of the app is written, say, in C and C++, and Java or C# is ... moving the interface gunk onto the Java side of things is not ideal either ... public native void set ...
      (comp.lang.java.programmer)
    • Re: Clear the Screen
      ... cannot be implemented in any standard way across platforms. ... Even the 'standard' C and C++ languages which, like Java, aim for platform ... do not implement such functionality. ... of a development commitment needs be made by using JNI. ...
      (comp.lang.java)
    • Re: Opinions on complexity
      ... Java because it is the language I know the best. ... The only thing I was asking for, was some advice on the TCP/IP stack implementation. ... and combined with the RFCs for the protocol will speed your development. ... But, if Java is your choice, you really only need to JNI the low level socket functions that give you access to the interface device, writing you protocol stack in pure java. ...
      (comp.lang.java.programmer)