Debugging example in GPU Puzzles (p09) is outdated

Copy-pasting here what I wrote on the Discord Mojo channel:

Hello, I have a basic question about gpu puzzles, specifically the Debugging example. Trying to follow the steps in Problem 9 - Essentials but cannot access the array data:

(cuda-gdb) info locals
i = {0}
(cuda-gdb) print a[i]
Value can't be converted to integer.
(cuda-gdb) print i
$4 = {0}

I tried a[unsafe_offset=i] as in the code, but that doesn’t work: No symbol "unsafe_offset" in current context.

Then in Case 2 of p09, I try the steps in the solution and it doesn’t work:

(cuda-gdb) p a.ptr[0]
There is no member named ptr.
(cuda-gdb) p a.ptr[0]@4
There is no member named ptr.

I guess the README files need updating… This worked:

(cuda-gdb) p a._storage[0]
$7 = {0}

It also seems like the -g -O0 flags don’t get automatically used for mojo debug without previously building the binary… if I run directly without pre-compiling, lots of variables get optimized out (can’t even get the value of idx or window_sum for this example)

(cuda-gdb) p idx
$18 = <unavailable>
(cuda-gdb) p window_sum
$19 = <optimized out>