[ovs-discuss] how to use ovs-gdb correctly

solomon liwei.solomon at gmail.com
Thu Jan 3 02:48:48 UTC 2019


Hi Eelco:

 Your patch works great for me. Thank you.
 I have tested it both on python2.7 and python3.5 in my dev box of debian9.


# gdb $(which ovs-vswitchd) $(pidof ovs-vswitchd)
GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.

# cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"

__
Best Regard
Solomon


Eelco Chaudron wrote:
> Hi Solomon,
> 
> I’m using an even older version of python, and works fine here:
> 
> $ python -V
> Python 2.7.5
> 
> I’m using this version of gdb:
> 
> 
> 
> You can enable some additional debugging (full stack):
> 
> $ gdb $(which ovs-vswitchd) $(pidof ovs-vswitchd)
> GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-114.el7
> ...
> (gdb) source ~/ovs_latest_git/utilities/gdb/ovs_gdb.py
> (gdb) set python print-stack full
> (gdb) ovs_show_upcall
> netdev at ovs-netdev:
>   flows         : (current 0) (avg 0) (max 0) (limit 10000)
>   dump duration : 1ms
>   ufid enabled  : true
> 
>   54: (keys 0)
>   55: (keys 0)
>   56: (keys 0)
>   60: (keys 0)
>   61: (keys 0)
>   57: (keys 0)
>   59: (keys 0)
>   58: (keys 0)
> 
> (gdb)
> 
> Maybe you version of Python needs the python3 style iterator. Can you try the following?
> 
> diff --git a/utilities/gdb/ovs_gdb.py b/utilities/gdb/ovs_gdb.py
> index cb9778c..27b11ec 100644
> --- a/utilities/gdb/ovs_gdb.py
> +++ b/utilities/gdb/ovs_gdb.py
> @@ -346,7 +346,7 @@ class ForEachLIST():
>      def __iter__(self):
>          return self
> 
> -    def next(self):
> +    def __next__(self):
>          if self.list.address == self.node['next']:
>              raise StopIteration
> 
> @@ -359,6 +359,9 @@ class ForEachLIST():
>                              gdb.lookup_type(self.typeobj).pointer(),
>                              self.member)
> 
> +    def next(self):
> +        return self.__next__()
> +
> 
>  #
>  # Implements the GDB "ovs_dump_bridges" command
> 
> If this works I’ll sent out a patch to fix all iterators.
> 
> //Eelco
> 
> On 2 Jan 2019, at 11:50, solomon wrote:
> 
>> How can i use ovs_gdb.py normally?
>> When i use it, some errors happened.
>> Need to update python to version3.x?
>>
>> # python -V
>> Python 2.7.13
>>
>>
>> #(gdb) ovs_show_upcall
>> Python Exception <class 'TypeError'> iter() returned non-iterator of type 'ForEachLIST':
>> Error occurred in Python command: iter() returned non-iterator of type 'ForEachLIST'
>>
>> -- 
>>
>> Thanks
>> Solomon


More information about the discuss mailing list