svn commit: r212964 - head/sys/kern

Andriy Gapon avg at freebsd.org
Tue Sep 21 16:14:57 UTC 2010


on 21/09/2010 18:17 mdf at FreeBSD.org said the following:
> I'd recommend using stack_print_ddb(), as that avoids any locking
> which may hang depending on how the kernel panic'd.

How does the following look to you?
I hope I haven't freed too much from under DDB.
The patch compiles fine with STACK && !DDB.

--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -924,7 +924,6 @@ linker_debug_search_symbol_name
 	return (0);
 }

-#ifdef DDB
 /*
  * DDB Helpers.  DDB has to look across multiple files with their own symbol
  * tables and string tables.
@@ -933,12 +932,14 @@ linker_debug_search_symbol_name
  * DDB to hang because somebody's got the lock held.  We'll take the chance
  * that the files list is inconsistant instead.
  */
+#ifdef DDB
 int
 linker_ddb_lookup(const char *symstr, c_linker_sym_t *sym)
 {

 	return (linker_debug_lookup(symstr, sym));
 }
+#endif

 int
 linker_ddb_search_symbol(caddr_t value, c_linker_sym_t *sym, long *diffp)
@@ -961,7 +962,6 @@ linker_ddb_search_symbol_name

 	return (linker_debug_search_symbol_name(value, buf, buflen, offset));
 }
-#endif

 /*
  * stack(9) helper for non-debugging environemnts.  Unlike DDB helpers, we do
--- a/sys/kern/subr_kdb.c
+++ b/sys/kern/subr_kdb.c
@@ -308,7 +308,7 @@ kdb_backtrace(void)

 		printf("KDB: stack backtrace:\n");
 		stack_save(&st);
-		stack_print(&st);
+		stack_print_ddb(&st);
 	}
 #endif
 }
--- a/sys/kern/subr_stack.c
+++ b/sys/kern/subr_stack.c
@@ -44,9 +44,7 @@

 static int stack_symbol(vm_offset_t pc, char *namebuf, u_int buflen,
 	    long *offset);
-#ifdef DDB
 static int stack_symbol_ddb(vm_offset_t pc, const char **name, long *offset);
-#endif

 struct stack *
 stack_create(void)
@@ -125,7 +123,6 @@ stack_print_short(struct stack *st)
 	printf("\n");
 }

-#ifdef DDB
 void
 stack_print_ddb(struct stack *st)
 {
@@ -141,6 +138,7 @@ stack_print_ddb(struct stack *st)
 	}
 }

+#ifdef DDB
 void
 stack_print_short_ddb(struct stack *st)
 {
@@ -255,7 +253,6 @@ stack_symbol
 		return (0);
 }

-#ifdef DDB
 static int
 stack_symbol_ddb(vm_offset_t pc, const char **name, long *offset)
 {
@@ -275,4 +272,3 @@ stack_symbol_ddb
 	*name = "??";
 	return (ENOENT);
 }
-#endif


-- 
Andriy Gapon


More information about the svn-src-all mailing list