Skip to content
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

Syntax error in printers when python 3 is used #1

Open
gberginc opened this issue Apr 17, 2015 · 1 comment
Open

Syntax error in printers when python 3 is used #1

gberginc opened this issue Apr 17, 2015 · 1 comment

Comments

@gberginc
Copy link

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).

@nyh
Copy link

nyh commented Apr 19, 2015

On Fri, Apr 17, 2015 at 2:46 PM, gberginc [email protected] wrote:

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
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
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
https://gist.github.com/gberginc/f5675c19c5947f9340ba. Not sure how to
submit the patch (either as a pull request or to the mailing list).


Reply to this email directly or view it on GitHub
#1.

Hi Gregor, I'm replying also to the OSv mailing list, because I don't think
anyone even realized that the "gcc.bin" submodule has its own bug tracker
(and as you can see this is the first bug there), and one of the annoying
features of the Github bug tracker is that people need to be personally
subscribed to the bug tracker to be notified about these bugs (and only 9
people ever bother to subscribe to the gcc.bin bug tracker).

And now to the point:

printers.py is part of gcc, not OSv. I think the mistake here (and this is
a common theme lately...) is that we're using one from external/, whereas
we should have used the one from the system. After all, the user compiled
with his system's gcc, and is debugging with the system's gdb - so it
doesn't make too much sense to suddenly bring our own glue code between
those two - when the user's system probably has this glue code too - and
has it for the right version of gcc, gdb and python.

I'll prepare a patch.

Nadav Har'El
[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants