148101Sbostic /*-
2*62133Sbostic  * Copyright (c) 1980, 1993
3*62133Sbostic  *	The Regents of the University of California.  All rights reserved.
448101Sbostic  *
548101Sbostic  * %sccs.include.redist.c%
622365Sdist  */
75479Slinton 
822365Sdist #ifndef lint
9*62133Sbostic static char sccsid[] = "@(#)printdata.c	8.1 (Berkeley) 06/06/93";
1048101Sbostic #endif /* not lint */
1148101Sbostic 
125479Slinton /*
135479Slinton  * print contents of data addresses in octal
145479Slinton  *
155479Slinton  * There are two entries:  one is given a range of addresses,
165479Slinton  * the other is given a count and a starting address.
175479Slinton  */
185479Slinton 
195479Slinton #include "defs.h"
205479Slinton #include "machine.h"
215479Slinton #include "process.h"
225479Slinton #include "object.h"
2330845Smckusick #include "process/process.rep"
2430845Smckusick #include "process/pxinfo.h"
255479Slinton 
265479Slinton #define WORDSPERLINE 4
275479Slinton 
285479Slinton /*
295479Slinton  * print words from lowaddr to highaddr
305479Slinton  */
315479Slinton 
printdata(lowaddr,highaddr)325479Slinton printdata(lowaddr, highaddr)
335479Slinton ADDRESS lowaddr;
345479Slinton ADDRESS highaddr;
355479Slinton {
365479Slinton 	register int count;
375479Slinton 	register ADDRESS addr;
385479Slinton 	int val;
395479Slinton 
405479Slinton 	if (lowaddr > highaddr) {
415479Slinton 		error("first address larger than second");
425479Slinton 	}
435479Slinton 	count = 0;
445479Slinton 	for (addr = lowaddr; addr <= highaddr; addr += sizeof(int)) {
455479Slinton 		if (count == 0) {
465479Slinton 			printf("%8x: ", addr);
475479Slinton 		}
485479Slinton 		dread(&val, addr, sizeof(val));
495479Slinton 		printf("  %8x", val);
505479Slinton 		if (++count >= WORDSPERLINE) {
515479Slinton 			putchar('\n');
525479Slinton 			count = 0;
535479Slinton 		}
545479Slinton 	}
555479Slinton 	if (count != 0) {
565479Slinton 		putchar('\n');
575479Slinton 	}
585479Slinton }
59