richard johnson wrote:
> 
> Hello,
> 
> I am in the process of porting a JNI dynamic library to
> Unix that was developed on wiindows.  I have made
> some errors and would like to debug but am having
> some troubles using ddd and gdb.

JNI debugging is a bit tricky, because of the need to set a breakpoint
in code that isn't loaded until after you've been running a while. You
might want to look at
http://www.mail-archive.com/java-linux@java.blackdown.org/msg10450.html
for an earlier discussion about how to do it. This isn't the only
solution, and it isn't always the best one, but it often works.

Nathan Meyers
[EMAIL PROTECTED]


> 
> The following snippets are from the stderr stream
> when I run without the debugger and just crash.
> I get this signal:
> 
>         SIGTRAP   5*   trace trap
>                 stackpointer=0xbffff17c
> 
> I am using:
> 
>         Full thread dump Classic VM (Linux_JDK_1.2_pre-release-v2, native threads):
> 
> The main thread stack trace looks like
> 
>         "main" (TID:0x404d41e0, sys_thread_t:0x804c238, state:R, native ID:0x400) 
>prio=5
>                 at fp.platformInterface.EFoo.nInitialize(Native Method)
>                 at fp.platformInterface.EFoo.Initialize(Compiled Code)
>                 at fp.platformInterface.EFoo.<init>(Compiled Code)
>                 at fp.app.MaintApp.main(Compiled Code)
> 
> This tells me that the dynamic lib was loaded, but that it died in
> nInitialize(), a method of my JNI lib.  This is where I woul like to
> start debugging.
> 
> How do I set the breakpoint in the dynamic lib (loaded from EFoo's static
> initializer block)?   The problem I am suffering with is that the
> file to debug is the java executable.  I can set break points in java but I
> can't seem to get the dynamic library loaded so as to  set the
> breakpoint in the jni lib.  Trying gdb command
> 
> add-symbol-file ./lib/libEFoo.so
> 
> produces
> 
> "Don't know how to get text start location for this file" message.  I
> tried to load before "run" and after the "run" command (stopped
> on breakpoint in java's main) was executed.  Same result either way.
> I have also tried "add-shared-symbol-file" gdb command but
> the answer back from gdb is that this command is not supported.
> 
> Using ddd's "open program" menu item allows me to load the
> jni lib so I can see the symbols and set a break point
> but changes the target to the lib.
> 
> Could anyone help guide this tired newbie through this
> sticking point?   Or am I missing the big picture and this is
> not my problem?  Any help would be much appreciated.
> 
> Thanks for reading this far,
> 
> Rich Johnson
> 
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to