1 /*	$OpenBSD: db_print.c,v 1.9 2003/07/08 16:57:20 mickey Exp $	*/
2 /*	$NetBSD: db_print.c,v 1.5 1996/02/05 01:57:11 christos Exp $	*/
3 
4 /*
5  * Mach Operating System
6  * Copyright (c) 1993,1992,1991,1990 Carnegie Mellon University
7  * All Rights Reserved.
8  *
9  * Permission to use, copy, modify and distribute this software and its
10  * documentation is hereby granted, provided that both the copyright
11  * notice and this permission notice appear in all copies of the
12  * software, derivative works or modified versions, and any portions
13  * thereof, and that both notices appear in supporting documentation.
14  *
15  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
17  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18  *
19  * Carnegie Mellon requests users of this software to return to
20  *
21  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
22  *  School of Computer Science
23  *  Carnegie Mellon University
24  *  Pittsburgh PA 15213-3890
25  *
26  * any improvements or extensions that they make and grant Carnegie Mellon
27  * the rights to redistribute these changes.
28  *
29  * 	Author: David B. Golub, Carnegie Mellon University
30  *	Date:	7/90
31  */
32 
33 /*
34  * Miscellaneous printing.
35  */
36 #include <sys/param.h>
37 #include <sys/proc.h>
38 
39 #include <uvm/uvm_extern.h>
40 
41 #include <machine/db_machdep.h>
42 
43 #include <ddb/db_lex.h>
44 #include <ddb/db_variables.h>
45 #include <ddb/db_sym.h>
46 #include <ddb/db_output.h>
47 #include <ddb/db_extern.h>
48 
49 /*ARGSUSED*/
50 void
db_show_regs(addr,have_addr,count,modif)51 db_show_regs(addr, have_addr, count, modif)
52 	db_expr_t	addr;
53 	int		have_addr;
54 	db_expr_t	count;
55 	char *		modif;
56 {
57 	register struct db_variable *regp;
58 	db_expr_t	value, offset;
59 	char *		name;
60 
61 	for (regp = db_regs; regp < db_eregs; regp++) {
62 	    db_read_variable(regp, &value);
63 	    db_printf("%-12s%#*ln", regp->name, (int)sizeof(long) * 3, (long)value);
64 	    db_find_xtrn_sym_and_offset((db_addr_t)value, &name, &offset);
65 	    if (name != 0 && offset <= db_maxoff && offset != value) {
66 		db_printf("\t%s", name);
67 		if (offset != 0)
68 		    db_printf("+%#lr", (long)offset);
69 	    }
70 	    db_printf("\n");
71 	}
72 	db_print_loc_and_inst(PC_REGS(DDB_REGS));
73 }
74