Debugging
The codebase incorporates EDK II debugging and few custom features to improve the experience.
- Use module prefixes, 2-5 letters followed by a colon (
:
), for debug messages. ForOpenCorePkg
useOC:
, for libraries and drivers use their own unique prefixes. - Do not use dots (
.
) in the end of debug messages and separateEFI_STATUS
, printed by%r
, with a hyphen (e.g.OCRAM: Allocation of %u bytes failed - %r\n
). - Use
DEBUG_CODE_BEGIN ()
andDEBUG_CODE_END ()
constructions to guard debug checks that may potentially reduce the performance of release builds and are otherwise unnecessary. - Use
DEBUG
macro to print debug messages during normal functioning, andRUNTIME_DEBUG
for debugging afterEXIT_BOOT_SERVICES
. - Use
DEBUG_VERBOSE
debug level to leave debug messages for future debugging of the code, which are currently not necessary. By defaultDEBUG_VERBOSE
messages are ignored even inDEBUG
builds. - Use
DEBUG_INFO
debug level for all non critical messages (including errors) andDEBUG_BULK_INFO
for extensive messages that should not appear in NVRAM log that is heavily limited in size. These messages are ignored in RELEASE builds. 11 - Use
DEBUG_ERROR
to print critical human visible messages that may potentially halt the boot process, andDEBUG_WARN
for all other human visible errors,RELEASE
builds included. The git-bisect functionality may be useful when trying to find problematic changes. Unofficial sources ofper-commit
OpenCore binary builds, such as Dortania, may also be useful.