Debug your app
Right-click on your project in the Project Explorer view and select Debug As.Select one of the following:
- BlackBerry C/C++ Application — Debug using an existing debug configuration for the selected project.
- BlackBerry C/C++ Application Dialog — Open the Launch Configuration selection dialog from where you select a project, and then it opens the Debug configuration dialog to create, manage, and run your configurations.
- Debug Configurations — Open the Debug Configurations dialog. From this dialog, you can create, manage, and run your configurations.
In the Debug launch configuration dialog, select or create a BlackBerry launch configuration created for launching your BlackBerry C/C++ Application.
- BlackBerry Attach To Running Process — For more information about attaching to a running process, see Debug by attaching to a process.
- BlackBerry C/C++ Application — For more information about debugging your BlackBerry 10 OS application, see Use the debugger.
- BlackBerry Postmortem Debugging — For more information about postmortem debugging, see Postmortem debugging.
- BlackBerry Attach to Running Process — If you're connecting to your target by IP, select this configuration to connect to a remote process that is already running. This option lets you use the Application Profiler tool for profiling. Your target must be running qconn .
- Launch Group — For more information about using launch groups, see Launch Group type.
At a minimum, on the Main tab, select the build configuration you intend to use for debugging your application.If the Debug button is not available, ensure that you have a project specified and that your build configuration you selected is valid for the selected project, and that it is connected.
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.
If you're using the Application Developer or System Developer profiles, you won't be able to debug the BlackBerry 10 OS or other processes:
- For external debugging, you can't debug BlackBerry and QNX processes, or debug the OS kernel.
- You'll have access to only those processes of the third-party performing the debug tasks (authenticated access at the developer level).
- To enable debugging, your user authentication is required on the device.
- You can't run an unsigned process in the core OS/kernel, or replace signed BlackBerry processes.
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. This allows you to access the program while it's stopped (for example, you can 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.
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.
Last modified: 2013-10-30