Extend VERBOSE_SYSINIT to also print out the name of variables passed
to SYSINIT routines if they can be resolved via symbol look up in DDB. To avoid false positives, only honor a name if the symbol resolves exactly to the pointer value (no offset). MFC after: 1 week
This commit is contained in:
parent
f0a101b7e2
commit
b871e6613b
@ -158,6 +158,24 @@ sysinit_add(struct sysinit **set, struct sysinit **set_end)
|
||||
newsysinit_end = newset + count;
|
||||
}
|
||||
|
||||
#if defined (DDB) && defined(VERBOSE_SYSINIT)
|
||||
static const char *
|
||||
symbol_name(vm_offset_t va, db_strategy_t strategy)
|
||||
{
|
||||
const char *name;
|
||||
c_db_sym_t sym;
|
||||
db_expr_t offset;
|
||||
|
||||
if (va == 0)
|
||||
return (NULL);
|
||||
sym = db_search_symbol(va, strategy, &offset);
|
||||
if (offset != 0)
|
||||
return (NULL);
|
||||
db_symbol_values(sym, &name, NULL);
|
||||
return (name);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* System startup; initialize the world, create process 0, mount root
|
||||
* filesystem, and fork to create init and pagedaemon. Most of the
|
||||
@ -238,15 +256,16 @@ mi_startup(void)
|
||||
}
|
||||
if (verbose) {
|
||||
#if defined(DDB)
|
||||
const char *name;
|
||||
c_db_sym_t sym;
|
||||
db_expr_t offset;
|
||||
const char *func, *data;
|
||||
|
||||
sym = db_search_symbol((vm_offset_t)(*sipp)->func,
|
||||
DB_STGY_PROC, &offset);
|
||||
db_symbol_values(sym, &name, NULL);
|
||||
if (name != NULL)
|
||||
printf(" %s(%p)... ", name, (*sipp)->udata);
|
||||
func = symbol_name((vm_offset_t)(*sipp)->func,
|
||||
DB_STGY_PROC);
|
||||
data = symbol_name((vm_offset_t)(*sipp)->udata,
|
||||
DB_STGY_ANY);
|
||||
if (func != NULL && data != NULL)
|
||||
printf(" %s(&%s)... ", func, data);
|
||||
else if (func != NULL)
|
||||
printf(" %s(%p)... ", func, (*sipp)->udata);
|
||||
else
|
||||
#endif
|
||||
printf(" %p(%p)... ", (*sipp)->func,
|
||||
|
Loading…
Reference in New Issue
Block a user