X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FBaseDebugLibNull%2FDebugLib.c;h=5732f312fc7104ecf66fdd13bc5b318ee99a3700;hp=db0b0a97a72ebbedb736093678570c018e33edc2;hb=700b41d4d587b9e7836023ce1e27ec62f47cf8a5;hpb=cd14fe3dcf9445a2b3c9e8e3eef78c23c4d2b7cd diff --git a/MdePkg/Library/BaseDebugLibNull/DebugLib.c b/MdePkg/Library/BaseDebugLibNull/DebugLib.c index db0b0a97a7..5732f312fc 100644 --- a/MdePkg/Library/BaseDebugLibNull/DebugLib.c +++ b/MdePkg/Library/BaseDebugLibNull/DebugLib.c @@ -1,8 +1,8 @@ /** @file - Base Debug Library that uses PrintLib to print messages to a memory buffer. + Null Base Debug Library instance with empty functions. - Copyright (c) 2006, Intel Corporation - All rights reserved. This program and the accompanying materials + Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+ This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -12,13 +12,10 @@ **/ -// -// Define the maximum debug and assert message length that this library supports -// -#define MAX_DEBUG_MESSAGE_LENGTH 0x100 +#include +#include /** - Prints a debug message to the debug output device if the specified error level is enabled. If any bit in ErrorLevel is also set in PcdDebugPrintErrorLevel, then print @@ -29,6 +26,8 @@ @param ErrorLevel The error level of the debug message. @param Format Format string for the debug message to print. + @param ... Variable argument list whose contents are accessed + based on the format string specified by Format. **/ VOID @@ -39,39 +38,23 @@ DebugPrint ( ... ) { - CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; - VA_LIST Marker; - - // - // If Format is NULL, then ASSERT(). - // - ASSERT (Format != NULL); - - // - // Print the assert message to a buffer - // - VA_START (Marker, Format); - AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker); - VA_END (Marker); } /** - Prints an assert message containing a filename, line number, and description. This may be followed by a breakpoint or a dead loop. - Print a message of the form "ASSERT (): \n" + Print a message of the form "ASSERT (): \n" to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then CpuDeadLoop() is called. If neither of these bits are set, then this function returns immediately after the message is printed to the debug output device. - DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while + DebugAssert() must actively prevent recursion. If DebugAssert() is called while processing another DebugAssert(), then DebugAssert() must return immediately. If FileName is NULL, then a string of "(NULL) Filename" is printed. - If Description is NULL, then a string of "(NULL) Description" is printed. @param FileName Pointer to the name of the source file that generated the assert condition. @@ -87,39 +70,22 @@ DebugAssert ( IN CONST CHAR8 *Description ) { - CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; - - // - // Print the assert message to a buffer - // - AsciiSPrint (Buffer, sizeof (Buffer), "ASSERT %s(%d): %s\n", FileName, LineNumber, Description); - - // - // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings - // - if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) { - CpuBreakpoint (); - } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) { - CpuDeadLoop (); - } } /** - Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer. This function fills Length bytes of Buffer with the value specified by PcdDebugClearMemoryValue, and returns Buffer. If Buffer is NULL, then ASSERT(). + If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS – Buffer + 1), then ASSERT(). - - @param Buffer Pointer to the target buffer to fill with PcdDebugClearMemoryValue. + @param Buffer Pointer to the target buffer to be filled with PcdDebugClearMemoryValue. @param Length Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. - @return Buffer + @return Buffer Pointer to the target buffer filled with PcdDebugClearMemoryValue. **/ VOID * @@ -129,20 +95,11 @@ DebugClearMemory ( IN UINTN Length ) { - // - // If Buffer is NULL, then ASSERT(). - // - ASSERT (Buffer != NULL); - - // - // SetMem() checks for the the ASSERT() condition on Length and returns Buffer - // - return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue)); + return Buffer; } /** - Returns TRUE if ASSERT() macros are enabled. This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of @@ -158,13 +115,12 @@ DebugAssertEnabled ( VOID ) { - return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0); + return FALSE; } -/** - - Returns TRUE if DEBUG()macros are enabled. +/** + Returns TRUE if DEBUG() macros are enabled. This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set. Otherwise FALSE is returned. @@ -179,13 +135,12 @@ DebugPrintEnabled ( VOID ) { - return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0); + return FALSE; } -/** - - Returns TRUE if DEBUG_CODE()macros are enabled. +/** + Returns TRUE if DEBUG_CODE() macros are enabled. This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set. Otherwise FALSE is returned. @@ -200,19 +155,18 @@ DebugCodeEnabled ( VOID ) { - return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0); + return FALSE; } -/** - - Returns TRUE if DEBUG_CLEAR_MEMORY()macro is enabled. +/** + Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled. - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of + This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. Otherwise FALSE is returned. - @retval TRUE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear. + @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. + @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear. **/ BOOLEAN @@ -221,5 +175,5 @@ DebugClearMemoryEnabled ( VOID ) { - return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0); + return FALSE; }