【发布时间】:2021-01-21 10:34:04
【问题描述】:
我在这里的第一个问题,如果我做错了,请告诉我。
我的问题
我正在使用 Numba 编写一个模块。当然,我遇到了段错误,但我找不到它的来源。所以我正在尝试调试它using gdb from Numba,但它不起作用:segfault 已引发但我没有从它的来源获得任何信息:
[Reading symbols]
28 ../sysdeps/unix/sysv/linux/nanosleep.c: Aucun fichier ou dossier de ce type.
0x00007feacc67ea30 in __GI___nanosleep (requested_time=0x7ffdfe227510,
remaining=0x7ffdfe227510) at ../sysdeps/unix/sysv/linux/nanosleep.c:28
Breakpoint 1 at 0x7fea9d234150: file numba/_helperlib.c, line 1131.
Continuing.
double free or corruption (!prev)
51 ../sysdeps/unix/sysv/linux/raise.c: Aucun fichier ou dossier de ce type.
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
(gdb)
在 gdb 初始化期间,这也会打印在 stderr 中:
attach: No such file or directory.
请注意,我已经通过设置 kernel.yama.ptrace_scope=0
解决了提到的 ptrace 问题here重现 Numba 的调试示例
我不知道它是否算作工作复制器,但我尝试运行我之前提到的 Numba 文档中的示例:
from numba import njit, gdb_init
import numpy as np
@njit(debug=True)
def foo(a, index):
gdb_init() # instruct Numba to attach gdb at this location, but not to pause execution
b = a + 1
c = a * 2.34
d = c[index] # access an address that is a) invalid b) out of the page
print(a, b, c, d)
bad_index = int(1e9) # this index is invalid
z = np.arange(10)
r = foo(z, bad_index)
print(r)
而且我无法获得与他们相同的输出:
[Reading symbols]
0x00007efcb5a60a30 in __GI___nanosleep (requested_time=0x7ffff4990f70,
remaining=0x7ffff4990f70) at ../sysdeps/unix/sysv/linux/nanosleep.c:28
28 ../sysdeps/unix/sysv/linux/nanosleep.c: Aucun fichier ou dossier de ce type.
Breakpoint 1 at 0x7efcabf3d150: file numba/_helperlib.c, line 1131.
Continuing.
Traceback (most recent call last):
File "/home/.../test_segfault.py", line 16, in <module>
r = foo(z, bad_index)
IndexError: index is out of bounds
[Inferior 1 (process 4299) exited with code 01]
我的错误消息并没有指出段错误的确切行,只是 jitted 函数..
再一次,我收到了这条消息,这可能是我的问题的根源..
attach: No such file or directory.
谁能帮我完成这项工作?
或指向等效问题的链接?在调试 Numba 时,我发现文档和论坛非常简短。
或者可能是在 Numba jitted 函数中跟踪段错误的替代方法?
感谢您阅读我的内容,希望可以理解。
【问题讨论】: