PERFORCE change 61556 for review

John Baldwin jhb at FreeBSD.org
Wed Sep 15 13:09:18 PDT 2004


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

Change 61556 by jhb at jhb_slimer on 2004/09/15 20:08:44

	Add paging support to all the stack tracing functions.  (i.e. you
	can make it go line at a time or page at a time or quit at any
	time).

Affected files ...

.. //depot/projects/smpng/sys/alpha/alpha/db_trace.c#12 edit
.. //depot/projects/smpng/sys/amd64/amd64/db_trace.c#7 edit
.. //depot/projects/smpng/sys/arm/arm/db_trace.c#4 edit
.. //depot/projects/smpng/sys/i386/i386/db_trace.c#17 edit
.. //depot/projects/smpng/sys/ia64/ia64/db_trace.c#16 edit
.. //depot/projects/smpng/sys/powerpc/powerpc/db_trace.c#6 edit
.. //depot/projects/smpng/sys/sparc64/sparc64/db_trace.c#19 edit

Differences ...

==== //depot/projects/smpng/sys/alpha/alpha/db_trace.c#12 (text+ko) ====

@@ -213,14 +213,16 @@
 	db_expr_t diff;
 	db_addr_t symval;
 	u_long last_ipl, tfps;
-	int i;
+	int i, quit;
 
 	if (count == -1)
 		count = 1024;
 
 	last_ipl = ~0L;
 	tf = NULL;
-	while (count--) {
+	quit = 0;
+	db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE);
+	while (count-- && !quit) {
 		sym = db_search_symbol(pc, DB_STGY_ANY, &diff);
 		if (sym == DB_SYM_NULL)
 			return (ENOENT);

==== //depot/projects/smpng/sys/amd64/amd64/db_trace.c#7 (text+ko) ====

@@ -373,14 +373,16 @@
 	long *argp;
 	db_expr_t offset;
 	c_db_sym_t sym;
-	int narg;
+	int narg, quit;
 	boolean_t first;
 
 	if (count == -1)
 		count = 1024;
 
 	first = TRUE;
-	while (count--) {
+	quit = 0;
+	db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE);
+	while (count-- && !quit) {
 		sym = db_search_symbol(pc, DB_STGY_ANY, &offset);
 		db_symbol_values(sym, &name, NULL);
 

==== //depot/projects/smpng/sys/arm/arm/db_trace.c#4 (text+ko) ====

@@ -102,7 +102,7 @@
 	db_expr_t offset;
 	boolean_t	kernel_only = TRUE;
 	boolean_t	trace_thread = FALSE;
-	int	scp_offset;
+	int	scp_offset, quit;
 
 	if (kdb_frame == NULL && !have_addr)
 		return;
@@ -142,7 +142,9 @@
 	lastframe = NULL;
 	scp_offset = -(get_pc_str_offset() >> 2);
 
-	while (count-- && frame != NULL) {
+	quit = 0;
+	db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE);
+	while (count-- && frame != NULL && !quit) {
 		db_addr_t	scp;
 		u_int32_t	savecode;
 		int		r;

==== //depot/projects/smpng/sys/i386/i386/db_trace.c#17 (text+ko) ====

@@ -379,14 +379,16 @@
 	int *argp;
 	db_expr_t offset;
 	c_db_sym_t sym;
-	int narg;
+	int narg, quit;
 	boolean_t first;
 
 	if (count == -1)
 		count = 1024;
 
 	first = TRUE;
-	while (count--) {
+	quit = 0;
+	db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE);
+	while (count-- && !quit) {
 		sym = db_search_symbol(pc, DB_STGY_ANY, &offset);
 		db_symbol_values(sym, &name, NULL);
 

==== //depot/projects/smpng/sys/ia64/ia64/db_trace.c#16 (text+ko) ====

@@ -57,10 +57,12 @@
 	db_expr_t offset;
 	uint64_t bsp, cfm, ip, pfs, reg, sp;
 	c_db_sym_t sym;
-	int args, error, i;
+	int args, error, i, quit;
 
+	quit = 0;
+	db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE);
 	error = unw_create_from_pcb(&rs, pcb);
-	while (!error && count--) {
+	while (!error && count-- && !quit) {
 		error = unw_get_cfm(&rs, &cfm);
 		if (!error)
 			error = unw_get_bsp(&rs, &bsp);

==== //depot/projects/smpng/sys/powerpc/powerpc/db_trace.c#6 (text+ko) ====

@@ -129,6 +129,7 @@
 	const char *symname;
 	boolean_t kernel_only = TRUE;
 	boolean_t full = FALSE;
+	int quit;
 
 #if 0
 	{
@@ -148,7 +149,9 @@
 
 	stackframe = fp;
 
-	for (;;) {
+	quit = 0;
+	db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE);
+	while (!quit) {
 		if (stackframe < PAGE_SIZE)
 			break;
 

==== //depot/projects/smpng/sys/sparc64/sparc64/db_trace.c#19 (text+ko) ====

@@ -96,7 +96,7 @@
  * User stack trace (debugging aid).
  */
 static void
-db_utrace(struct thread *td, struct trapframe *tf, int count)
+db_utrace(struct thread *td, struct trapframe *tf, int count, int *quitp)
 {
 	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 (count-- && sp != 0) {
+	while (count-- && sp != 0 && !*quitp) {
 		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, int count)
+db_print_trap(struct thread *td, struct trapframe *tf, int count, int *quitp)
 {
 	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, count);
+		db_utrace(td, tf, count, quitp);
 	}
 	return (user);
 }
@@ -229,6 +229,7 @@
 	db_addr_t pc;
 	int trap;
 	int user;
+	int quit;
 
 	if (count == -1)
 		count = 1024;
@@ -236,7 +237,9 @@
 	trap = 0;
 	user = 0;
 	npc = 0;
-	while (count-- && !user) {
+	quit = 0;
+	db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE);
+	while (count-- && !user && !quit) {
 		pc = (db_addr_t)db_get_value((db_addr_t)&fp->fr_pc,
 		    sizeof(fp->fr_pc), FALSE);
 		if (trap) {
@@ -260,7 +263,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, count);
+			user = db_print_trap(td, tf, count, &quit);
 			trap = 1;
 		} else {
 			db_printf("%s() at ", name);


More information about the p4-projects mailing list