Debugging JNI shared libraries

From: Dave Neary (real.addressinthesig_at_thisoneis.invalid)
Date: 10/07/03


Date: 07 Oct 2003 09:49:44 GMT

Hi all,

I have been trying to get some JNI code working on Win32 (the code is
libxmlj from the classpathx project). Compiles fine on Linux, and
compiles OK on Win32 when I have teh requisite stuff installed and I'm
using mingw, and I make a few changes (I really should learn how to use
Visual Studio).

I load my DLL/so via System.loadLibrary, and on Linux things go off
without a hitch. On Win32, I get an access violation, attempt to
reference object at address 0x00000... - looks like a null pointer
dereference to me. So I compiled the Linux .so with efence (hoping to
provoke a core dump in an environment that I know pretty well, and
diagnose the problem), but I have not been able to replicate the problem
at all.

Which brings me to my question. How can I debug this kind of thing on
Win32? Is there a way to load a DLL in a debugger, and (say) when
DllMain gets called, attach to the dll? How can I go about localising
the problem? The best option available to me at the moment seems to be a
bunch of printfs, which will perhaps help localise things. It would be
nice to get a core dump/stack trace though.

So - any Win32 people with good debugging tips for debugging shared
objects?

Thanks for your help,
Cheers,
Dave.

-- 
                David Neary,
        E-Mail: bolsh at gimp dot org
   Work e-mail: d dot neary at phenix dot fr
CV: http://www.redbrick.dcu.ie/~bolsh/CV/CV.html


Relevant Pages

  • Re: Debugging JNI shared libraries
    ... >compiles OK on Win32 when I have teh requisite stuff installed and I'm ... >DllMain gets called, attach to the dll? ... code as far as the debugger is concerned). ...
    (comp.programming)
  • Re: Linux / Windows GUI application with assembly
    ... before Applications could have been written in Asm, ... under Win32, and the Linux Asm Stuff is still in the ... There is still some assemblers which compile successfully binaries ... under Linux, and I thought someone had already investigated the GUI ...
    (alt.lang.asm)
  • Re: The Delphi Survey
    ... and Linux, but not for win32 and .NET. ... capacity and bigger gain for code compatibility with Linux than there is ... It's also different because .NET, without Mono support, is a Windows ...
    (borland.public.delphi.non-technical)
  • Re: Will there ever be a new Delphi for Win32?
    ... some .NET projects run on Mono directly. ... Calvert's article on running .NET WinForms code on Mono and Linux. ... No. CLX is only supported on Win32 and Linux. ... Yorai Aminov (TeamB) ...
    (borland.public.delphi.non-technical)
  • Re: findfirst, findnext and finddata_t
    ... |> I'm porting a Win32 application to linux. ... The Win32 API appears, based on the little bit posted in this thread, to ... tree walk) and each subsequent item. ... The ftw "package" does not appear ...
    (comp.os.linux.development.system)