Compartir a través de


How to Create and Debug a Debugger Extension (Windows Embedded CE 6.0)

1/5/2010

This topic describes how to create and debug a custom debugger extension.

A custom debugger extension enables you to automate common debugging operations for a run-time image. For example, you can create a debugger extension that debugs a particular module, service, or API.

Hardware and Software Assumptions

  • You are familiar with debugger extensions.
  • You have installed Windows Embedded CE 6.0 Platform Builder Service Pack 1.

Steps

Step Description

1. In Microsoft Visual Studio 2005, create a new DLL project named hello_ext.

Creating a Debugger Extension DLL Project

2. In stdafx.h, add an #include directive for both intsafe.h and wdbgexts_ce.h.

  1. In Solution Explorer, expand Header Files, and double-click stdafx.h.
  2. In stdafx.h, add #include directives for these header files, as follows:

    // TODO: reference additional headers your program requires here
    #include <intsafe.h>
    #include <wdbgexts_ce.h>

Not applicable

3. Implement the required functions that are required for the extension DLL to load correctly in Platform Builder.

  • In this step, you will also add the Hello command to your extension debugger DLL.

Implementing the Functions Required for a Debugger Extension DLL

4. Create a .def file that tells the linker which functions to export.

Exporting Commands from a Debugger Extension DLL

5. Build the extension DLL.

  • On the Build menu, choose Build Solution.

Not applicable

6. Build the OS design into a run-time image and download the run-time image to the target device.

  • Make sure that you choose a Debug configuration for the run-time image.

How to Connect to a Target Device for Debugging

7. Load the DLL in Platform Builder by completing the following steps:

  1. On the Debug menu, choose Windows CE Debugger Extensions.
  2. Browse to the folder that has the extension DLL that you built in step 5.
  3. Choose hello_ext.dll, and then choose Open.

Not applicable

8. At the command line, invoke the new commands from your loaded debugger extension by completing the following steps:

  1. To view a list of loaded extensions, at the command line, type the following:

    .listext
  2. To run the Hello command, at the command line, type the following:

    !Hello

Note   All debugger-extension commands must begin with "!". Debugger-extension commands are case-sensitive.

Not applicable

9. (Optional) Debug the new debugger extension.

Debugging a Debugger Extension DLL

See Also

Other Resources

Debugging and Testing How-to Topics
Debugger Extensions