How to debug the device driver

Source: Internet
Author: User

Lead http://www.microsoft.com/china/MSDN/library/Mobility/embedded/HtoDbugDevcDrver/HtoDbugDevcDrver.mspx

With Platform Builder, You can debug the device driver at any time during driver development. Driver debugging is part of a larger process of developing drivers for Windows CE. For more information about driver development, see how to create a device driver.

Platform Builder provides tools for debugging drivers, such as kernel debugger and extended debugging interface (eXDI) Hardware-assisted debugging.

NoteThe driver is reentrant. During the debugging process, any thread that opens the driver handle can send I/O requests at any time.

Hardware and software assumptions

The driver exposes the stream interface. For more information about the flow interface driver, see the flow interface driver development concept.

To track your progress in the following table, select the check boxes corresponding to each step.

Procedure Topic

1. If applicable, set a breakpoint in the DllMain or driver's DLLENTRY entry point.

You may need to restart the target device and load the driver to confirm that the driver is running to the breakpoint.

Set a breakpoint in the source code line

2. If you want to verify that the driver is correctly loaded, run the debugger until the preset breakpoint is reached.

If the debugger does not stop at the breakpoint, the driver is not loaded correctly. For more information about how to attach a driver, see load a driver.

Run the debugger until the breakpoint is reached.

3. Set the breakpoint at the XXX_Init (Device Manager) entry point of the driver and initialize the driver one by one.

Set a breakpoint in the source code line

4. to verify that the driver has been correctly initialized, run the debugger again.

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

Run the debugger until the breakpoint is reached.

5. Set a breakpoint at the entry point of the stream interface function of the driver.

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

XXX_Close (Device Manager)

XXX_Deinit (Device Manager)

XXX_IOControl (Device Manager)

XXX_Open (Device Manager)

XXX_Read (Device Manager)

XXX_Seek (Device Manager)

XXX_Write (Device Manager)

Use the Device ManagerXXXPrefix.

When implementing the stream interface, replace it with the prefix that is appropriate for your specific implementation.XXXOr use the undecorated endpoint name with DEVFLAGS_NAKEDENTRIES.

For more information, see stream interface driver implementation.

Set a breakpoint in the source code line

6. to verify that the driver works properly when it reaches various breakpoints, run the debugger again.

For more information about troubleshooting the driver, see troubleshooting: debugging the driver.

By performing this step, you can learn how the application interacts with the driver.

Run the debugger until the breakpoint is reached.

7. to verify that the interrupt service thread (IST) works properly, set a breakpoint in the driver's IST and gradually pass through each interrupt one by one.

Set a breakpoint in the source code line

8. to verify that the driver's IST works properly, run the debugger again.

For more information about IST behaviors, see interrupt service threads.

If you can step through each breakpoint and the driver works properly, you have successfully debugged the driver.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.