This sample is located in \Samples\Debugger.
Note To use this sample, it is recommended that you have Microsoft® Visual C++® version 5.0 or higher installed.
Description
Using the Sample
Key Project Files
Technologies Demonstrated
This sample shows how to use the debugging interface exposed by the Microsoft virtual machine (Microsoft VM). It contains examples of creating a C++ debugger, tracing a method call, and implementing a Java debugger.
The functional areas of this sample are shown in the following table.
C++ debugger | Source files for Microsoft® Win32® C++ debugger sample console application, JDebug.exe. |
Hello | Simple "Hello, world" sample Java debuggee applet. |
Java debugger | Source files for Java debugger sample application JavaDebugger.class. |
CallTrace | Source files for Win32 C++ debugger sample console application, Calltrace.exe, that displays call information from a Java method call. The batch file in this directory will trace calls in the "Hello, world" Java application. |
Java debugging functionality for data breakpoints has been defined, but is not yet implemented. This includes IRemoteObject::SetBreakpoint(), ClearBreakpoint() and SetBreakpoint() of all interfaces derived from IRemoteObject, such as:
Subsequent releases of the Microsoft VM may implement these features.
To compile the sample
Run nmake to compile all the code in the \Samples\Debugger\ directories. Type the following command:
Nmake
To install the sample
The registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Java VM\Debug must exist to enable debugging under the Microsoft VM. The debugger samples create this key themselves to enable debugging. You can also create this key programmatically. Note that you will probably not want to run with this key except when debugging because it disables the JIT compiler and invokes a slower than normal version of the bytecode interpreter loop. Delete the key using Regedit.exe.
To run the sample
Run the Jdebug.bat file in the \Samples\Debugger\C++ debugger directory. This starts a process that runs the "Hello, world" Java application and displays message boxes containing information about what is being debugged.
Run the Calltrace.bat file in the \Samples\Debugger\calltrace directory. This starts the "Hello, world" Java application and displays information about the method calls occurring in the Microsoft VM.
Run the JDebug.bat file in the \Samples\Debugger\java debugger directory. This starts the Java Debugger, which displays debug information about the Hello Java application.
\Samples\Debugger directory
This directory contains Java debugger sample code, including:
JavaDbgg.idl | IDL description of the debugger interfaces. |
\Samples\Debugger\C++ debugger directory
This directory contains source files for Win32 C++ debugger sample console application Jdebug.exe, including:
JDebug.bat | Runs the C++ debugger sample on the "Hello, world" applet. |
JDebug.cpp | The C++ debugger sample. |
JDebug.rc | Microsoft® Developer Studio® resource file. |
Project.hpp | Common project header file. |
RefCount.hpp | Simple COM reference counting class. |
Resource.h | Microsoft Developer Studio resource header file. |
\Samples\Debugger\C++ debugger\Release directory
This directory contains built release C++ debugger sample binaries, including:
Jdebug.exe | Release Win32 C++ debugger sample console application. |
\Samples\Debugger\hello directory
This directory contains simple "Hello, world" sample Java debuggee applet, including:
Hello.bat | Runs "Hello, world" with Jview.exe. |
Hello.java | "Hello, world" Java source file. |
\Samples\Debugger\java debugger directory
This directory contains source files for the Java debugger sample application JavaDebugger.class, including:
JavaDebugger.java | Java source file for Java debugger. |
DebuggeeProcess.java | Java source file for DebuggeeProcess class. |
JDebug.bat | Runs the Java debugger sample on the "Hello, world" applet. |
JDbgHlpr.dll | Java debugger helper classes' native method implementations. |
\Samples\Debugger\java debugger\com\ms\debug directory
This directory contains Java debugger interface and helper .class files.
This sample shows: