db_print.c revision 36197
1273562Smarcel/* 2273562Smarcel * Mach Operating System 3273562Smarcel * Copyright (c) 1991,1990 Carnegie Mellon University 4273562Smarcel * All Rights Reserved. 5273562Smarcel * 6273562Smarcel * Permission to use, copy, modify and distribute this software and its 7273562Smarcel * documentation is hereby granted, provided that both the copyright 8273562Smarcel * notice and this permission notice appear in all copies of the 9273562Smarcel * software, derivative works or modified versions, and any portions 10277353Smarcel * thereof, and that both notices appear in supporting documentation. 11273562Smarcel * 12273562Smarcel * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS 13273562Smarcel * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 14287111Smarcel * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 15287111Smarcel * 16282100Smarcel * Carnegie Mellon requests users of this software to return to 17273562Smarcel * 18273562Smarcel * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 19273562Smarcel * School of Computer Science 20273562Smarcel * Carnegie Mellon University 21273562Smarcel * Pittsburgh PA 15213-3890 22273562Smarcel * 23273562Smarcel * any improvements or extensions that they make and grant Carnegie the 24273562Smarcel * rights to redistribute these changes. 25273562Smarcel * 26273562Smarcel * $Id: db_print.c,v 1.15 1998/05/19 11:02:23 phk Exp $ 27273562Smarcel */ 28273562Smarcel 29273562Smarcel/* 30273562Smarcel * Author: David B. Golub, Carnegie Mellon University 31273562Smarcel * Date: 7/90 32273562Smarcel */ 33273562Smarcel 34273562Smarcel/* 35273562Smarcel * Miscellaneous printing. 36273562Smarcel */ 37273562Smarcel#include <sys/param.h> 38277353Smarcel#include <sys/kernel.h> 39282100Smarcel#include <sys/msgbuf.h> 40273562Smarcel 41273562Smarcel#include <ddb/ddb.h> 42273562Smarcel#include <ddb/db_variables.h> 43273562Smarcel#include <ddb/db_sym.h> 44277353Smarcel 45277353Smarcelvoid 46273562Smarceldb_show_regs(dummy1, dummy2, dummy3, dummy4) 47273562Smarcel db_expr_t dummy1; 48273562Smarcel boolean_t dummy2; 49273562Smarcel db_expr_t dummy3; 50273562Smarcel char * dummy4; 51273562Smarcel{ 52273562Smarcel register struct db_variable *regp; 53273562Smarcel db_expr_t value, offset; 54273562Smarcel char * name; 55273562Smarcel 56273562Smarcel for (regp = db_regs; regp < db_eregs; regp++) { 57273562Smarcel db_read_variable(regp, &value); 58273562Smarcel db_printf("%-12s%#10n", regp->name, value); 59273562Smarcel db_find_xtrn_sym_and_offset((db_addr_t)value, &name, &offset); 60273562Smarcel if (name != 0 && offset <= db_maxoff && offset != value) { 61273562Smarcel db_printf("\t%s", name); 62273562Smarcel if (offset != 0) 63282100Smarcel db_printf("+%+#n", offset); 64277353Smarcel } 65277353Smarcel db_printf("\n"); 66273562Smarcel } 67273562Smarcel db_print_loc_and_inst(PC_REGS(DDB_REGS)); 68273562Smarcel} 69273562Smarcel 70273562Smarcel 71273562SmarcelDB_SHOW_COMMAND(msgbuf, db_show_msgbuf) 72273562Smarcel{ 73273562Smarcel int i,j; 74273562Smarcel 75273562Smarcel if (!msgbufmapped) { 76273562Smarcel db_printf("msgbuf not mapped yet\n"); 77273562Smarcel return; 78273562Smarcel } 79273562Smarcel db_printf("msgbufp = %p\n", msgbufp); 80273562Smarcel db_printf("magic = %x, size = %d, r= %d, w = %d, ptr = %p\n", 81273562Smarcel msgbufp->msg_magic, 82273562Smarcel msgbufp->msg_size, 83273562Smarcel msgbufp->msg_bufr, 84273562Smarcel msgbufp->msg_bufx, 85273562Smarcel msgbufp->msg_ptr); 86273562Smarcel for (i = 0; i < msgbufp->msg_size; i++) { 87273562Smarcel j = msgbufp->msg_ptr[(i + msgbufp->msg_bufr) % msgbufp->msg_size]; 88273562Smarcel if (j) 89273562Smarcel db_printf("%c", j); 90273562Smarcel } 91273562Smarcel db_printf("\n"); 92273562Smarcel} 93273562Smarcel 94273562Smarcel