From e5fe87b387c41c27bbe68691aa2ddb079146dac1 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Thu, 27 Oct 2011 09:43:25 +0000 Subject: [PATCH] - If KDB & NETGRAPH_DEBUG are on, print traces on discovered failed invariants. - Reduce tautology in NETGRAPH_DEBUG output. --- sys/netgraph/netgraph.h | 5 +++-- sys/netgraph/ng_base.c | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h index 7b67c94ea504..09ee09e22f6b 100644 --- a/sys/netgraph/netgraph.h +++ b/sys/netgraph/netgraph.h @@ -57,6 +57,7 @@ #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_netgraph.h" +#include "opt_kdb.h" #endif /* debugging options */ @@ -190,7 +191,7 @@ static __inline void _chkhook(hook_p hook, char *file, int line) { if (hook->hk_magic != HK_MAGIC) { - printf("Accessing freed hook "); + printf("Accessing freed "); dumphook(hook, file, line); } hook->lastline = line; @@ -458,7 +459,7 @@ static __inline void _chknode(node_p node, char *file, int line) { if (node->nd_magic != ND_MAGIC) { - printf("Accessing freed node "); + printf("Accessing freed "); dumpnode(node, file, line); } node->lastline = line; diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index 0918193bf2e5..3c84dbf9cad0 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -3167,6 +3167,9 @@ dumphook (hook_p hook, char *file, int line) hook->lastfile, hook->lastline); if (line) { printf(" problem discovered at file %s, line %d\n", file, line); +#ifdef KDB + kdb_backtrace(); +#endif } } @@ -3181,6 +3184,9 @@ dumpnode(node_p node, char *file, int line) node->lastfile, node->lastline); if (line) { printf(" problem discovered at file %s, line %d\n", file, line); +#ifdef KDB + kdb_backtrace(); +#endif } }