On Mon, Mar 07, 2016 at 01:41:20PM +0100, Martin Pieuchot wrote: > Make this function local to db_command.c and get rid of db_print.c while > here. > > It'll take longer than expected to tweak it to display any trapframe. > > ok?
reads ok to me > > Index: ddb/db_command.c > =================================================================== > RCS file: /cvs/src/sys/ddb/db_command.c,v > retrieving revision 1.68 > diff -u -p -r1.68 db_command.c > --- ddb/db_command.c 25 Jan 2016 14:30:30 -0000 1.68 > +++ ddb/db_command.c 7 Mar 2016 12:07:58 -0000 > @@ -49,6 +49,7 @@ > #include <ddb/db_break.h> > #include <ddb/db_watch.h> > #include <ddb/db_run.h> > +#include <ddb/db_sym.h> > #include <ddb/db_variables.h> > #include <ddb/db_interface.h> > #include <ddb/db_extern.h> > @@ -75,6 +76,8 @@ db_addr_t db_prev; /* last address exami > db_addr_t db_next; /* next address to be examined > or written */ > > +void db_show_regs(db_expr_t, boolean_t, db_expr_t, char *); > + > /* > * Utility routine - discard tokens through end-of-line. > */ > @@ -788,4 +791,28 @@ db_stack_trace_cmd(db_expr_t addr, boole > char *modif) > { > db_stack_trace_print(addr, have_addr, count, modif, db_printf); > +} > + > +void > +db_show_regs(db_expr_t addr, int have_addr, db_expr_t count, char *modif) > +{ > + struct db_variable *regp; > + db_expr_t value, offset; > + char * name; > + char tmpfmt[28]; > + > + for (regp = db_regs; regp < db_eregs; regp++) { > + db_read_variable(regp, &value); > + db_printf("%-12s%s", regp->name, db_format(tmpfmt, sizeof tmpfmt, > + (long)value, DB_FORMAT_N, 1, sizeof(long) * 3)); > + db_find_xtrn_sym_and_offset((db_addr_t)value, &name, &offset); > + if (name != 0 && offset <= db_maxoff && offset != value) { > + db_printf("\t%s", name); > + if (offset != 0) > + db_printf("+%s", db_format(tmpfmt, sizeof tmpfmt, > + (long)offset, DB_FORMAT_R, 1, 0)); > + } > + db_printf("\n"); > + } > + db_print_loc_and_inst(PC_REGS(&ddb_regs)); > } > Index: ddb/db_extern.h > =================================================================== > RCS file: /cvs/src/sys/ddb/db_extern.h,v > retrieving revision 1.13 > diff -u -p -r1.13 db_extern.h > --- ddb/db_extern.h 6 Jul 2006 18:14:14 -0000 1.13 > +++ ddb/db_extern.h 7 Mar 2016 12:07:20 -0000 > @@ -63,9 +63,6 @@ void db_delete_line(void); > int db_inputchar(int); > int db_readline(char *, int); > > -/* db_print.c */ > -void db_show_regs(db_expr_t, boolean_t, db_expr_t, char *); > - > /* db_trap.c */ > void db_trap(int, int); > > Index: ddb/db_print.c > =================================================================== > RCS file: ddb/db_print.c > diff -N ddb/db_print.c > --- ddb/db_print.c 6 Mar 2016 13:33:21 -0000 1.17 > +++ /dev/null 1 Jan 1970 00:00:00 -0000 > @@ -1,69 +0,0 @@ > -/* $OpenBSD: db_print.c,v 1.17 2016/03/06 13:33:21 mpi Exp $ */ > -/* $NetBSD: db_print.c,v 1.5 1996/02/05 01:57:11 christos Exp $ */ > - > -/* > - * Mach Operating System > - * Copyright (c) 1993,1992,1991,1990 Carnegie Mellon University > - * All Rights Reserved. > - * > - * Permission to use, copy, modify and distribute this software and its > - * documentation is hereby granted, provided that both the copyright > - * notice and this permission notice appear in all copies of the > - * software, derivative works or modified versions, and any portions > - * thereof, and that both notices appear in supporting documentation. > - * > - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" > - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR > - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. > - * > - * Carnegie Mellon requests users of this software to return to > - * > - * Software Distribution Coordinator or software.distribut...@cs.cmu.edu > - * School of Computer Science > - * Carnegie Mellon University > - * Pittsburgh PA 15213-3890 > - * > - * any improvements or extensions that they make and grant Carnegie Mellon > - * the rights to redistribute these changes. > - * > - * Author: David B. Golub, Carnegie Mellon University > - * Date: 7/90 > - */ > - > -/* > - * Miscellaneous printing. > - */ > -#include <sys/param.h> > -#include <sys/systm.h> > - > -#include <machine/db_machdep.h> > - > -#include <ddb/db_variables.h> > -#include <ddb/db_sym.h> > -#include <ddb/db_output.h> > -#include <ddb/db_extern.h> > - > -/*ARGSUSED*/ > -void > -db_show_regs(db_expr_t addr, int have_addr, db_expr_t count, char *modif) > -{ > - struct db_variable *regp; > - db_expr_t value, offset; > - char * name; > - char tmpfmt[28]; > - > - for (regp = db_regs; regp < db_eregs; regp++) { > - db_read_variable(regp, &value); > - db_printf("%-12s%s", regp->name, db_format(tmpfmt, sizeof tmpfmt, > - (long)value, DB_FORMAT_N, 1, sizeof(long) * 3)); > - db_find_xtrn_sym_and_offset((db_addr_t)value, &name, &offset); > - if (name != 0 && offset <= db_maxoff && offset != value) { > - db_printf("\t%s", name); > - if (offset != 0) > - db_printf("+%s", db_format(tmpfmt, sizeof tmpfmt, > - (long)offset, DB_FORMAT_R, 1, 0)); > - } > - db_printf("\n"); > - } > - db_print_loc_and_inst(PC_REGS(&ddb_regs)); > -} >