mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
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. Sponsored by: ISPsystem MFC After: 8 days
This commit is contained in:
parent
5cb9c68cc9
commit
3e0490b3fe
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=203729
@ -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_alloc, return, "int", "struct 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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user