Stack traces and deadlocks
I'm running phoneME advanced b167 on linux-x86. Occasionally our application code deadlocks, and while we have code to print out names of all active threads, what we really would like to do is dump stack traces (we often find the problems through code review, but having stack traces would quickly narrow it down). I don't think I can use gdb as the network link to them is slow and unreliable.
In cdc/src/share/javavm/runtime/utils.c there is CVMdumpAllThreads which looks like it does exactly what I want. However it's not declared in utils.h, so I'm unsure if it would be "safe enough" for outside code to call? The only time I need to dump all thread stack traces is when there is a deadlock somewhere - where the system is already in a badly behaving state so any problems CVMdumpAllThreads may cause wouldn't be the end of the world.
Is using CVMdumpAllThreads the best approach? The app has a CLI that runs in a separate thread from the core functionality, so was planning on providing the ability to dump threads using that. I presume I would need to write a JNI method to invoke it, unless someone knows a way currently to invoke it within a Java app?
Ideally I would prefer the Java SE way with kill -QUIT generating stack traces. Any reason why I couldn't change the SIGQUIT handling code to invoke CVMdumpAllThreads when CVM_DEBUG is enabled?
Any other alternatives that I should be considering?