1 1.5 martin # $NetBSD: msgbuf,v 1.5 2008/04/30 13:10:59 martin Exp $ 2 1.1 jhawk # 3 1.1 jhawk # Copyright (c) 2000 The NetBSD Foundation, Inc. 4 1.1 jhawk # All rights reserved. 5 1.1 jhawk # 6 1.1 jhawk # This code is derived from software contributed to The NetBSD Foundation 7 1.1 jhawk # by John A. Hawkinson 8 1.1 jhawk # 9 1.1 jhawk # Redistribution and use in source and binary forms, with or without 10 1.1 jhawk # modification, are permitted provided that the following conditions 11 1.1 jhawk # are met: 12 1.1 jhawk # 1. Redistributions of source code must retain the above copyright 13 1.1 jhawk # notice, this list of conditions and the following disclaimer. 14 1.1 jhawk # 2. Redistributions in binary form must reproduce the above copyright 15 1.1 jhawk # notice, this list of conditions and the following disclaimer in the 16 1.1 jhawk # documentation and/or other materials provided with the distribution. 17 1.1 jhawk # 18 1.1 jhawk # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19 1.1 jhawk # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 1.1 jhawk # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 1.1 jhawk # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 1.1 jhawk # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 1.1 jhawk # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 1.1 jhawk # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 1.1 jhawk # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 1.1 jhawk # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 1.1 jhawk # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 1.1 jhawk # POSSIBILITY OF SUCH DAMAGE. 29 1.1 jhawk # 30 1.1 jhawk 31 1.1 jhawk define msgbuf 32 1.2 deberg set $bufx=*(long*)((char *)msgbufp+1*sizeof(long)) 33 1.2 deberg set $bufr=*(long*)((char *)msgbufp+2*sizeof(long)) 34 1.2 deberg set $bufs=*(long*)((char *)msgbufp+3*sizeof(long)) 35 1.1 jhawk 36 1.1 jhawk printf "msgbufp %#x: bufx %d bufr %d bufs %d\n", msgbufp, $bufx, $bufr, $bufs 37 1.1 jhawk 38 1.1 jhawk # Dump the unread section 39 1.1 jhawk # set $l = $bufx - $bufr 40 1.1 jhawk # if ($l < 0) 41 1.1 jhawk # set $l = $bufs - $bufr 42 1.1 jhawk # end 43 1.1 jhawk # set $p = (long)msgbufp+4*sizeof(long)+$bufr 44 1.1 jhawk # set print elements $l 45 1.1 jhawk # x/s $p 46 1.1 jhawk 47 1.1 jhawk # Dump the whole thing 48 1.1 jhawk # Presume each section is null-terminated. Possibly bad presumption? 49 1.1 jhawk set $p = (long)msgbufp+4*sizeof(long)+$bufx 50 1.1 jhawk set $l = $bufs - $bufx 51 1.1 jhawk set print elements $l 52 1.3 perry printf "Dumping %#x length %d\n", $p, $l 53 1.1 jhawk # XXX (unsupported by gdb): printf "%.*s\n", $l, $p 54 1.1 jhawk printf "%s\n", $p 55 1.1 jhawk set $p = (long)msgbufp+4*sizeof(long) 56 1.1 jhawk set $l = $bufx 57 1.1 jhawk set print elements $l 58 1.3 perry printf "Dumping %#x length %d\n", $p, $l 59 1.1 jhawk # XXX (unsupported by gdb): printf "%.*s\n\n", $l, $p 60 1.1 jhawk printf "%s\n\n", $p 61 1.1 jhawk end 62 1.1 jhawk 63 1.1 jhawk document msgbuf 64 1.1 jhawk Dump the kernel message buffer. 65 1.1 jhawk end 66