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 2017/02/13 19:20:04 UTC

incubator-mynewt-core git commit: gdb macros - Include mbuf usrhdr in output.

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop f299c85b1 -> 85638d22a


gdb macros - Include mbuf usrhdr in output.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/85638d22
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/85638d22
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/85638d22

Branch: refs/heads/develop
Commit: 85638d22a98dc8b0c286b1d38e34b0e29c1c2e73
Parents: f299c85
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Feb 13 11:18:50 2017 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Feb 13 11:19:58 2017 -0800

----------------------------------------------------------------------
 compiler/gdbmacros/mbuf.gdb | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/85638d22/compiler/gdbmacros/mbuf.gdb
----------------------------------------------------------------------
diff --git a/compiler/gdbmacros/mbuf.gdb b/compiler/gdbmacros/mbuf.gdb
index 3bb81ad..738f4ae 100644
--- a/compiler/gdbmacros/mbuf.gdb
+++ b/compiler/gdbmacros/mbuf.gdb
@@ -51,6 +51,26 @@ Prints the packet header associated with the specified mbuf.  If the specified
 mbuf does not contain a packet header, the output is indeterminate.
 end
 
+define mn_mbuf_usrhdr_print
+    # Calculate address of user header.
+    set $data_addr = (uint8_t *)&($arg0)->om_data
+    set $phdr_addr = $data_addr + sizeof(struct os_mbuf)
+    set $uhdr_addr = $phdr_addr + sizeof(struct os_mbuf_pkthdr)
+
+    # Determine length of user header.
+    set $uhdr_len = $uhdr_addr - $phdr_addr
+
+    # Print header.
+    p/x *$uhdr_addr@$uhdr_len
+end
+
+document mn_mbuf_usrhdr_print
+usage: mn_mbuf_usrhdr_print <struct os_mbuf *>
+
+Prints the user header associated with the specified mbuf.  If the specified
+mbuf does not contain a user header, the output is indeterminate.
+end
+
 define mn_mbuf_print
     set $om = (struct os_mbuf *)($arg0)
 
@@ -61,6 +81,11 @@ define mn_mbuf_print
         printf "Packet header: "
         mn_mbuf_pkthdr_print $om
     end
+
+    if ($om)->om_pkthdr_len > sizeof (struct os_mbuf_pkthdr)
+        printf "User header: "
+        mn_mbuf_usrhdr_print $om
+    end
 end
 
 document mn_mbuf_print
@@ -154,17 +179,17 @@ Applies the mn_mbuf_print function to each element in the specified pool.  Both
 allocated and unallocated mbufs are printed.
 end
 
-document mn_mbuf_pool_print
+define mn_msys1_print
+    mn_mbuf_pool_print &os_msys_init_1_mbuf_pool 
+end
+
+document mn_msys1_print
 usage: mn_msys1_print
 
 Prints all mbufs in the first msys pool.  Both allocated and unallocated mbufs
 are printed.
 end
 
-define mn_msys1_print
-    mn_mbuf_pool_print &os_msys_init_1_mbuf_pool 
-end
-
 define mn_msys1_free_print
     set $om = os_msys_init_1_mempool.slh_first