1*22365Sdist /* 2*22365Sdist * Copyright (c) 1980 Regents of the University of California. 3*22365Sdist * All rights reserved. The Berkeley software License Agreement 4*22365Sdist * specifies the terms and conditions for redistribution. 5*22365Sdist */ 65479Slinton 7*22365Sdist #ifndef lint 8*22365Sdist static char sccsid[] = "@(#)printdata.c 5.1 (Berkeley) 06/06/85"; 9*22365Sdist #endif not lint 105479Slinton /* 115479Slinton * print contents of data addresses in octal 125479Slinton * 135479Slinton * There are two entries: one is given a range of addresses, 145479Slinton * the other is given a count and a starting address. 155479Slinton */ 165479Slinton 175479Slinton #include "defs.h" 185479Slinton #include "machine.h" 195479Slinton #include "process.h" 205479Slinton #include "object.h" 215479Slinton 225479Slinton #define WORDSPERLINE 4 235479Slinton 245479Slinton /* 255479Slinton * print words from lowaddr to highaddr 265479Slinton */ 275479Slinton 285479Slinton printdata(lowaddr, highaddr) 295479Slinton ADDRESS lowaddr; 305479Slinton ADDRESS highaddr; 315479Slinton { 325479Slinton register int count; 335479Slinton register ADDRESS addr; 345479Slinton int val; 355479Slinton 365479Slinton if (lowaddr > highaddr) { 375479Slinton error("first address larger than second"); 385479Slinton } 395479Slinton count = 0; 405479Slinton for (addr = lowaddr; addr <= highaddr; addr += sizeof(int)) { 415479Slinton if (count == 0) { 425479Slinton printf("%8x: ", addr); 435479Slinton } 445479Slinton dread(&val, addr, sizeof(val)); 455479Slinton printf(" %8x", val); 465479Slinton if (++count >= WORDSPERLINE) { 475479Slinton putchar('\n'); 485479Slinton count = 0; 495479Slinton } 505479Slinton } 515479Slinton if (count != 0) { 525479Slinton putchar('\n'); 535479Slinton } 545479Slinton } 555479Slinton 565479Slinton /* 575479Slinton * print count words starting at address 585479Slinton */ 595479Slinton 605479Slinton printndata(count, addr) 615479Slinton int count; 625479Slinton ADDRESS addr; 635479Slinton { 645479Slinton printdata(addr, addr + (count - 1)*sizeof(int)); 655479Slinton } 66