Red Hat Bugzilla – Bug 1259051
Gdb-heap fails with Python backtrace
Last modified: 2016-01-17 08:05:27 EST
Description of problem:
When starting gdb, I get error messages about incorrect Python syntax in gdb-heap/heap/__init__.py
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create a file with debug information. E.g.:
cat > c.c << EOF
2. Compile with debug information.
cc -g c.c -o c
3. Start gdb on it.
4. Set a breakpoint.
Gdb prints an error message:
Traceback (most recent call last):
File "/usr/share/gdb/auto-load/usr/lib64/ld-2.22.so-gdb.py", line 18, in <module>
from heap.commands import register_commands
File "/usr/share/gdb-heap/heap/__init__.py", line 58
print 'type cache miss: %r' % typename
SyntaxError: invalid syntax
No error message.
To me, this looks very much like a python2/python3 issue. The print statement is apparently in python2 syntax, but gdb links with the python3 libraries.
If I add parenthesis around the string and variable, I instead get an error message around the except clause two lines further down. Again, it uses python2 syntax.
From what I can understand, a conversion 2to3 is needed on the Python files in the package.
*** This bug has been marked as a duplicate of bug 1240340 ***