db_print.c revision 1.1 1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie the
24 * rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: db_print.c,v $
29 * Revision 1.1 1993/03/21 09:45:37 cgd
30 * Initial revision
31 *
32 * Revision 1.1 1992/03/25 21:45:22 pace
33 * Initial revision
34 *
35 * Revision 2.5 91/02/05 17:06:53 mrt
36 * Changed to new Mach copyright
37 * [91/01/31 16:18:56 mrt]
38 *
39 * Revision 2.4 90/10/25 14:43:54 rwd
40 * Changed db_show_regs to print unsigned.
41 * [90/10/19 rpd]
42 * Generalized the watchpoint support.
43 * [90/10/16 rwd]
44 *
45 * Revision 2.3 90/09/09 23:19:52 rpd
46 * Avoid totally incorrect guesses of symbol names for small values.
47 * [90/08/30 17:39:08 af]
48 *
49 * Revision 2.2 90/08/27 21:51:49 dbg
50 * Insist that 'show thread' be called with an explicit address.
51 * [90/08/22 dbg]
52 *
53 * Fix type for db_maxoff.
54 * [90/08/20 dbg]
55 *
56 * Do not dereference the "valuep" field of a variable directly,
57 * call the new db_read/write_variable functions instead.
58 * Reflected changes in symbol lookup functions.
59 * [90/08/20 af]
60 * Reduce lint.
61 * [90/08/10 14:33:44 dbg]
62 *
63 * Created.
64 * [90/07/25 dbg]
65 *
66 */
67 /*
68 * Author: David B. Golub, Carnegie Mellon University
69 * Date: 7/90
70 */
71
72 /*
73 * Miscellaneous printing.
74 */
75 #include "param.h"
76 #include "proc.h"
77
78 #include <machine/db_machdep.h>
79
80 #include <ddb/db_lex.h>
81 #include <ddb/db_variables.h>
82 #include <ddb/db_sym.h>
83
84 extern unsigned int db_maxoff;
85
86 void
87 db_show_regs()
88 {
89 int (*func)();
90 register struct db_variable *regp;
91 db_expr_t value, offset;
92 char * name;
93
94 for (regp = db_regs; regp < db_eregs; regp++) {
95 db_read_variable(regp, &value);
96 db_printf("%-12s%#10n", regp->name, value);
97 db_find_xtrn_sym_and_offset((db_addr_t)value, &name, &offset);
98 if (name != 0 && offset <= db_maxoff && offset != value) {
99 db_printf("\t%s", name);
100 if (offset != 0)
101 db_printf("+%#r", offset);
102 }
103 db_printf("\n");
104 }
105 db_print_loc_and_inst(PC_REGS(DDB_REGS));
106 }
107
108