davidmalcolm / gcc-python-plugin

GCC plugin that embeds CPython inside the compiler
GNU General Public License v3.0
199 stars 58 forks source link

uncaught TypeError within impl_PyList_Append when building gdb #62

Closed davidmalcolm closed 7 years ago

davidmalcolm commented 7 years ago

When building gdb with the checker, I get this uncaught TypeError.

The line in question is: {{{ PyObject current_py_bp = (PyObject ) current_bs->breakpoint_at->py_bp_object; }}} Here, py_bp_object has type 'struct breakpoint_object ', which is derived from PyObject. However, this code doesn't have access to the definition, it is an incomplete type here. {{{ ../../archer/gdb/python/py-stopevent.c: In function ‘emit_stop_event’: ../../archer/gdb/python/py-stopevent.c:71:29: error: Unhandled Python exception raised calling 'execute' method Traceback (most recent call last): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 64, in execute self._check_refcounts(fun) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 68, in _check_refcounts self.show_possible_null_derefs) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 2838, in check_refcounts limits=limits) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2716, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2680, in iter_traces transitions = curstate.get_transitions() File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1828, in get_transitions return self._get_transitions_for_stmt(stmt) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1844, in _get_transitions_for_stmt return self._get_transitions_for_GimpleCall(stmt) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 1995, in _get_transitions_for_GimpleCall return meth(stmt, args) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 1514, in impl_PyList_Append s_success.cpython.add_ref(v_newitem, stmt.loc) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 326, in add_ref _incref_internal) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 300, in change_refcount check_isinstance(pyobjectptr, PointerToRegion) File "/home/tromey/Space/Trunk/gcc-python-plugin/gccutils.py", line 630, in check_isinstance raise TypeError('%s / %r is not an instance of %s' % (obj, obj, types)) TypeError: unknown struct breakpoint_object * from ../../archer/gdb/python/py-stopevent.c:61 / UnknownValue(gcctype=<gcc.PointerType object at 0x19d7d80>, loc=gcc.Location(file='../../archer/gdb/python/py-stopevent.c', line=61)) is not an instance of <class 'libcpychecker.absinterp.PointerToRegion'> }}}

davidmalcolm commented 7 years ago

Imported from trac issue 22. Created by tromey on 2012-01-05T09:19:39, last modified: 2012-01-06T14:59:44

davidmalcolm commented 7 years ago

Trac comment by dmalcolm on 2012-01-06 14:59:44:

Fixed in f886378b3aba555dabf82798eb5fc5e07e646396