Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Debugging JNI with MinGW & GDB
icon5.gif  Debugging JNI with MinGW & GDB [message #1219628] Thu, 05 December 2013 03:53 Go to next message
Michael Kron is currently offline Michael KronFriend
Messages: 2
Registered: August 2013
Junior Member
Hello,

I'm using Eclipse CDT on Windows 7, with MinGW as my toolchain and GDB as my debugger. For the most part I have been able to get everything working normally, including the development of Java, C/C++, and JNI applications.

However, I am unable to debug the native side of those JNI applications. The Java debugger works fine for Java code and GDB works fine for purely native code, but I cannot seem to get GDB to operate properly on code within a JNI .DLL.

I have searched the web for quite a while regarding this, and it sounds like the success people have had is by attaching to the running Java process after launching it from Eclipse. Then, setting a breakpoint and letting GDB hit it. Unfortunately, this does NOT seem to work for Windows users.

The only advice that seems to work ( which I can confirm ) is to launch the Java application in Eclipse, then attach to the process from Visual Studio. From there you can set breakpoints in the native code, and they will be hit. This approach is a pain in itself, but what really makes it awful is that you need to have compiled the .DLL from Visual Studio in order to generate the .PDB file for debugging symbols. Making the whole CDT somewhat extraneous at that point.

I'd much prefer to stay within Eclipse, but only if I can actually debug with it. Can anybody out there confirm if it's possible to debug JNI code with Eclipse CDT from Windows?
Re: Debugging JNI with MinGW & GDB [message #1219968 is a reply to message #1219628] Sat, 07 December 2013 16:01 Go to previous message
Michael Kron is currently offline Michael KronFriend
Messages: 2
Registered: August 2013
Junior Member
After a bunch more digging, I have confirmed this is definitely possible with the current ( Kepler ) build of Eclipse and MinGW.

That seemed to be my problem actually; the version of GDB I had wasn't able to attach to any process at all ( which I verified from the command line ). After updating to the current version of MinGW with a new gdb.exe, I could attach properly and view all the threads. Getting breakpoints to hit took a bit more work ( I was missing -g from the gcc compile ), but after that all seems fine.
Previous Topic:Multi-Line RegEx Error Parser
Next Topic:CDT MinGW Include Problem
Goto Forum:
  


Current Time: Fri Apr 19 10:57:36 GMT 2024

Powered by FUDForum. Page generated in 0.02112 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top