Skip to content
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

[BUG] CyGDB doesn't seem to work with GDB 10 #4176

Open
amol- opened this issue May 19, 2021 · 0 comments
Open

[BUG] CyGDB doesn't seem to work with GDB 10 #4176

amol- opened this issue May 19, 2021 · 0 comments

Comments

@amol-
Copy link
Contributor

amol- commented May 19, 2021

Describe the bug
When CyGDB is used with GDB10 it seems to be unable to properly map functions back and forth between C/C++ and Cython

To Reproduce
Using GDB10 set a breakpoint on a cython function and try to cy list

(gdb) cy list
Traceback (most recent call last):
  File "/Users/amol/wrk/ursa/cython/Cython/Debugger/libpython.py", line 1980, in wrapper
    return function(*args, **kwargs)
  File "/Users/amol/wrk/ursa/cython/Cython/Debugger/libcython.py", line 1103, in invoke
    source = sd.get_source(lineno - 5, lineno + 5, mark_line=lineno,
  File "/Users/amol/wrk/ursa/cython/Cython/Debugger/libcython.py", line 468, in get_source
    raise exc
gdb.GdbError: Unable to retrieve source code

Environment (please complete the following information):

  • OS: OSX
  • Python version 3.9.5
  • Cython version 3.0a6
  • GDB 10.2

Additional context
The issue seems to be caused by gdb.selected_frame().name() that now returns the whole function signature including arguments instead of just the name.

(gdb) python print(gdb.selected_frame().name())
__pyx_pf_7pyarrow_3lib_5Array_61to_numpy(__pyx_obj_7pyarrow_3lib_Array*, _object*, _object*)

In my specific case cygdb looks for __pyx_pf_7pyarrow_3lib_5Array_61to_numpy(__pyx_obj_7pyarrow_3lib_Array*, _object*, _object*) into functions_by_cname but given that the debug information are generated without arguments

<Function name="to_numpy" cname="__pyx_pf_7pyarrow_3lib_5Array_61to_numpy" pf_cname="" qualified_name="pyarrow.lib.Array.to_numpy" lineno="1131">

the get_cython_function method is unable to find it.

I'm not sure if this is an issue in GDB itself or in Cydb. I mean... We are asking the "name" to GDB and I don't feel that implies the whole signature. In any case it can probably be avoided by removing the function arguments in libcython itself when looking up functions, thus retaining compatibility with both GDB9 and 10.
I can work on a PR in that direction if we feel that's the right way to fix this.

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