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

Eelco Chaudron echaudro at redhat.com
Wed Jan 2 12:22:27 UTC 2019


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