Home | History | Annotate | Line # | Download | only in arm32
db_machdep.c revision 1.5
      1 /*	$NetBSD: db_machdep.c,v 1.5 2001/09/05 17:08:41 matt Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1996 Mark Brinicombe
      5  *
      6  * Mach Operating System
      7  * Copyright (c) 1991,1990 Carnegie Mellon University
      8  * All Rights Reserved.
      9  *
     10  * Permission to use, copy, modify and distribute this software and its
     11  * documentation is hereby granted, provided that both the copyright
     12  * notice and this permission notice appear in all copies of the
     13  * software, derivative works or modified versions, and any portions
     14  * thereof, and that both notices appear in supporting documentation.
     15  *
     16  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     17  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
     18  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     19  *
     20  * Carnegie Mellon requests users of this software to return to
     21  *
     22  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     23  *  School of Computer Science
     24  *  Carnegie Mellon University
     25  *  Pittsburgh PA 15213-3890
     26  *
     27  * any improvements or extensions that they make and grant Carnegie the
     28  * rights to redistribute these changes.
     29  */
     30 
     31 #include <sys/param.h>
     32 #include <sys/proc.h>
     33 #include <sys/vnode.h>
     34 #include <sys/systm.h>
     35 
     36 #include <machine/db_machdep.h>
     37 
     38 #include <ddb/db_access.h>
     39 #include <ddb/db_sym.h>
     40 #include <ddb/db_output.h>
     41 
     42 #include <machine/intr.h>
     43 
     44 void
     45 db_show_intrchain_cmd(addr, have_addr, count, modif)
     46 	db_expr_t       addr;
     47 	int             have_addr;
     48 	db_expr_t       count;
     49 	char            *modif;
     50 {
     51 #ifndef NEWINTR
     52 	int loop;
     53 	struct irqhandler *ptr;
     54 	char *name;
     55 	db_expr_t offset;
     56 
     57 	for (loop = 0; loop < NIRQS; ++loop) {
     58 		ptr = irqhandlers[loop];
     59 		if (ptr) {
     60 			db_printf("IRQ %d\n", loop);
     61 
     62 			while (ptr) {
     63 				db_printf("  %-13s %d ", ptr->ih_name, ptr->ih_level);
     64 				db_find_sym_and_offset((u_int)ptr->ih_func, &name, &offset);
     65 				if (name == NULL)
     66 					name = "?";
     67 
     68 				db_printf("%s(", name);
     69 				db_printsym((u_int)ptr->ih_func, DB_STGY_PROC,
     70 				    db_printf);
     71 				db_printf(") %08x\n", (u_int)ptr->ih_arg);
     72 				ptr = ptr->ih_next;
     73 			}
     74 		}
     75 	}
     76 #endif	/* NEWINTR */
     77 }
     78 
     79 
     80 void
     81 db_show_panic_cmd(addr, have_addr, count, modif)
     82 	db_expr_t       addr;
     83 	int             have_addr;
     84 	db_expr_t       count;
     85 	char            *modif;
     86 {
     87 	int s;
     88 
     89 	s = splhigh();
     90 
     91 	db_printf("Panic string: %s\n", panicstr);
     92 
     93 	(void)splx(s);
     94 }
     95 
     96 
     97 void
     98 db_show_frame_cmd(addr, have_addr, count, modif)
     99 	db_expr_t       addr;
    100 	int             have_addr;
    101 	db_expr_t       count;
    102 	char            *modif;
    103 {
    104 	struct trapframe *frame;
    105 
    106 	if (!have_addr) {
    107 		db_printf("frame address must be specified\n");
    108 		return;
    109 	}
    110 
    111 	frame = (struct trapframe *)addr;
    112 
    113 	db_printf("frame address = %08x  ", (u_int)frame);
    114 	db_printf("spsr=%08x\n", frame->tf_spsr);
    115 	db_printf("r0 =%08x r1 =%08x r2 =%08x r3 =%08x\n",
    116 	    frame->tf_r0, frame->tf_r1, frame->tf_r2, frame->tf_r3);
    117 	db_printf("r4 =%08x r5 =%08x r6 =%08x r7 =%08x\n",
    118 	    frame->tf_r4, frame->tf_r5, frame->tf_r6, frame->tf_r7);
    119 	db_printf("r8 =%08x r9 =%08x r10=%08x r11=%08x\n",
    120 	    frame->tf_r8, frame->tf_r9, frame->tf_r10, frame->tf_r11);
    121 	db_printf("r12=%08x r13=%08x r14=%08x r15=%08x\n",
    122 	    frame->tf_r12, frame->tf_usr_sp, frame->tf_usr_lr, frame->tf_pc);
    123 	db_printf("slr=%08x\n", frame->tf_svc_lr);
    124 }
    125