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. ForOpenCorePkguseOC:, 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
DEBUGmacro to print debug messages during normal functioning, andRUNTIME_DEBUGfor debugging afterEXIT_BOOT_SERVICES. - Use
DEBUG_VERBOSEdebug level to leave debug messages for future debugging of the code, which are currently not necessary. By defaultDEBUG_VERBOSEmessages are ignored even inDEBUGbuilds. - Use
DEBUG_INFOdebug level for all non critical messages (including errors) andDEBUG_BULK_INFOfor 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_ERRORto print critical human visible messages that may potentially halt the boot process, andDEBUG_WARNfor all other human visible errors,RELEASEbuilds included. The git-bisect functionality may be useful when trying to find problematic changes. Unofficial sources ofper-commitOpenCore binary builds, such as Dortania, may also be useful.