From owner-p4-projects@FreeBSD.ORG Wed Sep 15 19:53:58 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CBD8116A4D0; Wed, 15 Sep 2004 19:53:57 +0000 (GMT) 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 A747316A4CE for ; Wed, 15 Sep 2004 19:53:57 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9BFD143D2F for ; Wed, 15 Sep 2004 19:53:57 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i8FJrvnH098340 for ; Wed, 15 Sep 2004 19:53:57 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i8FJrvwI098337 for perforce@freebsd.org; Wed, 15 Sep 2004 19:53:57 GMT (envelope-from jhb@freebsd.org) Date: Wed, 15 Sep 2004 19:53:57 GMT Message-Id: <200409151953.i8FJrvwI098337@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Subject: PERFORCE change 61553 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: Wed, 15 Sep 2004 19:53:58 -0000 http://perforce.freebsd.org/chv.cgi?CH=61553 Change 61553 by jhb@jhb_slimer on 2004/09/15 19:53:44 Argh, limit the userland trace to the overall frame count so that an infinite loop doesn't go on forever. Inspired by: 370k worth of user stack trace before I power cycled my machine Affected files ... .. //depot/projects/smpng/sys/sparc64/sparc64/db_trace.c#18 edit Differences ... ==== //depot/projects/smpng/sys/sparc64/sparc64/db_trace.c#18 (text+ko) ==== @@ -96,7 +96,7 @@ * User stack trace (debugging aid). */ static void -db_utrace(struct thread *td, struct trapframe *tf) +db_utrace(struct thread *td, struct trapframe *tf, int count) { struct pcb *pcb; db_addr_t sp, rsp, o7, pc; @@ -108,7 +108,7 @@ FALSE); pc = db_get_value((db_addr_t)&tf->tf_tpc, sizeof(tf->tf_tpc), FALSE); db_printf("user trace: trap %%o7=%#lx\n", o7); - while (sp != 0) { + while (count-- && sp != 0) { db_printf("pc %#lx, sp %#lx\n", pc, sp); /* First, check whether the frame is in the pcb. */ found = 0; @@ -134,7 +134,7 @@ } static int -db_print_trap(struct thread *td, struct trapframe *tf) +db_print_trap(struct thread *td, struct trapframe *tf, int count) { struct proc *p; const char *symname; @@ -212,7 +212,7 @@ db_printf("userland() at "); db_printsym(tpc, DB_STGY_PROC); db_printf("\n"); - db_utrace(td, tf); + db_utrace(td, tf, count); } return (user); } @@ -260,7 +260,7 @@ tf = (struct trapframe *)(fp + 1); npc = db_get_value((db_addr_t)&tf->tf_tpc, sizeof(tf->tf_tpc), FALSE); - user = db_print_trap(td, tf); + user = db_print_trap(td, tf, count); trap = 1; } else { db_printf("%s() at ", name);