Tutorial: Debugging with Intel® Distribution for GDB*
To debug OpenCL™ applications with Intel® Distribution for GDB*, make sure you use the following flags when calling the clBuildProgram function:
This allows you to set a breakpoint in the following format: breakpoint kernel.cl:<line number>.
Launch the debugger as follows:
gdb-oneapi <application>
To start debugging, you must set a pending breakpoint because the kernel source file is not known to the debugger yet:
(gdb) set breakpoint pending on
(gdb) break kernel.cl:<line number>
(gdb) run
At runtime, the kernel sources are loaded to the debugger and the breakpoint is hit, both for CPU and GPU offloads.