Tutorial: Debugging with Intel® Distribution for GDB*
This section describes a basic scenario of debugging a sample DPC++ app, Array Transform, with the kernel offloaded to the CPU.
Before you proceed, make sure you have completed all necessary setup steps and got a sample code as described in the Get Started Guide.
54 h.parallel_for(data_range, [=](id<1> index) { 55 int id0 = GetDim(index, 0); 56 int element = in[index]; // breakpoint-here 57 int result = element + 50; 58 if (id0 % 2 == 0) { 59 result = result + 50; // then-branch 60 } else { 61 result = -1; // else-branch 62 } 63 out[index] = result; 64 });
Define a breakpoint at line 56 (with the breakpoint-here comment) and run the program. You will see when the thread hits the breakpoint.
Now you can issue the usual Intel® Distribution for GDB* commands to inspect the local variables, print a stack trace, and get information on threads.
Kernel Functions
Kernel functions that have a call-by-value parameter of a class/struct type (for example, cl::sycl::id) cannot be used in the Watch window.
Accessor's Operator []
The operator [] of an accessor object cannot be used in the Watch window.