Examining Data¶
See GDB* documentation.
print expr
¶
To print the value of a variable, run the print <variable>
command.
(gdb) print l1
$3 = 2.5931931659579277
(gdb) print l2
$4 = 0.22954882979393004
(gdb) ptype a
type = byte [56]
Note
Displaying complex data types requires Numba 0.55 or higher.
Example - Complex Data Types¶
Source code numba_dpex/examples/debug/side-by-side-2.py
:
14def common_loop_body(i, a, b):
15 param_a = a[i]
16 param_b = b[i]
17 param_c = param_a + 10 # Set breakpoint here
18 param_d = param_b * 0.5
19 result = param_c + param_d
20 return result
Debug session:
$ gdb-oneapi -q python
...
(gdb) set environment NUMBA_OPT 0
(gdb) set environment NUMBA_EXTEND_VARIABLE_LIFETIMES 1
(gdb) break side-by-side-2.py:29 if param_a == 5
...
(gdb) run numba_dpex/examples/debug/side-by-side-2.py --api=numba-dpex-kernel
...
Thread 2.1 hit Breakpoint 1, with SIMD lane 5, __main__::common_loop_body (i=5, a=..., b=...) at side-by-side-2.py:29
29 result = param_c + param_d
(gdb) print a
$1 = {meminfo = 0x0, parent = 0x0, nitems = 10, itemsize = 4,
data = 0x555558461000, shape = {10}, strides = {4}}
(gdb) x/10f a.data
0x555558461000: 0 1 2 3
0x555558461010: 4 5 6 7
0x555558461020: 8 9
(gdb) print a.data[5]
$2 = 5
This example prints array and its element.