Debug the Application (Compact 7)

3/12/2014

In the previous task, you ran your application. In this task, you set a breakpoint in your application and then run the debugger so that it stops at the breakpoint. When you debug an application in Platform Builder, you use the standard Visual Studio debugging commands (F11 to step into, F10 to step over, and so on).

To debug an application

  1. If the Hello World application is running on your vCEPC, click the close (X) button on the Getting Started window to exit the program.

  2. In Platform Builder, in your subproject, double-click HelloWorld.cpp to display the code.

  3. In HelloWorld.cpp, in function WndProc, put your cursor anywhere in the line that reads GetClientRect(hWnd, &rt);

  4. Press F9 to insert a breakpoint. The breakpoint appears as a hollow circle with a yellow caution triangle, as shown in the following figure. Your breakpoints only become solid red when the application is running on your device.

    GetStartedWEC7-DevGuide-BreakpointsNotInstantiated

  5. Also insert a breakpoint at line EndPaint(hWnd, &ps);.

  6. In Platform Builder, click Target, and then click Run Programs.

  7. In the Run Program dialog box, under Available Programs, click HelloWorld.exe, and then click Run. The Hello World application window appears on the vCEPC, and in Platform Builder, the application is stopped at line GetClientRect(hWnd, &rt);. Note that the breakpoints are now red, as shown in the following figure.

    GetStartedWEC7-DevGuide-BreakpointsInstantiated

  8. Press F5 to stop at the second breakpoint.

  9. Press F5 to resume execution of the application.

For information about how to use the debugger, see Debugging.

See Also

Concepts

Getting Started