122365Sdist /*
222365Sdist  * Copyright (c) 1980 Regents of the University of California.
322365Sdist  * All rights reserved.  The Berkeley software License Agreement
422365Sdist  * specifies the terms and conditions for redistribution.
522365Sdist  */
65479Slinton 
722365Sdist #ifndef lint
8*30845Smckusick static char sccsid[] = "@(#)printdata.c	5.2 (Berkeley) 04/07/87";
922365Sdist #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"
21*30845Smckusick #include "process/process.rep"
22*30845Smckusick #include "process/pxinfo.h"
235479Slinton 
245479Slinton #define WORDSPERLINE 4
255479Slinton 
265479Slinton /*
275479Slinton  * print words from lowaddr to highaddr
285479Slinton  */
295479Slinton 
305479Slinton printdata(lowaddr, highaddr)
315479Slinton ADDRESS lowaddr;
325479Slinton ADDRESS highaddr;
335479Slinton {
345479Slinton 	register int count;
355479Slinton 	register ADDRESS addr;
365479Slinton 	int val;
375479Slinton 
385479Slinton 	if (lowaddr > highaddr) {
395479Slinton 		error("first address larger than second");
405479Slinton 	}
415479Slinton 	count = 0;
425479Slinton 	for (addr = lowaddr; addr <= highaddr; addr += sizeof(int)) {
435479Slinton 		if (count == 0) {
445479Slinton 			printf("%8x: ", addr);
455479Slinton 		}
465479Slinton 		dread(&val, addr, sizeof(val));
475479Slinton 		printf("  %8x", val);
485479Slinton 		if (++count >= WORDSPERLINE) {
495479Slinton 			putchar('\n');
505479Slinton 			count = 0;
515479Slinton 		}
525479Slinton 	}
535479Slinton 	if (count != 0) {
545479Slinton 		putchar('\n');
555479Slinton 	}
565479Slinton }
57