Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / January 2004



Tip: Looking for answers? Try searching our database.

JNI debugging

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul Turner - 05 Jan 2004 02:13 GMT
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
Eric VERGNAUD - 05 Jan 2004 15:18 GMT
dans l'article c50c80ac.0401041813.7e379833@posting.google.com, Paul Turner
à paul_aeronaut@mac.com a écrit le 5/01/04 3:13 :

> Hi All,
>
[quoted text clipped - 22 lines]
>
> Paul

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
Paul Turner - 06 Jan 2004 03:58 GMT
> I do the same thing and found that CW is bugged there. This was confirmed by
> MW Ron. However I found the following workaround:
[quoted text clipped - 4 lines]
>
> Eric

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
Eric VERGNAUD - 06 Jan 2004 16:06 GMT
dans l'article c50c80ac.0401051958.3b95e53d@posting.google.com, Paul Turner
à paul_aeronaut@mac.com a écrit le 6/01/04 4:58 :

>> I do the same thing and found that CW is bugged there. This was confirmed by
>> MW Ron. However I found the following workaround:
[quoted text clipped - 25 lines]
>
> Paul

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 Albert - 07 Jan 2004 10:49 GMT
> 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.

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

Signature

Eric Albert         ejalbert@cs.stanford.edu
http://rescomp.stanford.edu/~ejalbert/

Eric VERGNAUD - 07 Jan 2004 20:10 GMT
dans l'article ejalbert-B025D1.02495107012004@news.stanford.edu, Eric Albert
à ejalbert@cs.stanford.edu a écrit le 7/01/04 11:49 :

>> 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.
[quoted text clipped - 4 lines]
>
> -Eric

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

Eric
bolsinga@hotmail.com - 08 Jan 2004 03:31 GMT
>What I'm speaking about is the ability to debug both Java and C++ code. Can
>you do this with Xcode ?

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.
Eric VERGNAUD - 08 Jan 2004 11:02 GMT
dans l'article Pa4Lb.7034$851.2435@newssvr27.news.prodigy.com,
bolsinga@hotmail.com à bolsinga@hotmail.com a écrit le 8/01/04 4:31 :

>> What I'm speaking about is the ability to debug both Java and C++ code. Can
>> you do this with Xcode ?
>
> 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.

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

Eric
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.