db_print.c revision 1.2.4.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 * $Id: db_print.c,v 1.2.4.1 1993/11/14 22:48:37 mycroft Exp $
28 *
29 * HISTORY
30 * $Log: db_print.c,v $
31 * Revision 1.2.4.1 1993/11/14 22:48:37 mycroft
32 * Canonicalize all #includes.
33 *
34 * Revision 1.2 1993/05/20 03:39:25 cgd
35 * add explicit rcs id
36 *
37 * Revision 1.1.1.1 1993/03/21 09:46:27 cgd
38 * initial import of 386bsd-0.1 sources
39 *
40 * Revision 1.1 1992/03/25 21:45:22 pace
41 * Initial revision
42 *
43 * Revision 2.5 91/02/05 17:06:53 mrt
44 * Changed to new Mach copyright
45 * [91/01/31 16:18:56 mrt]
46 *
47 * Revision 2.4 90/10/25 14:43:54 rwd
48 * Changed db_show_regs to print unsigned.
49 * [90/10/19 rpd]
50 * Generalized the watchpoint support.
51 * [90/10/16 rwd]
52 *
53 * Revision 2.3 90/09/09 23:19:52 rpd
54 * Avoid totally incorrect guesses of symbol names for small values.
55 * [90/08/30 17:39:08 af]
56 *
57 * Revision 2.2 90/08/27 21:51:49 dbg
58 * Insist that 'show thread' be called with an explicit address.
59 * [90/08/22 dbg]
60 *
61 * Fix type for db_maxoff.
62 * [90/08/20 dbg]
63 *
64 * Do not dereference the "valuep" field of a variable directly,
65 * call the new db_read/write_variable functions instead.
66 * Reflected changes in symbol lookup functions.
67 * [90/08/20 af]
68 * Reduce lint.
69 * [90/08/10 14:33:44 dbg]
70 *
71 * Created.
72 * [90/07/25 dbg]
73 *
74 */
75 /*
76 * Author: David B. Golub, Carnegie Mellon University
77 * Date: 7/90
78 */
79
80 /*
81 * Miscellaneous printing.
82 */
83 #include <sys/param.h>
84 #include <sys/proc.h>
85 #include <machine/db_machdep.h>
86
87 #include <ddb/db_lex.h>
88 #include <ddb/db_variables.h>
89 #include <ddb/db_sym.h>
90
91 extern unsigned int db_maxoff;
92
93 void
94 db_show_regs()
95 {
96 int (*func)();
97 register struct db_variable *regp;
98 db_expr_t value, offset;
99 char * name;
100
101 for (regp = db_regs; regp < db_eregs; regp++) {
102 db_read_variable(regp, &value);
103 db_printf("%-12s%#10n", regp->name, value);
104 db_find_xtrn_sym_and_offset((db_addr_t)value, &name, &offset);
105 if (name != 0 && offset <= db_maxoff && offset != value) {
106 db_printf("\t%s", name);
107 if (offset != 0)
108 db_printf("+%#r", offset);
109 }
110 db_printf("\n");
111 }
112 db_print_loc_and_inst(PC_REGS(DDB_REGS));
113 }
114
115