Debug a project

The IDE includes a debugger to allow you to debug your application.

To start the debugger:
  1. Right-click on a binary in Project Explorer and select Debug As > BlackBerry Tablet OS C/C++ Application Dialog (or Debug As > BlackBerry Tablet OS C/C++ Application if one was created previously).
  2. In the Debug launch configuration dialog, select a BlackBerry Tablet OS configuration created for launching your BlackBerry PlayBook tablet program.
  3. Click Debug to start the debugger.
    The IDE now switches to the Debug perspective and transfers your program from your development machine across the network to your simulator or device, and then starts it under the control of the debugger. You will see that the debugger stops in the first line of your program. In the Debug view, you'll see an overview of your process, including the call stack. Using the buttons in the main bar of the Debug view, you can control the debugger.

Using the Step Over button, you can jump to the next line of code.

During debugging, you can watch the Variables view on the right, which displays how your variables change. You can use the Step Into button to let the debugger go into the code of a function (which, of course, is useful only if you have the source code for this function).

To set a breakpoint, place the mouse pointer over the left border of the source display, press the right mouse button and choose Toggle Breakpoint from the context menu. The breakpoint is shown as a little circle, which you can also set or remove while you write your code.

When a running program hits a breakpoint, it stops in the debugger, and you can, for example, examine your variables. If you click the Resume button, your program continues until it hits the next breakpoint. To abort program execution, use the Terminate button. After the program has finished running, you can use the Remove All Terminated Launches button to clear all terminated launches from the Debug view.

The debugger keeps the project's files open while the program is running. Be sure to terminate the debug session before you try to rebuild your project, or else the build will fail.

To run your program as a standalone binary (without the debugger), open the dropdown menu beside the Run icon and choose Run Configurations:

Then you can use the launch configuration (described in the previous step) to start your program. Or create a new launch configuration and select the binary without debug information.