Tutorial Step 4: Debugging the OS on the Emulator Using the Kernel Debugger (Windows CE 5.0)

Windows CE 5.0
Send Feedback

After you download and boot the run-time image in the Emulator, you can debug the OS.

By default, when the OS boots, Platform Builder starts the kernel debugger and displays the Debug toolbar.

To debug the run-time image, you must halt the running OS, because breakpoints cannot be set while the OS is running. You then use the kernel debugger to debug your custom OS.

To debug the OS on the Emulator using the kernel debugger

  1. From the Platform Builder Debug menu, choose Break.

    This halts the running OS on the Emulator, which does not respond to user input while in this state.

  2. From the File menu, choose Open.
  3. Browse to %_WINCEROOT%\Platform\Emulator\Src\Drivers\Kbdmouse\Emulkbms, select ps2mouse.cpp, and then choose Open.

    You have opened the Ps2mouse.cpp file, which contains source code for the mouse driver.

  4. From the Edit menu, choose Find.
  5. In the Find what box, type _move and choose Find Next.

    You jump to a section of code in the Ps2mouse.cpp file that handles a mouse move event.

  6. Set a breakpoint in the source code at the mouse move event by pressing the F9 key.

    A red dot in the margin shows that the breakpoint has been set.

  7. From the Debug menu, choose Go.
  8. In the MyOSDesign - Emulator for Windows CE window, move the cursor over the window.

    The breakpoint activates.

  9. Switch to the Platform Builder window.

    A yellow instruction point or current instruction arrow on the breakpoint symbol appears in the source code.

  10. Remove the breakpoint you set by doing one of the following:
    • From the Debug toolbar, choose Breakpoints and then choose Clear All Breakpoints.
    • In the source code, right-click the line where you set the breakpoint; then from the context menu, choose Remove Breakpoint.
    • Use the ALT+9 keyboard shortcut to access the Breakpoint List window; then choose Clear All Breakpoints.
  11. From the Debug menu, choose Go.

    You have successfully halted the OS, set and activated a breakpoint in one of the drivers, and then removed the breakpoint.

    Follow the remaining steps to stop debugging the OS.

  12. From the Debug menu, choose Stop Debugging.

    A dialog box appears, asking whether you want to stop debugging now without disabling the target-side kernel debugger component KdStub.

  13. For the purposes of this tutorial, choose Yes.

    Control returns to the IDE.

  14. From the Target menu, choose Detach Device.
  15. Shut down the Emulator by accessing the window for the Emulator; then from the Emulator menu, choose Shut Down.

    The Emulator window closes.

After you finish debugging, you can localize your run-time image.

See Also

Tutorial Step 5: Localizing the Run-Time Image for the Emulator | Tutorial Step 3: Setting Up a Connection to the Emulator and Downloading the Run-Time Image | Tutorial: Building a Run-Time Image for the Emulator | Tutorials | Kernel Debugger

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.