Altering Execution

See GDB* documentation.

Assignment to Variables

To alter the value of a variable, evaluate an assignment expression. This also works for function arguments.

Note

Altering arguments has limitation. For it to work correctly arguments should not be modified in code. See Numba issue.

Example

Source code numba_dpex/examples/debug/side-by-side-2.py:

24def common_loop_body(i, a, b):
25    param_a = a[i]
26    param_b = b[i]
27    param_c = param_a + 10  # Set breakpoint here
28    param_d = param_b * 0.5
29    result = param_c + param_d
30    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 param_c
$1 = 15
(gdb) print param_c=200
$2 = 200
(gdb) print param_c
$3 = 200