Repository : ssh://git@open-mesh.org/doc
On branches: backup-redmine/2019-10-12,master
commit 06a29b34c6e903ac8c0f7d027c68fbac76d5866a Author: Sven Eckelmann sven@narfation.org Date: Sat Oct 12 00:35:18 2019 +0000
doc: open-mesh/Emulation_Debug
06a29b34c6e903ac8c0f7d027c68fbac76d5866a open-mesh/Emulation_Debug.textile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/open-mesh/Emulation_Debug.textile b/open-mesh/Emulation_Debug.textile index fc6bf14..2467a22 100644 --- a/open-mesh/Emulation_Debug.textile +++ b/open-mesh/Emulation_Debug.textile @@ -406,3 +406,19 @@ loading @0xffffffffa0000000: /home/sven/tmp/qemu-batman/batman-adv/net/batman-ad Breakpoint 1 at 0xffffffffa0005d60: file /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/bat_iv_ogm.c, line 1692. (gdb) c </pre> + +It is also possible to evaluate data structures in the gdb commandline using small python code blocks. To get for example the name of all devices which batman-adv knows about and the name of the batman-adv interface they belong to: + +<pre> +python +import linux.lists +from linux.utils import CachedType + +struct_batadv_hard_iface = CachedType('struct batadv_hard_iface').get_type().pointer() + +for node in linux.lists.list_for_each_entry(gdb.parse_and_eval("batadv_hardif_list"), struct_batadv_hard_iface, 'list'): + hardif = node['net_dev']['name'].string() + softif = node['soft_iface']['name'].string() if node['soft_iface'] else "none" + gdb.write("hardif {} belongs to {}\n".format(hardif, softif)) +end +</pre> \ No newline at end of file