Share via


How to Debug a Device Driver

Using Platform Builder, you can debug your device driver at any point in the driver development process. Debugging your driver is part of the larger process of developing a driver for use with Windows CE. For more information about developing a driver, see How to Create a Device Driver. Platform Builder provides you with tools, such as the kernel debugger and Extended Debugging Interface (eXDI) hardware-assisted debugging, to debug your driver.

Note   Drivers are re-entrant. During the debugging process, any thread that opens a handle to the driver can issue an I/O request at any time.

Hardware and Software Assumptions

  • Your driver exposes the stream interface. For more information about stream interface drivers, see Stream Interface Drivers.

To track your progress in the following table, select the check box next to each step.

  Step Topic
1. If applicable, set a breakpoint in the DllMain or DLLENTRY entry point of your driver.

You may need to reboot your platform and load your driver to confirm that the driver executes to the breakpoint.

Setting a Breakpoint at a Source Code Line
2. If you want to verify that the driver loads correctly, run the debugger until you reach the breakpoint you set.

If the debugger does not stop at the breakpoint, your driver did not load correctly. For information about troubleshooting loading your driver, see Troubleshooting: Loading a Driver.

Running the Debugger Until a Breakpoint is Reached
3. Set a breakpoint in the XXX_Init entry point for your driver and step through the initialization of your driver. Setting a Breakpoint at a Source Code Line
4. To verify that you have initialized your driver properly, run the debugger again.

By performing this step you can confirm that the Device Manager recognizes the driver and that the initialization process is functioning properly.

Running the Debugger Until a Breakpoint is Reached
5. Set a breakpoint on the entry points of the stream interface functions for your driver.

The following list shows the stream interface functions that your driver can implement:

The Device Manager uses the XXX prefix. When implementing the stream interface, replace XXX with a prefix appropriate for your specific implementation or use undecorated entry point names in conjunction with DEVFLAGS_NAKEDENTRIES. For more information, see Stream Interface Driver Implementation.

Setting a Breakpoint at a Source Code Line
6. To verify that your driver is functioning properly as it reaches various breakpoints, run the debugger again.

For more information about troubleshooting your driver, see Troubleshooting: Debugging a Driver.

By performing this step, you can see how applications interact with your driver.

Running the Debugger Until a Breakpoint is Reached
7. To verify that the interrupt service thread (IST) is functioning properly, set breakpoints in the IST of your driver and step through each interrupt one by one. Setting a Breakpoint at a Source Code Line
8. To verify that the IST of your driver is functioning properly, run the debugger again.

For more information about the behavior of the IST, see Interrupt Service Threads.

If you can step through each of your breakpoints and your driver is functioning properly, you have successfully debugged your driver.

Running the Debugger Until a Breakpoint is Reached

See Also

Driver Debugging | Troubleshooting a Device Driver | Troubleshooting: Debugging a Driver | Driver Development | Driver Development Overview | Breakpoint Setting | How to Add Power Management to a Device Driver | How to Create a Device Driver

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.