Repository : ssh://git@diktynna/doc
On branches: backup-redmine/2021-08-07,backup-redmine/2021-09-11,backup-redmine/2021-10-09,backup-redmine/2021-11-13,backup-redmine/2021-12-11,backup-redmine/2022-01-08,backup-redmine/2022-02-12,backup-redmine/2022-03-12,backup-redmine/2022-04-09,backup-redmine/2022-05-07,backup-redmine/2022-06-11,backup-redmine/2022-08-06,backup-redmine/2022-10-07,backup-redmine/2022-11-14,backup-redmine/2023-01-14,main
commit 9443723200bf23a5e047f972bd84d48345055cdb Author: Sven Eckelmann sven@narfation.org Date: Thu Jul 22 10:38:43 2021 +0000
doc: open-mesh/GDB_Linux_snippets
9443723200bf23a5e047f972bd84d48345055cdb open-mesh/GDB_Linux_snippets.textile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/open-mesh/GDB_Linux_snippets.textile b/open-mesh/GDB_Linux_snippets.textile new file mode 100644 index 00000000..7a2cc865 --- /dev/null +++ b/open-mesh/GDB_Linux_snippets.textile @@ -0,0 +1,19 @@ +h1. GDB Linux snippets + +h2. Python datastructure helper + +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, just enter following in the initialized, interrupted gdb session: + +<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