This repository was archived by the owner on Jul 13, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 13, 2026. It is now read-only.
Double function call in Numba #382
Copy link
Copy link
Closed
Description
Activity
info localsdoesn't show the values of variables when gdb hits breakpoint the first time. Testing the example below I see the strange behavior of debugging with gdb.import numba @numba.njit(debug=True) def foo(a): b = a + 1 c = a * 2.34 d = (a, b, c) print(a, b, c, d) return b, c, d r = foo(123) print(r)
When gdb hits breakpoint the first time, the value of a function argument is equal to 0. But if I call next (
ncommand) several times, gdb hits the breakpoint again and at this time I see that the value of a is equal to 123. Also, if I step all the function again I see all the values of local variables.$ export NUMBA_OPT=0 $ gdb -q --args python numba_ex.py Reading symbols from python... (gdb) break numba_ex.py:6 No source file named numba_ex.py. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (numba_ex.py:6) pending. (gdb) run Thread 1 "python" hit Breakpoint 1, __main__::foo$241 () at numba_ex.py:6 6 b = a + 1 (gdb) info locals d = "\000.\037\302\314m\017| \375\336\342\377\177\000\000@\350\000\334\377\177\000" a = 0 b = <optimized out> c = <optimized out> (gdb)
(gdb) n 7 c = a * 2.34 (gdb) n 8 d = (a, b, c) (gdb) n 9 print(a, b, c, d) (gdb) n 10 return b, c, d (gdb) n 6 b = a + 1 (gdb) info locals d = '\000' <repeats 23 times> a = 123 b = 0 c = 0 (gdb) n 7 c = a * 2.34 (gdb) n 8 d = (a, b, c) (gdb) n 9 print(a, b, c, d) (gdb) info locals d = "{\000\000\000\000\000\000\000|\000\000\000\000\000\000\000\205\353Q\270\036\375q@" a = 123 b = 124 c = 287.81999999999999
Reacted by Sergey PokhodenkoFix from Numba: numba/numba#7116
I think numba/numba@2d63784 from numba/numba#7177 is going to be needed as well for dealing with refcounted types.
Tested numba/numba#7177
import numba import numpy as np @numba.njit(debug=True) def foo(a, arr): b = arr[3] + a c = b * 2.34 d = 10 * c return d, arr arr = np.arange(10) r = foo(123, arr) print(r, a)
$ gdb-oneapi -q --args python numba_ex.py Reading symbols from python... (gdb) break numba_ex.py:6 No source file named numba_ex.py. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (numba_ex.py:6) pending. (gdb) run Breakpoint 1, __main__::foo$241 () at numba_ex.py:6 6 b = arr[3] + a (gdb) info locals a = 0 arr = {meminfo = 0x0, parent = 0x0, nitems = 0, itemsize = 0, data = 0x0, shape = {0}, strides = {0}} b = 0 c = 0 d = 0 (gdb) n 7 c = b * 2.34 (gdb) n 8 d = 10 * c (gdb) info locals a = 0 arr = {meminfo = 0x5555564753a0 "\002", parent = 0x7fffdf36fb70 "\005", nitems = 10, itemsize = 8, data = 0x555556203d90, shape = {10}, strides = {8}} b = 0 c = 294.83999999999997 d = 0 (gdb) whatis arr type = array(int64, 1d, C) ({i8*, i8*, i64, i64, i64*, [1 x i64], [1 x i64]})
Fixed in Numba 0.55.
Fixed in Numba 0.55.
Thanks for confirming.
Metadata
Metadata
Assignees
Labels
debugRelated to #149Related to #149
Double function call, wrapper or wrong debug info generation. Blocker for back trace and local variables.