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

Can't print variables on cygdb #2699

Open
hygorxaraujo opened this Issue Nov 2, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@hygorxaraujo

hygorxaraujo commented Nov 2, 2018

When I try to debug some cython code I can't print variables, the following error always occurs:

(gdb) cy print some_variable
Python Exception <type 'exceptions.AttributeError'> 'PyDictObjectPtr' object has no attribute 'items':
Error occurred in Python: 'PyDictObjectPtr' object has no attribute 'items'

I'm also getting this one sometimes (usually after the first one):

Python Exception <class 'gdb.error'> There is no member named ob_sval.:
Error occurred in Python command: There is no member named ob_sval.

To reproduce this I created this repository which has an environment for debug configured with Docker.
Steps to reproduce with the code in the repository:

  1. docker build -t cython_debug .
  2. docker run -it --name cy_debug --cap-add=SYS_PTRACE --security-opt seccomp=unconfined cython_debug bash
    (now inside the container)
  3. python-dbg setup.py build_ext --inplace
  4. cygdb
  5. cy break get_area
  6. cy run test.py
  7. cy print self
@scoder

This comment has been minimized.

Contributor

scoder commented Nov 2, 2018

Cython uses a copy of the libpython.py module from CPython, last updated about a year ago. It was adapted to work in Py2.7 and later.
https://github.com/cython/cython/blob/master/Cython/Debugger/libpython.py
Originally copied from:
https://github.com/python/cpython/blob/master/Tools/gdb/libpython.py
There might have been upstream updates since then, and there might be bugs in the way it was adapted. Worth debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment