gdb pretty printer: python2 vs python3

General questions regarding the usage of CodeLite
jazztickets
CodeLite Curious
Posts: 8
Joined: Thu Nov 25, 2010 4:10 am
Genuine User: Yes
IDE Question: c++
Contact:

gdb pretty printer: python2 vs python3

Post by jazztickets » Fri Feb 28, 2014 10:38 pm

So codelite ships with a python2 pretty printer. The gdb that ships with ubuntu 13.10 and probably most newer distros ships with gdb compiled with python3 support. This means you'll get syntax errors like

Code: Select all

DEBUG>>&"  File \"<string>\", line 3, in <module>\n"
DEBUG>>&"  File \"~/.codelite/gdb_printers/libstdcxx/v6/printers.py\", line 279\n"
DEBUG>>&"    raise ValueError, \"Top of tuple tree does not consist of a single node.\"\n"
DEBUG>>&"                    ^\n"
DEBUG>>&"SyntaxError: invalid syntax\n"
DEBUG>>&"Error while executing Python code.\n"
DEBUG>>^error,msg="Error while executing Python code."
the syntax for raise has changed in python3 http://docs.pythonsprints.com/python3_p ... exceptions

So my question is, what setup is eranif using?

User avatar
eranif
CodeLite Plugin
Posts: 5934
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: gdb pretty printer: python2 vs python3

Post by eranif » Fri Feb 28, 2014 11:20 pm

jazztickets wrote:So my question is, what setup is eranif using?
I am using python 2.7.5

Code: Select all

eran@eran-linux: ~ $ python --version
Python 2.7.5+
Eran
Make sure you have read the HOW TO POST thread

jazztickets
CodeLite Curious
Posts: 8
Joined: Thu Nov 25, 2010 4:10 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: gdb pretty printer: python2 vs python3

Post by jazztickets » Sat Mar 01, 2014 12:18 am

eranif wrote:
jazztickets wrote:So my question is, what setup is eranif using?
I am using python 2.7.5

Code: Select all

eran@eran-linux: ~ $ python --version
Python 2.7.5+
Eran
I mean, what version of python is your gdb using?

if you run gdb from the terminal, then type

Code: Select all

python print "hey"
you would get a syntax error if gdb is compiled with python3

User avatar
eranif
CodeLite Plugin
Posts: 5934
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: gdb pretty printer: python2 vs python3

Post by eranif » Sat Mar 01, 2014 1:04 am

The official ubuntu one installed on my machine is version 7.6.1 which indeed produces an error, however, I am using a self compiled gdb with python support enabled
which does not produce an error, but instead prints "hey"

Eran
Make sure you have read the HOW TO POST thread

jazztickets
CodeLite Curious
Posts: 8
Joined: Thu Nov 25, 2010 4:10 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: gdb pretty printer: python2 vs python3

Post by jazztickets » Sat Mar 01, 2014 1:09 am

eranif wrote:The official ubuntu one installed on my machine is version 7.6.1 which indeed produces an error, however, I am using a self compiled gdb with python support enabled
which does not produce an error, but instead prints "hey"

Eran
Gotcha. Well, i put a issue report in. Converting those .py files to version 3 should work with both versions of python.

https://github.com/eranif/codelite/issues/433

User avatar
eranif
CodeLite Plugin
Posts: 5934
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: gdb pretty printer: python2 vs python3

Post by eranif » Sat Mar 01, 2014 1:13 am

jazztickets wrote:Gotcha. Well, i put a issue report in. Converting those .py files to version 3 should work with both versions of python.

https://github.com/eranif/codelite/issues/433
Thanks

Eran
Make sure you have read the HOW TO POST thread

Post Reply