svn commit: r205752 - stable/8/sys/net
Bjoern A. Zeeb
bz at FreeBSD.org
Sat Mar 27 17:31:55 UTC 2010
Author: bz
Date: Sat Mar 27 17:31:54 2010
New Revision: 205752
URL: http://svn.freebsd.org/changeset/base/205752
Log:
MFC r203729:
Add DDB support for printing vnet_sysinit and vnet_sysuninit
ordered call lists. Try to lookup function/symbol names and print
those in addition to the pointers, along with the constants for
subsystem and order.
This is useful for debugging vnet teardown ordering issues.
Make it possible to call the actual printing frunction from normal
code at runtime, ie. from vnet_sysuninit(), if DDB support is there.
Modified:
stable/8/sys/net/vnet.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/xen/xenpci/ (props changed)
Modified: stable/8/sys/net/vnet.c
==============================================================================
--- stable/8/sys/net/vnet.c Sat Mar 27 17:29:50 2010 (r205751)
+++ stable/8/sys/net/vnet.c Sat Mar 27 17:31:54 2010 (r205752)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
#ifdef DDB
#include <ddb/ddb.h>
+#include <ddb/db_sym.h>
#endif
#include <net/if.h>
@@ -219,6 +220,10 @@ SDT_PROBE_DEFINE2(vnet, functions, vnet_
SDT_PROBE_DEFINE2(vnet, functions, vnet_destroy, entry, "int", "struct vnet *");
SDT_PROBE_DEFINE1(vnet, functions, vnet_destroy, return, "int");
+#ifdef DDB
+static void db_show_vnet_print_vs(struct vnet_sysinit *, int);
+#endif
+
/*
* Allocate a virtual network stack.
*/
@@ -713,6 +718,64 @@ DB_SHOW_COMMAND(vnets, db_show_vnets)
}
}
+static void
+db_show_vnet_print_vs(struct vnet_sysinit *vs, int ddb)
+{
+ const char *vsname, *funcname;
+ c_db_sym_t sym;
+ db_expr_t offset;
+
+#define xprint(...) \
+ if (ddb) \
+ db_printf(__VA_ARGS__); \
+ else \
+ printf(__VA_ARGS__)
+
+ if (vs == NULL) {
+ xprint("%s: no vnet_sysinit * given\n", __func__);
+ return;
+ }
+
+ sym = db_search_symbol((vm_offset_t)vs, DB_STGY_ANY, &offset);
+ db_symbol_values(sym, &vsname, NULL);
+ sym = db_search_symbol((vm_offset_t)vs->func, DB_STGY_PROC, &offset);
+ db_symbol_values(sym, &funcname, NULL);
+ xprint("%s(%p)\n", (vsname != NULL) ? vsname : "", vs);
+ xprint(" 0x%08x 0x%08x\n", vs->subsystem, vs->order);
+ xprint(" %p(%s)(%p)\n",
+ vs->func, (funcname != NULL) ? funcname : "", vs->arg);
+#undef xprint
+}
+
+DB_SHOW_COMMAND(vnet_sysinit, db_show_vnet_sysinit)
+{
+ struct vnet_sysinit *vs;
+
+ db_printf("VNET_SYSINIT vs Name(Ptr)\n");
+ db_printf(" Subsystem Order\n");
+ db_printf(" Function(Name)(Arg)\n");
+ TAILQ_FOREACH(vs, &vnet_constructors, link) {
+ db_show_vnet_print_vs(vs, 1);
+ if (db_pager_quit)
+ break;
+ }
+}
+
+DB_SHOW_COMMAND(vnet_sysuninit, db_show_vnet_sysuninit)
+{
+ struct vnet_sysinit *vs;
+
+ db_printf("VNET_SYSUNINIT vs Name(Ptr)\n");
+ db_printf(" Subsystem Order\n");
+ db_printf(" Function(Name)(Arg)\n");
+ TAILQ_FOREACH_REVERSE(vs, &vnet_destructors, vnet_sysuninit_head,
+ link) {
+ db_show_vnet_print_vs(vs, 1);
+ if (db_pager_quit)
+ break;
+ }
+}
+
#ifdef VNET_DEBUG
DB_SHOW_COMMAND(vnetrcrs, db_show_vnetrcrs)
{
More information about the svn-src-all
mailing list