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