X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FInclude%2FLibrary%2FDebugLib.h;h=8d3d08638d7372e42b25dad1289d1c3428a3f6f7;hb=2f88bd3a1296c522317f1c21377876de63de5be7;hp=056ceb63adbbb9f81c46ede4417f31a94d10591a;hpb=1436aea4d5707e672672a11bda72be2c63c936c3;p=mirror_edk2.git diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h index 056ceb63ad..8d3d08638d 100644 --- a/MdePkg/Include/Library/DebugLib.h +++ b/MdePkg/Include/Library/DebugLib.h @@ -48,7 +48,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define DEBUG_CACHE 0x00200000 // Memory range cachability changes #define DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may // significantly impact boot performance -#define DEBUG_ERROR 0x80000000 // Error +#define DEBUG_ERROR 0x80000000 // Error // // Aliases of debug message mask bits @@ -129,7 +129,6 @@ DebugPrint ( ... ); - /** Prints a debug message to the debug output device if the specified error level is enabled. @@ -148,12 +147,11 @@ DebugPrint ( VOID EFIAPI DebugVPrint ( - IN UINTN ErrorLevel, - IN CONST CHAR8 *Format, - IN VA_LIST VaListMarker + IN UINTN ErrorLevel, + IN CONST CHAR8 *Format, + IN VA_LIST VaListMarker ); - /** Prints a debug message to the debug output device if the specified error level is enabled. @@ -174,12 +172,11 @@ DebugVPrint ( VOID EFIAPI DebugBPrint ( - IN UINTN ErrorLevel, - IN CONST CHAR8 *Format, - IN BASE_LIST BaseListMarker + IN UINTN ErrorLevel, + IN CONST CHAR8 *Format, + IN BASE_LIST BaseListMarker ); - /** Prints an assert message containing a filename, line number, and description. This may be followed by a breakpoint or a dead loop. @@ -209,7 +206,6 @@ DebugAssert ( IN CONST CHAR8 *Description ); - /** Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer. @@ -232,7 +228,6 @@ DebugClearMemory ( IN UINTN Length ); - /** Returns TRUE if ASSERT() macros are enabled. @@ -249,7 +244,6 @@ DebugAssertEnabled ( VOID ); - /** Returns TRUE if DEBUG() macros are enabled. @@ -266,7 +260,6 @@ DebugPrintEnabled ( VOID ); - /** Returns TRUE if DEBUG_CODE() macros are enabled. @@ -283,7 +276,6 @@ DebugCodeEnabled ( VOID ); - /** Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled. @@ -312,7 +304,7 @@ DebugClearMemoryEnabled ( BOOLEAN EFIAPI DebugPrintLevelEnabled ( - IN CONST UINTN ErrorLevel + IN CONST UINTN ErrorLevel ); /** @@ -325,6 +317,7 @@ DebugPrintLevelEnabled ( **/ #if defined (EDKII_UNIT_TEST_FRAMEWORK_ENABLED) + /** Unit test library replacement for DebugAssert() in DebugLib. @@ -344,17 +337,17 @@ UnitTestDebugAssert ( IN CONST CHAR8 *Description ); -#if defined(__clang__) && defined(__FILE_NAME__) + #if defined (__clang__) && defined (__FILE_NAME__) #define _ASSERT(Expression) UnitTestDebugAssert (__FILE_NAME__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression)) -#else + #else #define _ASSERT(Expression) UnitTestDebugAssert (__FILE__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression)) -#endif + #endif #else -#if defined(__clang__) && defined(__FILE_NAME__) + #if defined (__clang__) && defined (__FILE_NAME__) #define _ASSERT(Expression) DebugAssert (__FILE_NAME__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression)) -#else + #else #define _ASSERT(Expression) DebugAssert (__FILE__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression)) -#endif + #endif #endif /** @@ -370,16 +363,16 @@ UnitTestDebugAssert ( **/ -#if !defined(MDE_CPU_EBC) && (!defined (_MSC_VER) || _MSC_VER > 1400) - #define _DEBUG_PRINT(PrintLevel, ...) \ +#if !defined (MDE_CPU_EBC) && (!defined (_MSC_VER) || _MSC_VER > 1400) +#define _DEBUG_PRINT(PrintLevel, ...) \ do { \ if (DebugPrintLevelEnabled (PrintLevel)) { \ DebugPrint (PrintLevel, ##__VA_ARGS__); \ } \ } while (FALSE) - #define _DEBUG(Expression) _DEBUG_PRINT Expression +#define _DEBUG(Expression) _DEBUG_PRINT Expression #else -#define _DEBUG(Expression) DebugPrint Expression +#define _DEBUG(Expression) DebugPrint Expression #endif /** @@ -394,8 +387,8 @@ UnitTestDebugAssert ( @param Expression Boolean expression. **/ -#if !defined(MDEPKG_NDEBUG) - #define ASSERT(Expression) \ +#if !defined (MDEPKG_NDEBUG) +#define ASSERT(Expression) \ do { \ if (DebugAssertEnabled ()) { \ if (!(Expression)) { \ @@ -405,7 +398,7 @@ UnitTestDebugAssert ( } \ } while (FALSE) #else - #define ASSERT(Expression) +#define ASSERT(Expression) #endif /** @@ -420,15 +413,15 @@ UnitTestDebugAssert ( **/ -#if !defined(MDEPKG_NDEBUG) - #define DEBUG(Expression) \ +#if !defined (MDEPKG_NDEBUG) +#define DEBUG(Expression) \ do { \ if (DebugPrintEnabled ()) { \ _DEBUG (Expression); \ } \ } while (FALSE) #else - #define DEBUG(Expression) +#define DEBUG(Expression) #endif /** @@ -443,8 +436,8 @@ UnitTestDebugAssert ( @param StatusParameter EFI_STATUS value to evaluate. **/ -#if !defined(MDEPKG_NDEBUG) - #define ASSERT_EFI_ERROR(StatusParameter) \ +#if !defined (MDEPKG_NDEBUG) +#define ASSERT_EFI_ERROR(StatusParameter) \ do { \ if (DebugAssertEnabled ()) { \ if (EFI_ERROR (StatusParameter)) { \ @@ -454,7 +447,7 @@ UnitTestDebugAssert ( } \ } while (FALSE) #else - #define ASSERT_EFI_ERROR(StatusParameter) +#define ASSERT_EFI_ERROR(StatusParameter) #endif /** @@ -469,8 +462,8 @@ UnitTestDebugAssert ( @param StatusParameter RETURN_STATUS value to evaluate. **/ -#if !defined(MDEPKG_NDEBUG) - #define ASSERT_RETURN_ERROR(StatusParameter) \ +#if !defined (MDEPKG_NDEBUG) +#define ASSERT_RETURN_ERROR(StatusParameter) \ do { \ if (DebugAssertEnabled ()) { \ if (RETURN_ERROR (StatusParameter)) { \ @@ -481,7 +474,7 @@ UnitTestDebugAssert ( } \ } while (FALSE) #else - #define ASSERT_RETURN_ERROR(StatusParameter) +#define ASSERT_RETURN_ERROR(StatusParameter) #endif /** @@ -506,8 +499,8 @@ UnitTestDebugAssert ( @param Guid The pointer to a protocol GUID. **/ -#if !defined(MDEPKG_NDEBUG) - #define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid) \ +#if !defined (MDEPKG_NDEBUG) +#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid) \ do { \ if (DebugAssertEnabled ()) { \ VOID *Instance; \ @@ -524,7 +517,7 @@ UnitTestDebugAssert ( } \ } while (FALSE) #else - #define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid) +#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid) #endif /** @@ -538,7 +531,6 @@ UnitTestDebugAssert ( **/ #define DEBUG_CODE_BEGIN() do { if (DebugCodeEnabled ()) { UINT8 __DebugCodeLocal - /** The macro that marks the end of debug source code. @@ -548,8 +540,7 @@ UnitTestDebugAssert ( are not included in a module. **/ -#define DEBUG_CODE_END() __DebugCodeLocal = 0; __DebugCodeLocal++; } } while (FALSE) - +#define DEBUG_CODE_END() __DebugCodeLocal = 0; __DebugCodeLocal++; } } while (FALSE) /** The macro that declares a section of debug source code. @@ -564,7 +555,6 @@ UnitTestDebugAssert ( Expression \ DEBUG_CODE_END () - /** The macro that calls DebugClearMemory() to clear a buffer to a default value. @@ -582,7 +572,6 @@ UnitTestDebugAssert ( } \ } while (FALSE) - /** Macro that calls DebugAssert() if the containing record does not have a matching signature. If the signatures matches, then a pointer to the data @@ -625,13 +614,13 @@ UnitTestDebugAssert ( @param TestSignature The 32-bit signature value to match. **/ -#if !defined(MDEPKG_NDEBUG) - #define CR(Record, TYPE, Field, TestSignature) \ +#if !defined (MDEPKG_NDEBUG) +#define CR(Record, TYPE, Field, TestSignature) \ (DebugAssertEnabled () && (BASE_CR (Record, TYPE, Field)->Signature != TestSignature)) ? \ (TYPE *) (_ASSERT (CR has Bad Signature), Record) : \ BASE_CR (Record, TYPE, Field) #else - #define CR(Record, TYPE, Field, TestSignature) \ +#define CR(Record, TYPE, Field, TestSignature) \ BASE_CR (Record, TYPE, Field) #endif