5. Running and debugging the program

QNX SDP8.0Quickstart GuideDeveloperSetup

Launching an application

You can run your program as a standalone binary.

To run the program:
  1. From the Workspace, right-click the program's project folder.
  2. Navigate to QNX > Run as QNX Application.
  3. Click Run as QNX Application.
  4. Select the default launch configuration from the palette. The QNX Toolkit uses the default settings to build and launch the program. The output of the Hello World program is displayed in the debug console.


Debugging an application

You can debug your active program using QNX Toolkit. You need to attach to a binary, so the debugger can match binary instructions with lines of code.

To debug the application:
  1. From the workspace, right-click the program's project folder.
  2. Click QNX > Debug as QNX Application.
  3. Select the launch configuration for debugging. The QNX Toolkit runs, and you can use the features of the debugger to inspect the program.


  4. QNX Toolkit switches to the Run and Debug view and transfers your program from your development host to your target system; then it starts the program under the control of the debugger. The debugger stops in the first line of your program. In the QNX Toolkit Debug side bar, you'll see an overview of your process, including the call stack. Using the buttons in the Debug toolbar, you can control the debugger.

  5. When you run or debug your application from QNX Toolkit, any input is read from the IDE's console, and any output goes to it. After execution has passed the line that calls printf, you should see the Hello QNX! message in the Debug console.

About the debugger

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

During debugging, you can watch the variables in the Debug side bar, which displays how your variables change. You can use the Step Into button to let the debugger go into the code of a function.

To set a breakpoint, click next to any line of code. The breakpoint is shown as a little circle, which you can set or remove while you write your code.
Breakpoints
When the running program hits a breakpoint, it stops in the debugger, and you can, for example, examine your variables. If you click the Continue button, your program continues until the next breakpoint:

To abort program execution, use the Stop button:
Terminate button
Note:
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 fails.

You can also perform operations on the file system by mounting the remote file system in the QNX Toolkit Explorer. After mounting, you can perform file operations, such as manually transferring your binary, and then running it. For more information about remote file system operations, go to Remote file system operations in the Using the Target Navigator chapter of the QNX Toolkit for Visual Studio Code Guide.

Next steps

To extend the Hello World project, you can modify and extend the source code. Consult the documentation to get in-depth information: You can view the QNX OS System Architecture guide, the QNX Toolkit User's Guide, and the QNX OS Programmer's Guide. If you've used earlier versions of QNX SDP, see also Migrating to QNX OS 8.0.

If you have further questions, contact your QNX Account Manager, Field Application Engineer, or our support department, and visit our Foundry27 community website (https://community.qnx.com).

Page updated: