167761Smsmith/*- 267761Smsmith * Mach Operating System 367761Smsmith * Copyright (c) 1991,1990 Carnegie Mellon University 478991Smsmith * All Rights Reserved. 567761Smsmith * 667761Smsmith * Permission to use, copy, modify and distribute this software and its 767761Smsmith * documentation is hereby granted, provided that both the copyright 867761Smsmith * notice and this permission notice appear in all copies of the 967761Smsmith * software, derivative works or modified versions, and any portions 1067761Smsmith * thereof, and that both notices appear in supporting documentation. 1167761Smsmith * 1267761Smsmith * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS 1367761Smsmith * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 1467761Smsmith * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 1567761Smsmith * 1667761Smsmith * Carnegie Mellon requests users of this software to return to 1767761Smsmith * 1867761Smsmith * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 1967761Smsmith * School of Computer Science 2067761Smsmith * Carnegie Mellon University 2167761Smsmith * Pittsburgh PA 15213-3890 2267761Smsmith * 2367761Smsmith * any improvements or extensions that they make and grant Carnegie the 2467761Smsmith * rights to redistribute these changes. 2567761Smsmith * 2667761Smsmith */ 2767761Smsmith/* 2867761Smsmith * Author: David B. Golub, Carnegie Mellon University 2967761Smsmith * Date: 7/90 30143002Sobrien */ 31143002Sobrien 32143002Sobrien/* 3367761Smsmith * Miscellaneous printing. 3467761Smsmith */ 3567761Smsmith 3676166Smarkm#include <sys/cdefs.h> 37110894Stakawata__FBSDID("$FreeBSD$"); 3867761Smsmith 39129879Sphk#include <sys/param.h> 4067761Smsmith#include <sys/kdb.h> 4167761Smsmith#include <sys/proc.h> 4267761Smsmith 4367761Smsmith#include <machine/pcb.h> 4467761Smsmith 4567761Smsmith#include <ddb/ddb.h> 4686133Siwasaki#include <ddb/db_variables.h> 4785835Siwasaki#include <ddb/db_sym.h> 48123337Snjl 49189903Sjkimvoid 50127193Snjldb_show_regs(db_expr_t _1, boolean_t _2, db_expr_t _3, char *_4) 51189903Sjkim{ 5267761Smsmith struct db_variable *regp; 53181987Sjhb db_expr_t value, offset; 54181987Sjhb const char *name; 55181987Sjhb 5667761Smsmith for (regp = db_regs; regp < db_eregs; regp++) { 57122764Snjl if (!db_read_variable(regp, &value)) 58122764Snjl continue; 5982537Smsmith db_printf("%-12s%#10lr", regp->name, (unsigned long)value); 60131258Snjl db_find_xtrn_sym_and_offset((db_addr_t)value, &name, &offset); 6182537Smsmith if (name != NULL && offset <= (unsigned long)db_maxoff && 62193530Sjkim offset != value) { 63193530Sjkim db_printf("\t%s", name); 64193530Sjkim if (offset != 0) 65193530Sjkim db_printf("+%+#lr", (long)offset); 6667761Smsmith } 6767761Smsmith db_printf("\n"); 6867761Smsmith } 69167814Sjkim db_print_loc_and_inst(PC_REGS()); 70167814Sjkim} 71227293Sed