## Metagnostic home
| # JNIPort for Dolphin Smalltalk
Overview Contents Players Layers Examples Configuration InFAQ Changes Licence Back to Goodies | # The Status Monitor's JVM Debug Page The Status Page is a plug-in page for the Status Monitor. It displays a trace of the debugging output from the Java runtime. In a Java program launched by the `java.exe` program, this stream goes to the console along with the Java console streams (but it is a separate stream and is handled differently). The `java.exe` program has several options that turn on debugging output from different subsystems of the Java runtime. Standard options such as `-verbose:gc`, or `-verbose:class`, and less standard options like `-Xcheck:jni` for SUN JMVs, enable the corresponding logging. The same debugging options can also be used with JNIPort; they are just added to the list in the 'runtimeSettings' (see Configuration). When Java is running from Dolphin there is no console, so the logging would be lost. However JNI provides a way of reading the debug stream. If JNIPort has been configured to do so, then this debugging output is captured, and — if the JVM Debug page is open — displayed. JNIPort will capture the output if 'useVFPrintfHook' is set in the 'jniPortSettings'. Please note the following warning: much of the runtime's debugging output is produced by operating-system threads other than the one where Dolphin executes Smalltalk code. If no precautions are taken then this is very likely to lead to deadlocks. See the problem with threads for more discussion of this point. The first precaution is that you should be using the JNI Helper library. This interposes a queue between the thread issuing the debugging data, and Dolphin, so that the sending thread does not need to wait for Dolphin to consume the data. This should avoid the problem, and I have found that, with the JNI Helper, I can use the JVM Debug page without encountering deadlocks. But, of course, that may just be luck (for instance I rarely run JNIPort with `-verbose:gc`). If you need to see the debug output, but are still getting deadlocks despite using JNI Helper (or just can't risk ever hitting a deadlock), then you can use an additional feature of JNIPort/JNI Helper. The configuration setting 'jniPortSettings/useVFPrintfRedirection' tells JNIPort to divert the debugging information directly to the Windows debug stream without ever involving Dolphin. (Note that 'jniPortSettings/useVFPrintfHook' still has to be set, or JNIPort won't install a handler at all.) The useful (and free) tool, DebugView, from http://www.sysinternals.com/ can be used to trace the output. Another reason to use the 'useVFPrintfRedirection' flag is if you have some Java problem that is crashing Dolphin — in which case you wouldn't get the chance to read any error messages in the debug page. If the debugging output is not being captured by JNIPort, or it is being redirected to the Windows debug stream, then the JVM Debug page will not work, and will just display a warning message.

Copyright © Chris Uppal, 2003-2005

Java, JNI (probably), JVM (possibly), and God knows what else, are trademarks of Sun Microsystems, Inc.