| Using the Microsoft Script Debugger with the Microsoft VM |
Previous |
About Tools |
This article explains how to get started using the Microsoft Script Debugger to debug Java code using the Microsoft VM for Java. For information on using the Microsoft Script Debugger in general, see the help that comes with the Microsoft Script Debugger. You can also find more information by visiting the script debugger Web site at http://www.microsoft.com/workshop/prog/scriptie .
To use the Microsoft Script Debugger to debug Java applets, you must perform the following steps:
This installs the Script Debugger and the files required to enable and disable Java debugging in Microsoft&tg; Internet Explorer and Jview.
This ActiveX debugger implementation runs in a special mode of the Microsoft VM that must be enabled at startup. You can enable that mode by running SetDebug.exe, as described in the next section. ActiveX debugging enables the ActiveX debugger under both Internet Explorer and Jview.
The ActiveX debugging mode of the Microsoft VM is enabled by the following registry key: HKEY_LOCAL_MACHINE\Software\Microsoft\Java VM\ActiveXDebug.
This mode of the Microsoft VM has two side effects that reduce the performance of the Microsoft VM:
To improve normal performance, you may wish to only enable the ActiveX debugging mode in the Microsoft VM while debugging Java classes.
A utility application called SetDebug.exe is provided to enable and disable the ActiveX debugging mode of the Microsoft VM, and to add and remove path elements from the source path. SetDebug is installed in the Windows directory.
Invoking SetDebug without any arguments displays a dialog box that allows you to enable or disable the ActiveX debugging mode of the Microsoft VM. It creates or deletes the ActiveXDebug registry key.
Typing "SetDebug -?" displays a description of the SetDebug command-line options:
Usage:
-d Disable ActiveX debugging for Java.
-e Enable ActiveX debugging for Java.
-p <path> Append <path> to the Java source path.
-r <path> Remove <path> from the Java source path.
For example, typing "SetDebug -p c:\Sources" appends the path c:\Sources to the source path. Typing "SetDebug -r c:\Sources" removes it.
Source code for most of the Java system classes is included in this release.
The Microsoft VM can read the Java source code from the Classes.zip file just like it reads the Java classes from that file. You don't need to unzip the Classes.zip file unless you want to view the source code of the system classes outside the debugger.
The Microsoft VM searches for the source code for Java classes similar to the way that it searches for class files. The Microsoft VM searches for a source file by searching the source path, and then the class path. Source code for a class must be located in the same package as the class. This does not necessarily mean the same container, however. For example, if you your class path is set to include the c:\Classes directory and your source path set to include the c:\Sources directory, the Microsoft VM could find the tree.Util class as c:\Classes\Tree\Util.class and the tree.Util source code in c:\Sources\Tree\Util.java.
The Microsoft VM reads the source path from the SourcePath string value of the HKEY_LOCAL_MACHINE\Software\Microsoft\Java VM registry key. The Microsoft VM reads the class path from the ClassPath string value of the same key. The source path value can be manipulated using SetDebug with the -p or -r command-line options. ). . . . -->
The debugger comes up with the Java class tree view fully expanded. You can expand or collapse package views by clicking the plus/minus sign (+/-) to the left of a package name.
The debugger can still break and step in methods for which it does not have source code. For example, when you invoke Break at Next from the Edit menu in Internet Explorer, the debugger breaks in the class, but no source code or bytecode disassembly is displayed. If you can't tell where you are, look at the Call Stack window.
From the debugger, it can be difficult to tell whether the applet being debugged is in a running state or in a break state. To help determine this, look at the Call Stack window, which will display "<Running>" while the applet being debugged is executing, and a call stack when the applet is stopped in the debugger. Also, the toolbar execution buttons are unavailable while the applet is executing, and available when the applet is stopped in the debugger.
The JAutoExp.dat file that is installed in the Windows directory allows you to customize the way Java classes are displayed in the Immediate window. See that file for details.
You cannot evaluate expressions that include Java methods in the Immediate window.
You might encounter bugs when attempting to display or set the value of a Java variable in the Immediate window.
The Thread List window, which is in the debugger, may get out of sync with the threads executing in the Microsoft VM.
The preceding issues will be addressed in future releases of the Microsoft
VM.
| © 1997 Microsoft Corporation. All rights reserved. Terms of Use. |