Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Sep 2010 19:14:53 +0300
From:      Andriy Gapon <avg@freebsd.org>
To:        mdf@freebsd.org
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r212964 - head/sys/kern
Message-ID:  <4C98D9FD.4050809@freebsd.org>
In-Reply-To: <AANLkTi=CTr%2BZDs3znsF-SXDp__xxbetjnhSBxiDhfFYy@mail.gmail.com>
References:  <201009211507.o8LF7iVv097676@svn.freebsd.org> <AANLkTi=CTr%2BZDs3znsF-SXDp__xxbetjnhSBxiDhfFYy@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
on 21/09/2010 18:17 mdf@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C98D9FD.4050809>