Debugging a C/C++ app

When you debug your app using the toolbar in the Momentics IDE for BlackBerry, you select the Debug launch mode and a launch target to debug your app on. The Momentics IDE builds your app with the corresponding build configuration (either Device-Debug or Simulator-Debug) and then launches your app with the selected configuration. You don't need to build the app, configure the build configuration, or configure the launch configuration, because the Momentics IDE completes these tasks for you.

The debugging controls appear in the Debug view toolbar, the right-click context menu, and the Run menu. To debug your app:

  1. On the toolbar, in the Launch configuration drop-down list, click a launch configuration.
  2. In the Launch mode drop-down list, click Debug.
  3. In the Launch target drop-down list, click a device or simulator.
  4. To resolve any device connection issues, click Edit, and follow the instructions in the Device Properties dialog box.
  5. Click Momentics launch button. The Momentics IDE changes to the Debug perspective, installs the app on your simulator or device, and starts the app under the control of the debugging tool. The debugging tool stops at the first line of your code and waits for your input.
  6. In the Debug view, click the thread that you want to control.
  7. To control the debugging tool, use the buttons in the Debug view toolbar.
  8. When you are finished debugging, on the Debug view toolbar, click The Terminate icon. You must terminate the debug session before you rebuild the project, or the build fails.

Control your debug session using the C/C++ editor

To control your debug session using the C/C++ editor, you allow the app to run until it hits the line that your cursor is on. If the app never hits that line, the app runs until it finishes or hits another breakpoint. You can use the context menu in the C/C++ editor to resume execution at a specific line or to add a watch expression.

The debugging tool controls the debugging session in the C/C++ editor.

  1. In the editor, select a file that is associated with the process that you are debugging.
  2. Click where you want to insert the cursor and interrupt the execution.
  3. Right-click near the cursor and click Run To Line, Resume at line, or Add watch expression.

    Run To Line works only in the current stack frame, which means that you can use it only within the function that is running.

Last modified: 2015-03-31



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus