Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Click2Debug on Simulator and device - Visual Studio

Setting break points in Visual Studio

To debug native code using Visual Studio, the debug mode in Visual Studio must be set to Native Only. This applies to both project files generated by the Brew MP Wizard and Brew MP sample applications.

Note: Confirm that debug information is turned on in Visual Studio. Click Project > Properties or Project > Application1 Properties.

  1. To set breakpoints in Visual Studio, left-click in the shaded margin on the left in Visual Studio. A red dot will appear at the location you clicked at, setting a breakpoint at that location.

  2. To remove the breakpoint, right-click on the red dot, and select Delete Breakpoint.

Click2Debug on a simulation target

This section covers setting specific breakpoints in the application to demonstrate Click2Debug. Control returns to Visual Studio when the Simulator fails or when execution reaches the line of code containing the breakpoint if breakpoints were specified. Visual Studio indicates which line of code is responsible for the failure, facilitating debugging memory access and non-failing code logic issues.

  1. Set code breakpoints in the application1_HandleEvent function for EVT_APP_SUSPEND and EVT_APP_RESUME.
  2. Within the Plugin toolbar, select Brew MP Simulation Target from the Target Type drop-down menu, and select the desired target from the Brew MP Target drop-down menu.

  3. Select the debug icon within the Visual Studio toolbar.

    The application is launched on the Simulator.

  4. Press the suspend key on the simulation target (the home icon on the Sapphire target).

    Visual Studio stops at the breakpoint for EVT_APP_SUSPEND. Press F5 in Visual Studio to continue debugging.  

  5. On the Simulation target, press resume (the select button). Visual Studio stops at the breakpoint for EVT_APP_RESUME.

    Once the breakpoint is reached, use Visual Studio's debugging tools to inspect relevant variables and function call parameters. Review your code to diagnose the causes of your program's undesired behavior. 

  6. Press F5 in Visual Studio to continue debugging.
  7. Press shift+F5 to stop debugging in Visual Studio.

Click2Debug on a physical device

The Brew MP Debugger provides a software debug monitor that runs on the physical device in conjunction with the Brew MP application being debugged, and control its execution with the help of third party PC debuggers. For the following steps, use breakpoints in the same manner as the steps described above.

  1. Within the Plugin toolbar, select Brew MP Physical Target from the Target Type drop-down menu, and select the device ID from the Brew MP Target drop-down menu.

  2. Select the debug icon within the Visual Studio toolbar.

    The application and the CDB module are loaded to the device file system, and launched on the device.

For more information on using the Brew MP Debugger, see the Tools Reference.