You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2019/10/11 00:58:20 UTC

[mynewt-core] 02/04: mbuf.gdb: mn_mbuf_pool_dump macro

This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 4a2987d65455c179ff2be5bb6eeef71c66fda804
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Thu Oct 10 12:18:48 2019 -0700

    mbuf.gdb: mn_mbuf_pool_dump macro
    
    usage: mn_mbuf_pool_dump <struct os_mbuf_pool *>
    
    Applies the mn_mbuf_dump function to each element in the specified pool.
    Both allocated and unallocated mbufs are dumped.
---
 compiler/gdbmacros/mbuf.gdb | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/compiler/gdbmacros/mbuf.gdb b/compiler/gdbmacros/mbuf.gdb
index b1713bc..688825e 100644
--- a/compiler/gdbmacros/mbuf.gdb
+++ b/compiler/gdbmacros/mbuf.gdb
@@ -185,6 +185,26 @@ Applies the mn_mbuf_print function to each element in the specified pool.  Both
 allocated and unallocated mbufs are printed.
 end
 
+define mn_mbuf_pool_dump
+    set $pool = ($arg0)
+    set $om = (struct os_mbuf *)$pool->omp_pool.mp_membuf_addr
+    set $elem_size = $pool->omp_databuf_len + sizeof (struct os_mbuf)
+    set $end = (uint8_t *)$om + $pool->omp_pool.mp_num_blocks * $elem_size
+
+    while $om < $end
+        printf "Mbuf addr: %p\n", $om
+        mn_mbuf_dump $om
+        set $om = (struct os_mbuf *)((uint8_t *)$om + $elem_size)
+    end
+end
+
+document mn_mbuf_pool_dump
+usage: mn_mbuf_pool_dump <struct os_mbuf_pool *>
+
+Applies the mn_mbuf_dump function to each element in the specified pool.  Both
+allocated and unallocated mbufs are dumped.
+end
+
 define mn_msys1_print
     mn_mbuf_pool_print &os_msys_1_mbuf_pool
 end