HomeFreeBSD

Add DEBUG_PRINTF to stand.h

Description

Add DEBUG_PRINTF to stand.h

stand/ is mostly debugged with printfs, in an ad hoc and sometimes
fragile manner. For example BOOTP_DEBUG in bootp.c cannot be defined
unless NETIF_DEBUG is defined in dev_net.c or build fails for lack of the
symbol debug.

The DEBUG_PRINTF implementation in stand.h addresses that and allows
for more control over debug output. It is compatible with the
usage in libsecureboot.

Simply define _DEBUG_LEVEL to the desired level of debug
or in the case of libsecureboot _DEBUG_LEVEL_VAR to the variable that
will hold that value - default is _debug which is static so each
translation unit can be controlled independently.

The 1st arg to DEBUG_PRINTF is a level which must be greater than or
equal to _DEBUG_LEVEL_VAR if the printf is to be called.
See libsecureboot for more examples.

Reviewed by: imp
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D51269

Details

Provenance
sjgAuthored on Jul 17 2025, 11:36 PM
Reviewer
imp
Differential Revision
D51269: Add DEBUG_PRINTF to stand.h
Parents
rG5a846c48f209: pmap_enter_{l2,pde}: correct the handling of an error case
Branches
Unknown
Tags
Unknown