1 /* $OpenBSD: db_print.c,v 1.10 2006/03/13 06:23:20 jsg 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
51 db_show_regs(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
52 {
53 struct db_variable *regp;
54 db_expr_t value, offset;
55 char * name;
56
57 for (regp = db_regs; regp < db_eregs; regp++) {
58 db_read_variable(regp, &value);
59 db_printf("%-12s%#*ln", regp->name, sizeof(long) * 3, (long)value);
60 db_find_xtrn_sym_and_offset((db_addr_t)value, &name, &offset);
61 if (name != 0 && offset <= db_maxoff && offset != value) {
62 db_printf("\t%s", name);
63 if (offset != 0)
64 db_printf("+%#lr", (long)offset);
65 }
66 db_printf("\n");
67 }
68 db_print_loc_and_inst(PC_REGS(DDB_REGS));
69 }