From owner-p4-projects@FreeBSD.ORG Sun Dec 28 23:59:11 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4A95A16A4D0; Sun, 28 Dec 2003 23:59:11 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E560C16A4CE for ; Sun, 28 Dec 2003 23:59:10 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 796BD43D5A for ; Sun, 28 Dec 2003 23:59:09 -0800 (PST) (envelope-from jmallett@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id hBT7x90B007362 for ; Sun, 28 Dec 2003 23:59:09 -0800 (PST) (envelope-from jmallett@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id hBT7x9tG007359 for perforce@freebsd.org; Sun, 28 Dec 2003 23:59:09 -0800 (PST) (envelope-from jmallett@freebsd.org) Date: Sun, 28 Dec 2003 23:59:09 -0800 (PST) Message-Id: <200312290759.hBT7x9tG007359@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmallett@freebsd.org using -f From: Juli Mallett To: Perforce Change Reviews Subject: PERFORCE change 44495 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Dec 2003 07:59:11 -0000 http://perforce.freebsd.org/chv.cgi?CH=44495 Change 44495 by jmallett@jmallett_oingo on 2003/12/28 23:58:30 Shuffle some things, nuke some unused stuff... Affected files ... .. //depot/projects/mips/sys/mips/mips/db_trace.c#5 edit Differences ... ==== //depot/projects/mips/sys/mips/mips/db_trace.c#5 (text+ko) ==== @@ -41,37 +41,6 @@ #include #include -int start(void); /* lowest kernel code address */ -vm_offset_t getreg_val(db_expr_t regno); - -#define REG_ARG(i) (4+i) -#define SAVES_RA(x) isa_spill((x),31) - -#define KERN_SAVE_REG_IDX(vp) ( \ - ((vp)->valuep >= (int *)(&((struct mips_saved_state *)0)->s0) && \ - (vp)->valuep <= (int *)(&((struct mips_saved_state *)0)->s7))? \ - vp->valuep - (int *)(&((struct mips_saved_state *)0)->s0): \ - ((vp)->valuep >= (int *)(&((struct mips_saved_state *)0)->sp) && \ - (vp)->valuep <= (int *)(&((struct mips_saved_state *)0)->ra))? \ - ((vp)->valuep-(int *)(&((struct mips_saved_state *)0)->sp)) + \ - ((int *)(&((struct mips_kernel_state *)0)->sp) - (int *)0): \ - -1) - -db_sym_t localsym(db_sym_t sym, boolean_t isreg, int *lex_level); - -/* - * Machine register set. - */ -struct mips_saved_state *db_cur_exc_frame = 0; - -/* - * Stack trace helper. - */ -void db_mips_stack_trace(int, vm_offset_t, vm_offset_t, vm_offset_t, int, vm_offset_t); -int db_mips_variable_func(const struct db_variable *, db_expr_t *, int); - -#define DBREGS_REG() - struct db_variable db_regs[] = { { "at", (db_expr_t *)&ddb_regs.f_regs[AST], FCN_NULL }, { "v0", (db_expr_t *)&ddb_regs.f_regs[V0], FCN_NULL }, @@ -137,6 +106,8 @@ ra = ddb_regs.f_regs[RA]; do { va = pc; + if (va <= (register_t)btext) + break; do { va -= sizeof(int); insn = *(int *)va; @@ -151,30 +122,50 @@ func = va; stacksize = 0; do { + if (va >= pc) + break; i.word = *(int *)va; - if (i.IType.op == OP_SW - && i.IType.rs == SP - && i.IType.rt == RA) + switch (i.IType.op) { + case OP_SW: + case OP_SD: + if (i.IType.rs != sp || i.IType.rt != RA) + break; ra = *(int *)(sp + (short)i.IType.imm); - if (i.IType.op == OP_ADDIU - && i.IType.rs == SP - && i.IType.rt == SP) + break; + case OP_ADDI: + case OP_ADDIU: + case OP_DADDI: + case OP_DADDIU: + if (i.IType.rs != SP || i.IType.rt != SP) + break; stacksize = -(short)i.IType.imm; + break; + default: + break; + } va += sizeof(int); } while (va < pc); db_find_sym_and_offset(func, &name, &offset); - if (name == 0) - name = "?"; - db_printf("%s()+0x%lx, called by %p, stack size %d\n", - name, (u_long)(pc - func), (void *)ra, stacksize); + if (name != NULL) + db_printf("%s()+0x%lx", name, (u_long)(pc - func)); + else + db_printf("%p", (void *)pc); + db_printf(" called by "); + db_find_sym_and_offset(ra, &name, &offset); + if (name != NULL) + db_printf("%s", name); + else + db_printf("%p", (void *)ra); + db_printf(" stack size %d\n", stacksize); - if (ra == pc) { + if (ra == pc && stacksize == 0) { db_printf("-- loop? --\n"); - return; + break; } + pc = ra; sp += stacksize; - pc = ra; + ra = 0; } while (pc > (register_t)btext); if (pc < 0x80000000) db_printf("-- user process --\n"); @@ -183,15 +174,6 @@ } void -db_mips_stack_trace(int count, vm_offset_t stackp, vm_offset_t the_pc, vm_offset_t the_ra, - int flags, vm_offset_t kstackp) -{ - - /* nothing... */ -} - - -void db_print_backtrace(void) { u_long *sp;