Microsoft SDK for Java

Enabling Debugging with Environment Variables

The preferred method for enabling debugging is to set special environment variables before starting the Microsoft VM (before launching Microsoft® Internet Explorer, for example), and then executing the Java code to be debugged. Note that the value of an environment variable (when set) overrides the equivalent registry setting. The environment variables that may be used by a debugger are shown in the following table.

Debugger Environment Variables

Environment variable Description and value
MSJAVA_DEBUGGING_FLAGS Specifies options for debugging. Most modern debuggers would set all the bits from MSJDBG_DEBUGGER_NATIVE_METHODS on up.
MSJAVA_ENABLE_DEBUGGING Enables debugging when set to some value other than 0 (zero).
MSJAVA_ENABLE_FI Enables the fast interpreter when set to some value other than 0 (zero). If this environment variable is not set and the equivalent registry value is not set, the fast interpreter is enabled by default.
MSJAVA_ENABLE_JIT Enables the Just-In-Time (JIT) compiler when set to some value other than 0 (zero). If this environment variable is not set and the equivalent registry value is not set, the JIT compiler is enabled by default.

If the MSJAVA_ENABLE_DEBUGGING variable exists in the Win32 environment space and is set to some value other than 0 (zero), debugging is enabled in any Microsoft VM that subsequently begins executing within this process.

Java Debugger Flags

If the MSJAVA_DEBUGGING_FLAGS variable exists in the Win32 environment space, its value specifies a bitmask of flags that control special features of the Microsoft VM. It can be any combination of the flags in the following table.

MSJDBG_FL_REQUIRE_BYTE_CODE_EXECUTION

Disables the JIT compiler so that bytecode execution may be profiled.

0x01
MSJDBG_FL_ENABLE_PROFILING

Enables profiling.

0x02
MSJDBG_NO_HARDWARE_BREAKPOINTS

Notifies the Microsoft VM that hardware breakpoints should not be used on Microsoft® Windows NT® being run on Intel processors. If this value and the following value are set, data breakpoints are not available. When using a native debugger, such as Microsoft® Visual C++®, this value may need to be set to allow the native debugger to function properly. This option is ignored on Compaq DIGITAL Alpha systems running Windows NT. Hardware breakpoints are not used on Microsoft® Windows® 95.

0x04
MSJDBG_NO_PAGE_BREAKPOINTS

Notifies the Microsoft VM that memory page faults for data breakpoints should not be used (applies to both Windows 95 and Windows NT being run on Intel processors). If this value and the previous value are set, data breakpoints are not available. When using a native debugger, such as Microsoft® Visual C++®, this value may need to be set to allow the native debugger to function properly. This option is ignored on Compaq DIGITAL Alpha systems running Windows NT.

0x08
MSJDBG_DISABLE_JIT_COMPILED_CODE_DEBUGGING

Notifies the Microsoft VM that JIT-compiled code debugging is disabled.

0x10
MSJDBG_DEBUG_NATIVE_METHODS

Notifies the Microsoft VM that it should return native, COM, and delegate stack frames in call stacks, and allow stepping into these frames.

0x20
MSJDBG_SEND_START_CLASS_EVENTS

Notifies the Microsoft VM that it should send StartClassEvents when a Java application, applet, or COM object is loaded by the Microsoft VM.

0x40
MSJDBG_SEND_CAN_STOP_EVENT_ON_STEP_OUT

Notifies the Microsoft VM that it should send a CanStopEvent on leaving the stepping frame. Otherwise, a StepEvent will be sent.

0x80
MSJDBG_EXCEPTIONS_REQUIRE_EXPLICIT_CATCHER

Allows last-chance exceptions to be discovered earlier.

0x100
MSJDBG_IGNORE_METHODS_WITHOUT_DEBUG_INFO

Notifies the Microsoft VM that it should ignore Java methods without source line mapping information while stepping.

0x200
MSJDBG_STEP_AT_THREAD_REENTRY

Notifies the Microsoft VM that it should, when stepping out of a topmost Java stack frame, send a CanStopEvent or StepEvent on entry to the next debuggable stack frame. The default behavior is to stop stepping when exiting a topmost stack frame.

0x400
MSJDBG_CREATE_NULL_OBJECTS

Notifies the Microsoft VM that it should never return E_NULLOBJECTREF from GetFieldObject. Instead, return an IRemoteObject representing the null object reference. This is necessary to enable a debugger to set data breakpoints on object references that are currently null.

0x800
MSJDBG_STRICT_TYPE_CHECKS

Notifies the Microsoft VM that it should never return an interface that may be used in a type-unsafe way. The default behavior is to allow QueryInterface to succeed for any IRemoteXXXXObject on any primitive data location. For example, setting this flag prevents the debugger from reading an integer location as a double.

0x1000
MSJDBG_REGULAR_DEBUG_STRING_EVENT

Notifies the Microsoft VM that it should disable compatibility modes for DebugStringEvent.

Implement DebugStringEvent as follows:

  • Sensibly interpret control characters in the string. The Microsoft VM automatically converts isolated \r and \n characters to \r\n pairs.

  • Convert, if necessary, and display the Unicode characters in the string appropriately.

  • Display the string in a timely manner. A debugger should not wait until a \r\n to display the output.

  • Permit multiple lines in the string.

  • Permit empty strings (blank lines).
0x2000
MSJDBG_STACK_FRAME_IDENTITY

Turns on identity for the frame returned from IRemoteThread::GetCurrentFrame. Without this flag, a new IRemoteStackFrame is provided after execution has possibly occurred, and the old one will become invalid.

0x4000

© 1999 Microsoft Corporation. All rights reserved. Terms of use.