Skip to content

[DEBUG] Implement logic used in inspect.getsourceline() to improve UX for function line numbers #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kkraus14 opened this issue Apr 14, 2025 · 0 comments

Comments

@kkraus14
Copy link
Collaborator

For a CUDA kernel such as:

from numba import cuda

@cuda.jit
def kernel(x, y):
    pass

when breaking on kernel launch such as with:

(cuda-gdb) set cuda break_on_launch application

the kernel will be hit and the debugger will state that the current line is the third line, reading @cuda.jit. It would be better if it identified the beginning of the kernel code as the current line, i.e. the one reading pass. This is because the line number is obtained from the function code object's co_firstlineno, which Python identifies as the line on which the decorator begins. inspect.getsourceline() contains some logic to get the first actual code line, but it's not available through a public API - we would need similar logic to get the first code line.

Note - this may already get resolved by #50 if the wrapper code generation is causing this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant