Skip to content

Syntax error in printers when python 3 is used #1

@gberginc

Description

@gberginc

While trying to use GDB to debug an OSv instance that hangs with an undefined syscall, I got a strange syntax error:

lemmy@mike:~/work/osv⟫ gdb build/release/loader.elf 
[...]
Reading symbols from build/release/loader.elf...done.
Traceback (most recent call last):
  File "/home/lemmy/work/osv/scripts/loader.py", line 1483, in <module>
    setup_libstdcxx()
  File "/home/lemmy/work/osv/scripts/loader.py", line 1020, in setup_libstdcxx
    exec(compile(open(main).read(), main, 'exec'))
  File "/home/lemmy/work/osv/external/x64/gcc.bin/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.18-gdb.py", line 59, in <module>
    from libstdcxx.v6.printers import register_libstdcxx_printers
  File "/home/lemmy/work/osv/external/x64/gcc.bin/usr/share/gcc-4.8.2/python/libstdcxx/v6/printers.py", line 55
    raise ValueError, "Cannot find type %s::%s" % (str(orig), name)
                    ^
SyntaxError: invalid syntax

Although my default python is 2.7, GDB seems to be linked with python 3.4 causing a problem: python 3 does not support tuples when raising exceptions anymore.

Patch is rather trivial and requires changing this pattern on several places inside printers.py, like in this gist. Not sure how to submit the patch (either as a pull request or to the mailing list).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions