RE: [java-gnome-hackers] Debugging Native code
Brought to you by:
afcowie
From: Jeffrey M. <Jef...@Br...> - 2002-09-03 13:43:17
|
The problem you are having is that you are initializing TestGNOME with a call to Gtk.init(). This will not work for GNOME applications. You will need to use one of the GnomeProgram init methods. Also, we need to make sure that the libGNOMEJava.so shared object is loaded. This should also happen in the GnomeProgram object. You might take a look at some old code that is in src/code/jni/java and src/code/jni/glue for the GnomeProgram object. A cleaner implementation of this might work. -Jeff > I've done a CVS commit of what I have so far Here are the problems I > found and tried to fix: > > About's constructor couldn't handle pixmap being null. The strange > thing is that I wasn't getting a null pointer exception, but it was > hanging when running. When debugging, I'd get the exception??? > > Since About extended Dialog, Dialog's empty parameter constructor was > run. This constructor makes a native call which allocates > memory for a > gtk dialog which is never used. Maybe we don't care since it > should be > cleaned up in the finalize event? I changed About so that it extends > Window, but am not sure that this the *correct* answer. > > The results I see using jdb have been inconsistent. Most of > the time, I > end with an unsatisfied link error; but once I managed to get into a > loop calling the button event handler??? I *think* the > unsatisfied link > error may be the clue I need. I've got my LD_LIBRARY_PATH variable > pointing to java-gnome/lib. The fact that I can create and view the > main window and the Dialog indicates to me that the libraries can be > found. > > I've tried attaching to the VM with gdb as suggested in > http://www-106.ibm.com/developerworks/java/library/j-jnidebug/ ?dwzone=java but have had little success. Long story long, this has been very frustrating. I feel that this is a function of me just not having any experience debugging JNI calls; but I felt I'd do better than this! What do I need to set up in eclipse to have this all work? I've loaded the java-gnome/.project and set the path to the java JDK (BlackDown 1.3.1). I'll install the C/C++ development stuff as you suggest. On Sat, 2002-08-31 at 07:22, Jeffrey Morgan wrote: > One other thing I forgot to mention. You will want to > get the C/C++ development plugin for eclipse. You can > find it here: > > http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/cdt-home/main.html?c vsroot=Tools_Project > > > > On Fri, 2002-08-30 at 19:56, Philip A. Chapman wrote: > > Jeff, > > > > I'm having issues with the TestGNOME application. The first button > > creates an About object instance and shows it. By putting > > System.out.println()'s in About.java, I've determined that the code is > > hanging in the call to java_about_new in org_gnu_gnome_About.c. > > Therefore, I need to do some debugging in the native code to determine > > what's happening. > > > > I'm about to install eclipse in hopes that it has good debugging into > > jni calls. If you have any tips or tricks you've picked up on how to > > debug jni calls, I'd appreciate them. > > > > It appears that the other classes the TestGNOME application have similar > > problem too. > > > > I wanted to install eclipse anyway, but haven't taken the time until > > now. :-) > > -- > > Philip A. Chapman > > > > > ------------------------------------------------------- > This sf.net email is sponsored by: OSDN - Tired of that same old > cell phone? Get a new here for FREE! > https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 > _______________________________________________ > java-gnome-hackers mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers -- Philip A. Chapman |