PERFORCE change 61553 for review

John Baldwin jhb at FreeBSD.org
Wed Sep 15 12:53:58 PDT 2004


http://perforce.freebsd.org/chv.cgi?CH=61553

Change 61553 by jhb at 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);


More information about the p4-projects mailing list