summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-08-26 09:20:58 +0200
committerGitHub <noreply@github.com>2022-08-26 09:20:58 +0200
commit182351086273c56cbf60bd2bbbe43bb7f174d0ae (patch)
tree2ef3272ac983d74fdf9d61c35e06abfc7f254545
parentMerge pull request #11862 from sri-mohan1/sri-ospf-dbg1 (diff)
parentgdb: Add a macro to walk memory allocations (diff)
downloadfrr-182351086273c56cbf60bd2bbbe43bb7f174d0ae.tar.xz
frr-182351086273c56cbf60bd2bbbe43bb7f174d0ae.zip
Merge pull request #11854 from donaldsharp/memory_walk_in_gdb
gdb: Add a macro to walk memory allocations
-rw-r--r--gdb/lib.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/gdb/lib.txt b/gdb/lib.txt
index 913b455ed..b44c23798 100644
--- a/gdb/lib.txt
+++ b/gdb/lib.txt
@@ -293,3 +293,25 @@ Arguments:
1st: A (struct route_node *) to the top of the route table.
2nd: The (struct route_node *) to walk up from
end
+
+define mq_walk
+ set $mg = (struct memgroup *)$arg0
+
+ while ($mg)
+ printf "showing active allocations in memory group %s\n", $mg->name
+ set $mt = (struct memtype *)$mg->types
+ while ($mt)
+ printf "memstats: %s:%zu\n", $mt->name, $mt->n_alloc
+ set $mt = $mt->next
+ end
+ set $mg = $mg->next
+ end
+
+document mg_walk
+Walk the memory data structures to show what is holding memory.
+
+Arguments:
+1st: A (struct memgroup *) where to start the walk. If you are not
+ sure where to start pass it mg_first, which is a global DS for
+ all memory allocated in FRR
+end