msgbuf revision 1.1
11.1Sjhawk# $NetBSD: msgbuf,v 1.1 2000/06/08 14:45:24 jhawk Exp $ 21.1Sjhawk# 31.1Sjhawk# Copyright (c) 2000 The NetBSD Foundation, Inc. 41.1Sjhawk# All rights reserved. 51.1Sjhawk# 61.1Sjhawk# This code is derived from software contributed to The NetBSD Foundation 71.1Sjhawk# by John A. Hawkinson 81.1Sjhawk# 91.1Sjhawk# Redistribution and use in source and binary forms, with or without 101.1Sjhawk# modification, are permitted provided that the following conditions 111.1Sjhawk# are met: 121.1Sjhawk# 1. Redistributions of source code must retain the above copyright 131.1Sjhawk# notice, this list of conditions and the following disclaimer. 141.1Sjhawk# 2. Redistributions in binary form must reproduce the above copyright 151.1Sjhawk# notice, this list of conditions and the following disclaimer in the 161.1Sjhawk# documentation and/or other materials provided with the distribution. 171.1Sjhawk# 3. All advertising materials mentioning features or use of this software 181.1Sjhawk# must display the following acknowledgement: 191.1Sjhawk# This product includes software developed by the NetBSD 201.1Sjhawk# Foundation, Inc. and its contributors. 211.1Sjhawk# 4. Neither the name of The NetBSD Foundation nor the names of its 221.1Sjhawk# contributors may be used to endorse or promote products derived 231.1Sjhawk# from this software without specific prior written permission. 241.1Sjhawk# 251.1Sjhawk# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 261.1Sjhawk# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 271.1Sjhawk# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 281.1Sjhawk# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 291.1Sjhawk# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 301.1Sjhawk# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 311.1Sjhawk# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 321.1Sjhawk# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 331.1Sjhawk# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 341.1Sjhawk# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 351.1Sjhawk# POSSIBILITY OF SUCH DAMAGE. 361.1Sjhawk# 371.1Sjhawk 381.1Sjhawkdefine msgbuf 391.1Sjhawk set $bufx=*(long*)(msgbufp+1*sizeof(long)) 401.1Sjhawk set $bufr=*(long*)(msgbufp+2*sizeof(long)) 411.1Sjhawk set $bufs=*(long*)(msgbufp+3*sizeof(long)) 421.1Sjhawk 431.1Sjhawk printf "msgbufp %#x: bufx %d bufr %d bufs %d\n", msgbufp, $bufx, $bufr, $bufs 441.1Sjhawk 451.1Sjhawk# Dump the unread section 461.1Sjhawk# set $l = $bufx - $bufr 471.1Sjhawk# if ($l < 0) 481.1Sjhawk# set $l = $bufs - $bufr 491.1Sjhawk# end 501.1Sjhawk# set $p = (long)msgbufp+4*sizeof(long)+$bufr 511.1Sjhawk# set print elements $l 521.1Sjhawk# x/s $p 531.1Sjhawk 541.1Sjhawk# Dump the whole thing 551.1Sjhawk# Presume each section is null-terminated. Possibly bad presumption? 561.1Sjhawk set $p = (long)msgbufp+4*sizeof(long)+$bufx 571.1Sjhawk set $l = $bufs - $bufx 581.1Sjhawk set print elements $l 591.1Sjhawk printf "Dumping %#x length %d\n", $p, $l 601.1Sjhawk # XXX (unsupported by gdb): printf "%.*s\n", $l, $p 611.1Sjhawk printf "%s\n", $p 621.1Sjhawk set $p = (long)msgbufp+4*sizeof(long) 631.1Sjhawk set $l = $bufx 641.1Sjhawk set print elements $l 651.1Sjhawk printf "Dumping %#x length %d\n", $p, $l 661.1Sjhawk # XXX (unsupported by gdb): printf "%.*s\n\n", $l, $p 671.1Sjhawk printf "%s\n\n", $p 681.1Sjhawkend 691.1Sjhawk 701.1Sjhawkdocument msgbuf 711.1Sjhawk Dump the kernel message buffer. 721.1Sjhawkend 73