Professional Web Applications Themes

JNI debugging - Mac Programming

Hi All, I'm using CW 8.3 on MacOS X 10.2.8 with Java 1.4.1 update 1. I am setting up a project which has two main parts. The first is a C++ dynamic library, built with CW. The second is a Java app that calls the library through JNI. This all works fine except I cannot debug the C++ code in the library. I can open the dll in the IDE and set breakpoints but CW does not break on these. Once I start debugging the Java app I open the Processes window and try to attach the 'java' process. Here ...

  1. #1

    Default JNI debugging

    Hi All,

    I'm using CW 8.3 on MacOS X 10.2.8 with Java 1.4.1 update 1.

    I am setting up a project which has two main parts. The first is a C++
    dynamic library, built with CW. The second is a Java app that calls
    the library through JNI. This all works fine except I cannot debug the
    C++ code in the library.

    I can open the dll in the IDE and set breakpoints but CW does not
    break on these.

    Once I start debugging the Java app I open the Processes window and
    try to attach the 'java' process. Here the whole IDE crashes out.

    I am working from the 'JNI example' in the CW examples and this
    crashes in the same manner.

    Interestingly it did work just once but I have not been able to repeat
    this. In this case I noticed that there was a process gdb-something?
    in the Process window. Is there something I have not installed or
    perhaps a gdb process that needs to be started?

    I also have whole C++ Powerplant apps that I can debug OK.


    Paul
    Paul Guest

  2. #2

    Default Re: JNI debugging

    dans l'article google.com, Paul Turner
    à com a écrit le 5/01/04 3:13:
     

    Paul,

    I do the same thing and found that CW is bugged there. This was confirmed by
    MW Ron. However I found the following workaround:
    - in the processes window, try to attach a 'small' process first. I usually
    attach the dock process. Apparently this helps CW to initialize the C
    debugger witout crashing. Resume the process.
    - now you should be able to attach the java process

    Eric

    Eric Guest

  3. #3

    Default Re: JNI debugging

    Eric VERGNAUD <fr> wrote in message news:<BC1F3EBF.18114%fr>... 

    Thank you. Attching a small process, like the Dock, first did enable
    me to attach my own Java process and debug on the C++ dyn lib side.

    The problem I now have is that the thread that is created to debug the
    library (called libmathCommon.A.dylib) does not die when the Java app
    quits. If I try to kill it I get a Bus Error message. There is also
    the gdb-powerpc-appl process still running according to the Process
    window.

    If I try to run the Java app again the IDE again crashes when I try to
    attach the Java process. I have to quit the IDE and relaunch to get it
    to clear.

    The whole process seems quite unstable as a working method. The IDE
    will crash out if I deviate from the single working method I have so
    far. I also seem to have more problems if I put break points in both
    the Java code and the C++ library. How do you find this in practice?
    Any tips?

    Paul
    Paul Guest

  4. #4

    Default Re: JNI debugging

    dans l'article google.com, Paul Turner
    à com a écrit le 6/01/04 4:58:
     
    >
    > Thank you. Attching a small process, like the Dock, first did enable
    > me to attach my own Java process and debug on the C++ dyn lib side.
    >
    > The problem I now have is that the thread that is created to debug the
    > library (called libmathCommon.A.dylib) does not die when the Java app
    > quits. If I try to kill it I get a Bus Error message. There is also
    > the gdb-powerpc-appl process still running according to the Process
    > window.
    >
    > If I try to run the Java app again the IDE again crashes when I try to
    > attach the Java process. I have to quit the IDE and relaunch to get it
    > to clear.
    >
    > The whole process seems quite unstable as a working method. The IDE
    > will crash out if I deviate from the single working method I have so
    > far. I also seem to have more problems if I put break points in both
    > the Java code and the C++ library. How do you find this in practice?
    > Any tips?
    >
    > Paul[/ref]

    I have not met all the problems you mention so I cannot help you further.
    But yes, the whole process IS unstable. I find it so painful that I created
    a small c++ app to debug the dylib. I only use this method to trace JNI
    related bugs.

    I haven't been able to do any JNI debugging in Xcode, so currently this
    method is the ONLY method I know to debug JNI libraries.

    Good luck

    Eric

    Eric Guest

  5. #5

    Default Re: JNI debugging

    In article <BC209B80.181E7%fr>,
    Eric VERGNAUD <fr> wrote:
     

    GDB works fine for debugging JNI. You might even be able to get it to
    work in Xcode by setting the debugger for your Java project to GDB
    rather than the Java debugger.

    -Eric

    --
    Eric Albert stanford.edu
    http://rescomp.stanford.edu/~ejalbert/
    Eric Guest

  6. #6

    Default Re: JNI debugging

    dans l'article stanford.edu, Eric Albert
    à stanford.edu a écrit le 7/01/04 11:49:
     
    >
    > GDB works fine for debugging JNI. You might even be able to get it to
    > work in Xcode by setting the debugger for your Java project to GDB
    > rather than the Java debugger.
    >
    > -Eric[/ref]

    What I'm speaking about is the ability to debug both Java and C++ code. Can
    you do this with Xcode ?

    Eric

    Eric Guest

  7. #7

    Default Re: JNI debugging

    Eric VERGNAUD wrote:
     

    Not at the same time. But you can debug using one in Xcode, and the other in a terminal. Alternately you can debug for awhile in one mode, exit, and then re-start getting there in the other mode.


    bolsinga@hotmail.com Guest

  8. #8

    Default Re: JNI debugging

    dans l'article Pa4Lb.7034$news.prodigy.com,
    com à com a écrit le 8/01/04 4:31:
     
    >
    > Not at the same time. But you can debug using one in Xcode, and the other in a
    > terminal. Alternately you can debug for awhile in one mode, exit, and then
    > re-start getting there in the other mode.
    >
    >[/ref]

    This is why I'm using CW 8.3. You can debug both at the same time.

    Eric

    Eric Guest

Similar Threads

  1. Debugging output does not appear when use Debugging IPAddresses
    By Schroeder2 in forum Coldfusion Server Administration
    Replies: 2
    Last Post: June 7th, 11:15 PM
  2. Debugging
    By Andrew Durstewitz in forum ASP
    Replies: 15
    Last Post: May 10th, 02:53 AM
  3. debugging ASP/DLL/IIS
    By Georg Bauer in forum ASP Components
    Replies: 1
    Last Post: August 19th, 01:33 PM
  4. VI Debugging
    By Scott in forum ASP
    Replies: 1
    Last Post: October 22nd, 12:28 PM
  5. debugging
    By Pete in forum PERL Miscellaneous
    Replies: 2
    Last Post: September 21st, 02:04 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139