views:

664

answers:

3

Has anybody here succeeded in running Eclipse under Valgrind? I'm battling a particularly hairy crash involving JNI code, and was hoping that Valgrind perhaps could (again) prove its excellence, but when I run Eclipse under Valgrind, the JVM terminates with an error message about not being able to create the initial object heap (I currently don't have access to the exact error message; I'll edit this post as soon as I do.)

+1  A: 

Does it work if you run valgrind with --smc-check=all?

Also -- valgrind increases a program's memory requirements pretty dramatically. With something as large as Eclipse, there's plenty of room for trouble; hopefully you're 64-bit native (and thus have plenty of address space) and have lots of RAM and/or swap.

Charles Duffy
A: 

What about using two debugger ? I found this rather old article that expose this technique.

PW
Well, I've tried that (http://thisisnotaprogrammersblog.blogspot.com/2008/04/debugging-jni-code-using-eclipse-and.html), but it doesn't work in this case. The crash appears when the JVM is about to spawn a new thread (inside pthreads), and I don't know how to track what's going wrong.
JesperE
They say that visualvm can do postmortem analysis. I did not try it, but perhaps a thing to try (jdk6_7) https://visualvm.dev.java.net/features.html, serach thread dumps and core dumps
PW
+1  A: 

If there is a crash in native code, then gdb might be a better choice. It should even stop the execution automatically on a crash and might show You the stack trace (command bt).

Black
I've tried that already. I found out that the crash occurs when a new thread is created, but before control has been passed to the JVM, i.e. the crash occurs somewhere inside glibc or pthreads.
JesperE