JIT Debugging Setup

To use JIT debugging, you must configure your platform to support KITL services, and then package the correct debugging libraries into the OS kernel. You must also enable debugger support in the kernel. You can use one of the following methods to enable debugger support:

  • Include the static library file KdStub in the kernel at build time. In the MODULES section of the Project.bib file, include Kd.dll. For more information about the MODULES section, see MODULES Section.
  • Dynamically load KdStub. In the FILES section of the Project.bib file, include Kd.dll so that you can dynamically load KdStub later. For more information about the FILES section, see FILES Section.

Typically, you include KdStub in the kernel at build time for a debug version of an OS, often during the early stages of platform development. During the final phase of platform development, when working with a release build, you dynamically load KdStub to provide JIT debugging.

If you include Kd.dll in the MODULES section, JIT debugging is automatically enabled if a second chance exception or a debug break occurs on the target device. If Kd.dll is in the FILES section, JIT debugging does not start until you run Loaddbg.exe to load Kd.dll dynamically.

When JIT debugging is not enabled, exceptions are not handled appropriately and unhandled second-chance exceptions cause the application to terminate.

To use the debugger for JIT debugging, you must allow Platform Builder to connect to the target device, because when the debugger activates, it requires a connection for the debug output. From the Target menu, choose Configure Remote Connection, choose the Settings tab, verify that the Connect to Device check box is selected, and then choose OK.

The final release of an OS should not contain the debug libraries. Removal of the debug libraries ensures that the proper response to a second-chance exception occurs: the application terminates but the OS continues to function.

By loading KdStub, you use the kernel debugger in Platform Builder for JIT debugging. As an alternative, you can use a device-side JIT debugger. To use a device-side JIT debugger, include a JIT debugger such as UsrExceptDmp.exe in the MODULES section of the Project.bib file. In the HKEY_LOCAL_MACHINE\Debug registry key on the target device, register the JIT debugger by adding the name of the debugger to a JITDebugger registry entry. Reset the target device after you add this value to the registry. If you use a device-side JIT debugger, when there is a second chance exception or a debug break, the target device does not connect the Platform Builder kernel debugger but instead runs the JIT debugger included in the MODULES section.

See Also

Just-in-Time Debugging

 Last updated on Friday, October 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.