1 /* 2 * Copyright (c) 1980 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 */ 6 7 #ifndef lint 8 static char sccsid[] = "@(#)printdata.c 5.1 (Berkeley) 06/06/85"; 9 #endif not lint 10 /* 11 * print contents of data addresses in octal 12 * 13 * There are two entries: one is given a range of addresses, 14 * the other is given a count and a starting address. 15 */ 16 17 #include "defs.h" 18 #include "machine.h" 19 #include "process.h" 20 #include "object.h" 21 22 #define WORDSPERLINE 4 23 24 /* 25 * print words from lowaddr to highaddr 26 */ 27 28 printdata(lowaddr, highaddr) 29 ADDRESS lowaddr; 30 ADDRESS highaddr; 31 { 32 register int count; 33 register ADDRESS addr; 34 int val; 35 36 if (lowaddr > highaddr) { 37 error("first address larger than second"); 38 } 39 count = 0; 40 for (addr = lowaddr; addr <= highaddr; addr += sizeof(int)) { 41 if (count == 0) { 42 printf("%8x: ", addr); 43 } 44 dread(&val, addr, sizeof(val)); 45 printf(" %8x", val); 46 if (++count >= WORDSPERLINE) { 47 putchar('\n'); 48 count = 0; 49 } 50 } 51 if (count != 0) { 52 putchar('\n'); 53 } 54 } 55 56 /* 57 * print count words starting at address 58 */ 59 60 printndata(count, addr) 61 int count; 62 ADDRESS addr; 63 { 64 printdata(addr, addr + (count - 1)*sizeof(int)); 65 } 66