11.5Smartin# $NetBSD: msgbuf,v 1.5 2008/04/30 13:10:59 martin 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# 181.1Sjhawk# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 191.1Sjhawk# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 201.1Sjhawk# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 211.1Sjhawk# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 221.1Sjhawk# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 231.1Sjhawk# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 241.1Sjhawk# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 251.1Sjhawk# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 261.1Sjhawk# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 271.1Sjhawk# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 281.1Sjhawk# POSSIBILITY OF SUCH DAMAGE. 291.1Sjhawk# 301.1Sjhawk 311.1Sjhawkdefine msgbuf 321.2Sdeberg set $bufx=*(long*)((char *)msgbufp+1*sizeof(long)) 331.2Sdeberg set $bufr=*(long*)((char *)msgbufp+2*sizeof(long)) 341.2Sdeberg set $bufs=*(long*)((char *)msgbufp+3*sizeof(long)) 351.1Sjhawk 361.1Sjhawk printf "msgbufp %#x: bufx %d bufr %d bufs %d\n", msgbufp, $bufx, $bufr, $bufs 371.1Sjhawk 381.1Sjhawk# Dump the unread section 391.1Sjhawk# set $l = $bufx - $bufr 401.1Sjhawk# if ($l < 0) 411.1Sjhawk# set $l = $bufs - $bufr 421.1Sjhawk# end 431.1Sjhawk# set $p = (long)msgbufp+4*sizeof(long)+$bufr 441.1Sjhawk# set print elements $l 451.1Sjhawk# x/s $p 461.1Sjhawk 471.1Sjhawk# Dump the whole thing 481.1Sjhawk# Presume each section is null-terminated. Possibly bad presumption? 491.1Sjhawk set $p = (long)msgbufp+4*sizeof(long)+$bufx 501.1Sjhawk set $l = $bufs - $bufx 511.1Sjhawk set print elements $l 521.3Sperry printf "Dumping %#x length %d\n", $p, $l 531.1Sjhawk # XXX (unsupported by gdb): printf "%.*s\n", $l, $p 541.1Sjhawk printf "%s\n", $p 551.1Sjhawk set $p = (long)msgbufp+4*sizeof(long) 561.1Sjhawk set $l = $bufx 571.1Sjhawk set print elements $l 581.3Sperry printf "Dumping %#x length %d\n", $p, $l 591.1Sjhawk # XXX (unsupported by gdb): printf "%.*s\n\n", $l, $p 601.1Sjhawk printf "%s\n\n", $p 611.1Sjhawkend 621.1Sjhawk 631.1Sjhawkdocument msgbuf 641.1Sjhawk Dump the kernel message buffer. 651.1Sjhawkend 66