From d3e00c7d643c5c2ce5be44c6283291e6973af5d9 Mon Sep 17 00:00:00 2001 From: dbj Date: Fri, 27 Feb 2004 22:52:03 +0000 Subject: [PATCH] fix backtracing through interrupt frames and system call frames --- sys/arch/i386/i386/db_trace.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/arch/i386/i386/db_trace.c b/sys/arch/i386/i386/db_trace.c index cc11d5d95a59..631da99f8ccc 100644 --- a/sys/arch/i386/i386/db_trace.c +++ b/sys/arch/i386/i386/db_trace.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_trace.c,v 1.41 2004/01/29 04:58:50 dbj Exp $ */ +/* $NetBSD: db_trace.c,v 1.42 2004/02/27 22:52:03 dbj Exp $ */ /* * Mach Operating System @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.41 2004/01/29 04:58:50 dbj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.42 2004/02/27 22:52:03 dbj Exp $"); #include #include @@ -220,7 +220,6 @@ db_nextframe(int **nextframe, int **retaddr, int **arg0, db_addr_t *ip, /* The only argument to trap() or syscall() is the trapframe. */ tf = *(struct trapframe **)argp; - *ip = (db_addr_t)tf->tf_eip; switch (is_trap) { case TRAP: (*pr)("--- trap (number %d) ---\n", tf->tf_trapno); @@ -230,8 +229,10 @@ db_nextframe(int **nextframe, int **retaddr, int **arg0, db_addr_t *ip, break; case INTERRUPT: (*pr)("--- interrupt ---\n"); + tf = (struct trapframe *)argp; break; } + *ip = (db_addr_t)tf->tf_eip; fp = (struct i386_frame *)tf->tf_ebp; if (fp == NULL) return 0; @@ -259,6 +260,15 @@ db_nextframe(int **nextframe, int **retaddr, int **arg0, db_addr_t *ip, break; } } + if (i == 4) { + (*pr)("DDB lost frame for "); + db_printsym(*ip, DB_STGY_ANY, pr); + (*pr)(", trying %p\n",argp); + /* I observe that the frame can be often found here, although + * it has an err value of 0x18041969 instead of 0 + * I don't know why. -- dbj */ + *nextframe = argp; + } } return 1; } @@ -293,7 +303,8 @@ db_frame_info(int *frame, db_addr_t callpc, char **namep, db_expr_t *offp, } else if (!strcmp(name, "trap")) { *is_trap = TRAP; narg = 0; - } else if (!strcmp(name, "syscall")) { + } else if (!strcmp(name, "syscall_plain") || + !strcmp(name, "syscall_fancy")) { *is_trap = SYSCALL; narg = 0; } else if (name[0] == 'X') {