Module Name: src Committed By: skrll Date: Tue Mar 2 20:40:16 UTC 2010
Modified Files: src/sys/arch/hppa/conf: files.hppa src/sys/arch/hppa/include: db_machdep.h Added Files: src/sys/arch/hppa/hppa: db_machdep.c Log Message: Add a "mach frame" command to hppa ddb. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hppa/conf/files.hppa cvs rdiff -u -r0 -r1.1 src/sys/arch/hppa/hppa/db_machdep.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hppa/include/db_machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/hppa/conf/files.hppa diff -u src/sys/arch/hppa/conf/files.hppa:1.15 src/sys/arch/hppa/conf/files.hppa:1.16 --- src/sys/arch/hppa/conf/files.hppa:1.15 Wed Nov 19 18:35:58 2008 +++ src/sys/arch/hppa/conf/files.hppa Tue Mar 2 20:40:15 2010 @@ -1,4 +1,4 @@ -# $NetBSD: files.hppa,v 1.15 2008/11/19 18:35:58 ad Exp $ +# $NetBSD: files.hppa,v 1.16 2010/03/02 20:40:15 skrll Exp $ # # $OpenBSD: files.hppa,v 1.31 2001/06/26 02:41:25 mickey Exp $ # @@ -14,6 +14,7 @@ file arch/hppa/hppa/db_disasm.c ddb file arch/hppa/hppa/db_memrw.c ddb | kgdb file arch/hppa/hppa/db_trace.c ddb +file arch/hppa/hppa/db_machdep.c ddb file arch/hppa/hppa/fpu.c file arch/hppa/hppa/kgdb_hppa.c kgdb file arch/hppa/hppa/kobj_machdep.c modular Index: src/sys/arch/hppa/include/db_machdep.h diff -u src/sys/arch/hppa/include/db_machdep.h:1.8 src/sys/arch/hppa/include/db_machdep.h:1.9 --- src/sys/arch/hppa/include/db_machdep.h:1.8 Tue Nov 3 05:07:26 2009 +++ src/sys/arch/hppa/include/db_machdep.h Tue Mar 2 20:40:16 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.h,v 1.8 2009/11/03 05:07:26 snj Exp $ */ +/* $NetBSD: db_machdep.h,v 1.9 2010/03/02 20:40:16 skrll Exp $ */ /* $OpenBSD: db_machdep.h,v 1.5 2001/02/16 19:20:13 mickey Exp $ */ @@ -44,6 +44,9 @@ extern db_regs_t ddb_regs; #define DDB_REGS (&ddb_regs) +/* DDB commands not in db_interface.c */ +void db_dump_trap(db_expr_t, bool, db_expr_t, const char *); + /* * Things needed by kgdb: */ @@ -112,6 +115,8 @@ #define db_clear_single_step(r) ((r)->tf_ipsw &= ~PSW_R) #define db_set_single_step(r) ((r)->tf_ipsw |= PSW_R) +#define DB_MACHINE_COMMANDS + int db_valid_breakpoint(db_addr_t); int kdb_trap(int, int, db_regs_t *); Added files: Index: src/sys/arch/hppa/hppa/db_machdep.c diff -u /dev/null src/sys/arch/hppa/hppa/db_machdep.c:1.1 --- /dev/null Tue Mar 2 20:40:16 2010 +++ src/sys/arch/hppa/hppa/db_machdep.c Tue Mar 2 20:40:15 2010 @@ -0,0 +1,126 @@ +/* $NetBSD: db_machdep.c,v 1.1 2010/03/02 20:40:15 skrll Exp $ */ + +/*- + * Copyright (c) 2010 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Nick Hudson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.1 2010/03/02 20:40:15 skrll Exp $"); + +#include <sys/param.h> +#include <machine/db_machdep.h> + +#include <ddb/db_command.h> +#include <ddb/db_output.h> + +const struct db_command db_machine_command_table[] = { + { DDB_ADD_CMD("frame", db_dump_trap, 0, + "Displays the contents of a trapframe", + "[/u] [addr]", + " addr:\tdisplay this trap frame (current kernel frame otherwise)\n" + " /u:\tdisplay the current userland trap frame") }, + { DDB_ADD_CMD(NULL, NULL, 0, NULL, NULL, NULL) } +}; + +void +db_dump_trap(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) +{ + struct trapframe *tf; + const char *cp = modif; + bool lwpaddr = false; + char c; + + tf = DDB_REGS; + while ((c = *cp++) != 0) { + if (c == 'l') + lwpaddr = true; + } + + /* Or an arbitrary trapframe */ + if (have_addr) { + if (lwpaddr) { + struct lwp *l; + + l = (struct lwp *)addr; + tf = (struct trapframe *)l->l_md.md_regs; + } else { + tf = (struct trapframe *)addr; + } + } + + db_printf("General registers\n"); + db_printf("r00-03 %08x %08x %08x %08x\n", + 0, tf->tf_r1, tf->tf_rp, tf->tf_r3); + db_printf("r04-07 %08x %08x %08x %08x\n", + tf->tf_r4, tf->tf_r5, tf->tf_r6, tf->tf_r7); + db_printf("r08-11 %08x %08x %08x %08x\n", + tf->tf_r8, tf->tf_r9, tf->tf_r10, tf->tf_r11); + db_printf("r12-15 %08x %08x %08x %08x\n", + tf->tf_r12, tf->tf_r13, tf->tf_r14, tf->tf_r15); + db_printf("r16-19 %08x %08x %08x %08x\n", + tf->tf_r16, tf->tf_r17, tf->tf_r18, tf->tf_t4); + db_printf("r20-23 %08x %08x %08x %08x\n", + tf->tf_t3, tf->tf_t2, tf->tf_t1, tf->tf_arg3); + db_printf("r24-27 %08x %08x %08x %08x\n", + tf->tf_arg2, tf->tf_arg1, tf->tf_arg0, tf->tf_dp); + db_printf("r28-31 %08x %08x %08x %08x\n", + tf->tf_ret0, tf->tf_ret1, tf->tf_sp, tf->tf_r31); + db_printf("\n"); + db_printf("Space registers\n"); + db_printf("s00-03 %08x %08x %08x %08x\n", + tf->tf_sr0, tf->tf_sr1, tf->tf_sr2, tf->tf_sr3); + db_printf("s04-07 %08x %08x %08x %08x\n", + tf->tf_sr4, tf->tf_sr5, tf->tf_sr6, tf->tf_sr7); + db_printf("\n"); + db_printf("Instruction queues\n"); + db_printf("iisq: %08x %08x\niioq: %08x %08x\n", + tf->tf_iisq_head, tf->tf_iisq_tail, tf->tf_iioq_head, + tf->tf_iioq_tail); + db_printf("\n"); + db_printf("Interrupt state\n"); + db_printf("isr: %08x\nior: %08x\niir: %08x\n", + tf->tf_isr, tf->tf_ior, tf->tf_iir); + db_printf("\n"); + db_printf("Other state\n"); + db_printf("eiem: %08x\n", tf->tf_eiem); + db_printf("ipsw: %08x\n", tf->tf_ipsw); + db_printf("flags: %08x\n", tf->tf_flags); + db_printf("sar: %08x\n", tf->tf_sar); + db_printf("pidr1: %08x\n", tf->tf_pidr1); /* cr8 */ + db_printf("pidr2: %08x\n", tf->tf_pidr2); /* cr9 */ +#if pbably_not_worth_it + db_printf("pidr3: %08x\n", tf->tf_pidr3); /* cr12 */ + db_printf("pidr4: %08x\n", tf->tf_pidr4); /* cr13 */ +#endif + db_printf("rctr: %08x\n", tf->tf_rctr); /* cr0 */ + db_printf("ccr: %08x\n", tf->tf_ccr); /* cr10 */ + db_printf("eirr: %08x\n", tf->tf_eirr); /* cr23 - DDB */ + db_printf("vtop: %08x\n", tf->tf_vtop); /* cr25 - DDB */ + db_printf("cr28: %08x\n", tf->tf_cr28); /* - DDB */ + db_printf("cr30: %08x\n", tf->tf_cr30); /* uaddr */ +}