[ovs-dev] [PATCH] Utilities: Add the ovs_dump_ofpacts command to gdb

William Tu u9012063 at gmail.com
Mon Apr 20 15:57:41 UTC 2020


On Mon, Apr 20, 2020 at 03:37:03PM +0200, Eelco Chaudron wrote:
> William,
> 
> Can you try adding this somewhere at the top after the other import section?
> 
> from __future__ import print_function
> 
> And let me know if it works?
> 
> Thanks,
> 
> Eelco

Hi Eelco,

Thanks, it work, but I have to put it "before" other import

diff --git a/utilities/gdb/ovs_gdb.py b/utilities/gdb/ovs_gdb.py
index befc2b4a4b45..3a23df452816 100644
--- a/utilities/gdb/ovs_gdb.py
+++ b/utilities/gdb/ovs_gdb.py
@@ -55,11 +55,14 @@
 #    ...
 #    ...
 #
+
+from __future__ import print_function
 import gdb
 import sys
 import uuid


Putting it after import below has the issue

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f57c81f774d in poll () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) source utilities/gdb/ovs_gdb.py 
  File "utilities/gdb/ovs_gdb.py", line 62
    from __future__ import print_function
SyntaxError: from __future__ imports must occur at the beginning of the file
(gdb) 


William

> 
> 
> On 20 Apr 2020, at 15:27, Eelco Chaudron wrote:
> 
> >On 20 Apr 2020, at 15:06, William Tu wrote:
> >
> ><SNIP>
> >>>>Is this due to python2/3? My python version:
> >>>>boxes:~/ovs# python
> >>>>Python 3.5.2 (default, Oct  8 2019, 13:06:37)
> >>>>[GCC 5.4.0 20160609] on linux
> >>>>Type "help", "copyright", "credits" or "license" for more
> >>>>information.
> >>>
> >>Hi Eelco,
> >>That's the only error I got
> >>
> >>(gdb) source ./utilities/gdb/ovs_gdb.py
> >>  File "./utilities/gdb/ovs_gdb.py", line 164
> >>    print(self.message, end='')
> >>                           ^
> >>SyntaxError: invalid syntax
> >
> >Looks like the end=‘’ option is only supported in later version of 3.x.
> >I’ll try to find a way to make this work for all version of Python and
> >sent a patch later this week/early next week.
> >
> >//Eelco
> >
> >_______________________________________________
> >dev mailing list
> >dev at openvswitch.org
> >https://mail.openvswitch.org/mailman/listinfo/ovs-dev


More information about the dev mailing list