davidmalcolm / gcc-python-plugin

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

unhandled exception in cpychecker #88

Open davidmalcolm opened 7 years ago

davidmalcolm commented 7 years ago

This unhandled exception comes when building gdb's py-cmd.c using the checker. I haven't tried to make a minimal test case yet.

{{{ ../../archer/gdb/python/py-cmd.c: In function ‘gdbpy_parse_command_name’: ../../archer/gdb/python/py-cmd.c:370:12: 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 79, in execute self._check_refcounts(fun) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/init.py", line 85, in _check_refcounts dump_json=self.dump_json) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 4361, in check_refcounts maxtrans) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/refcounts.py", line 4216, in impl_check_refcounts limits=limits) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3073, in iter_traces depth + 1): File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 3037, in iter_traces transitions = curstate.get_transitions() File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2089, in get_transitions return self._get_transitions_for_stmt(stmt) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2112, in _get_transitions_for_stmt return self._get_transitions_for_GimpleCond(stmt) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2456, in _get_transitions_for_GimpleCond boolval = self.eval_condition(stmt, stmt.lhs, stmt.exprcode, stmt.rhs) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2526, in eval_condition self.raise_split_value(lhs, stmt.loc) File "/home/tromey/Space/Trunk/gcc-python-plugin/libcpychecker/absinterp.py", line 2059, in raise_split_value check_isinstance(ptr_rvalue, UnknownValue) File "/home/tromey/Space/Trunk/gcc-python-plugin/gccutils/init.py", line 637, in check_isinstance raise TypeError('%s / %r is not an instance of %s' % (obj, obj, types)) TypeError: (struct cmd_list_element )&Region('heap-region-45') from ../../archer/gdb/python/py-cmd.c:370 / PointerToRegion(gcctype='struct cmd_list_element ', loc=gcc.Location(file='../../archer/gdb/python/py-cmd.c', line=370), region=Region('heap-region-45')) is not an instance of <class 'libcpychecker.absinterp.UnknownValue'> }}}

The line in the error message is:

{{{ if (!elt || elt == (struct cmd_list_element *) -1) }}}

So perhaps that provides some clue.

davidmalcolm commented 7 years ago

Imported from trac issue 48. Created by tromey on 2013-04-19T11:02:22, last modified: 2013-04-19T11:02:22