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