Even with your simple example, I cannot seem to get my GDB to hit the breakpoint:
$ icpx -fsycl -g -O0 -o test ./test.cpp
$ gdb /test
(gdb) list test.cpp:19
14 sycl::buffer buf{v};
15 q.submit([&](sycl::handler& cgh) {
16 auto acc{buf.get_access(cgh,sycl::read_write)};
17 cgh.parallel_for(N, [=](sycl::id<1> id) {
18 int value{acc[id]};
19 acc[id] = 2 * value;
20 acc[id] += 1;
21 });
22 });
23
(gdb) break test.cpp:19
Breakpoint 1 at 0x406692: file ./test.cpp, line 19.
(gdb) run
Starting program: /home/bagels/test
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffdc3ac700 (LWP 8472)]
[New Thread 0x7fffd88c2700 (LWP 8473)]
[New Thread 0x7fffd84c1700 (LWP 8474)]
[New Thread 0x7fffc5f55700 (LWP 8475)]
[New Thread 0x7fffc5b54700 (LWP 8476)]
[New Thread 0x7fffc5352700 (LWP 8478)]
[New Thread 0x7fffc5753700 (LWP 8477)]
[New Thread 0x7fffc4f51700 (LWP 8479)]
//v[0] = 1
v[63] = 127
v[255] = 511
v[511] = 1023
v[1023] = 2047
[Thread 0x7fffdc3ac700 (LWP 8472) exited]
[Thread 0x7fffc5352700 (LWP 8478) exited]
[Thread 0x7fffc4f51700 (LWP 8479) exited]
[Thread 0x7fffc5753700 (LWP 8477) exited]
[Thread 0x7fffc5b54700 (LWP 8476) exited]
[Thread 0x7fffc5f55700 (LWP 8475) exited]
[Thread 0x7fffd88c2700 (LWP 8473) exited]
[Thread 0x7ffff596ff80 (LWP 8468) exited]
[Inferior 1 (process 8468) exited normally]
My GDB doesn’t hit the breakpooint. Maybe this has to do with my version of GDB? I’m using GDB 9.2 but this post gives a working example with GDB 8.1.
I’m also using DPC++ 2023.2.1.