Debug with Intel® Distribution for GDB* on Linux* OS Host

ID 766459
Date 3/31/2025
Public

Debug Examples in Linux

After you’ve completed the installation and configuration steps in the Get Started Guide for Linux, here are some examples of debugging applications in Linux using Intel® Distribution for GDB*.

Debug a SYCL* Application on a CPU

Use the simple SYCL application named Array Transform to perform basic debugging operations, such as break, run, print, continue, info, disassemble, and next. The application being debugged is limited to running on multiple CPU threads by setting the ONEAPI_DEVICE_SELECTOR=*:cpu environment variable.

The debug array transform application used in this example can be found in the Intel oneAPI sample repo or by way of the oneapi-cli sample browser tool. After you have installed and initialized the Intel oneAPI Base Toolkit environment, run oneapi-cli --help in your terminal command line. The sample includes a build script to create an application that can be debugged and run on either a CPU or a GPU (the compiler debug flags are set during the build).

See the oneAPI Development Environmental Setup for details regarding initialization of the oneAPI development environment.

Debug a SYCL* Application on a GPU

Use a simple SYCL application named Array Transform to perform basic debugging operations, such as break, run, print, continue, info, disassemble, and next. This example describes how to interact with SIMD lanes, as additional thread elements. The application being debugged is instructed to run on a GPU by setting the ONEAPI_DEVICE_SELECTOR=level_zero:gpu environment variable. Refer to Differences of debugging a kernel on a CPU and a GPU for more information.

Debug a SYCL* Program on the FPGA Emulator

The FPGA emulator runs on the CPU and behaves similarly to the CPU device. Make sure you complete the necessary setup steps described in the Get Started Guide and proceed with instructions on Basic Debugging on CPU.

Debug an OpenCL™ Application

Starting with the 2023.0 release of oneAPI, debugging OpenCL™ applications is not supported. For earlier versions (2022.x and earlier), see these instructions.

Debugging Options

This example has some useful options for debugging, such as Auto-Attach, Reducing Overhead, Pretty-Printing, Prettify Frames, and more.

If you are experiencing problems with debugging in Linux, refer to Troubleshoot Debugging in Linux.