[ovs-dev] GDB macro's for Open vSwitch

Eelco Chaudron echaudro at redhat.com
Wed Apr 25 16:12:03 UTC 2018


Hi All,

I could not find any GDB macros or commands in the OVS project, and as I 
was debugging some vague crash I started to create some.

As I was trying to do this while debugging I copied some code from the 
Linux debug commands, so I had to use the same GPL2 license.

You can find the commands on GitHub, 
https://github.com/chaudron/gdb_commands/blob/master/ovs_GDB.py

I'm ok with including them in the OVS distribution if others find them 
useful, but not sure how this works with the GPL2 license.

The commands added to GDB are:

- ovs_dump_bridge [ports|wanted]
- ovs_dump_bridge_ports <struct bridge *>
- ovs_dump_dp_netdev [ports]
- ovs_dump_dp_netdev_ports <struct dp_netdev *>
- ovs_dump_netdev

These dump functions show limited info, but you can simply cut/paste the 
address and get the full structure info. For example:

(gdb) ovs_dump_netdev
(struct netdev *) 0x555771ed89e0: name = ovs-netdev     , 
auto_classified = false, netdev_class = 0x5557714413c0 <netdev_tap_class>
(struct netdev *) 0x555771fc62a0: name = ovs_pvp_br0    , 
auto_classified = false, netdev_class = 0x5557714413c0 <netdev_tap_class>
(struct netdev *) 0x555771fc9660: name = vnet0          , 
auto_classified = true , netdev_class = 0x555771445e00 <netdev_linux_class>
(struct netdev *) 0x555771fc78d0: name = virbr0         , 
auto_classified = true , netdev_class = 0x555771445e00 <netdev_linux_class>
(struct netdev *) 0x7fbefffb5540: name = dpdk0          , 
auto_classified = false, netdev_class = 0x5557714419e0 <dpdk_class>
(struct netdev *) 0x555771fc98b0: name = em3            , 
auto_classified = true , netdev_class = 0x555771445e00 <netdev_linux_class>
(struct netdev *) 0x7fbea0a31c40: name = vhost0         , 
auto_classified = false, netdev_class = 0x555771442040 
<dpdk_vhost_client_class>

(gdb) p *((struct netdev *) 0x7fbefffb5540)
$1 = {name = 0x555771ecef70 "dpdk0", netdev_class = 0x5557714419e0 
<dpdk_class>, auto_classified = false, mtu_user_config = true, ref_cnt = 
2, change_seq = 12,
   reconfigure_seq = 0x555771ecf2e0, last_reconfigure_seq = 110, n_txq = 
2, n_rxq = 1, node = 0x555771efafe0, saved_flags_list = {prev = 
0x7fbefffb5580, next = 0x7fbefffb5580}}


Enjoy!

//Eelco



More information about the dev mailing list