Subject: Re: kern/3249: More vm woes
To: Jason Thorpe <thorpej@nas.nasa.gov>
From: Bill Sommerfeld <sommerfeld@orchard.medford.ma.us>
List: current-users
Date: 02/24/1997 21:09:18
Well, it seems to fix things on my system, though I did get a
DIAGNOSTIC printf:

	vm_object_deallocate: unreferenced object still paging

while recompiling the vm code without -g :-) so it sounds like we're
not entirely out of the woods yet..

I'm sorely tempted to commit the following change to the i386 ddb
traceback code, to allow traceback by pid rather than
*(u-area address+0x3c)..

					- Bill

Index: db_trace.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/i386/db_trace.c,v
retrieving revision 1.20
diff -u -r1.20 db_trace.c
--- db_trace.c	1997/02/04 19:52:55	1.20
+++ db_trace.c	1997/02/25 02:10:41
@@ -29,6 +29,7 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
+#include <sys/user.h> 
 
 #include <machine/db_machdep.h>
 
@@ -211,10 +212,24 @@
 	if (!have_addr) {
 		frame = (struct i386_frame *)ddb_regs.tf_ebp;
 		callpc = (db_addr_t)ddb_regs.tf_eip;
-	} else if (trace_thread) {
-		db_printf ("db_trace.c: can't trace thread\n");
 	} else {
-		frame = (struct i386_frame *)addr;
+		if (trace_thread) {
+			struct proc *p;
+			struct user *u;
+			db_printf ("db_trace.c: pid %d\n", (int)addr);
+			p = pfind(addr);
+			if (p == NULL) {
+				db_printf("proc not found\n");
+				return;
+			}	
+			u = p->p_addr;
+			if (u == NULL) {
+				db_printf("proc swapped out\n");
+				return;
+			}
+			frame = (struct i386_frame *) u->u_pcb.pcb_ebp;
+		} else
+			frame = (struct i386_frame *)addr;
 		callpc = (db_addr_t)
 			 db_get_value((int)&frame->f_retaddr, 4, FALSE);
 	}