MdePkg: fix comment typo in DebugLib.h
[mirror_edk2.git] / MdePkg / Include / Library / DebugLib.h
CommitLineData
fb3df220 1/** @file\r
50a64e5b 2 Provides services to print debug and assert messages to a debug output device.\r
d80b2f71 3 \r
4 The Debug library supports debug print and asserts based on a combination of macros and code.\r
5 The debug library can be turned on and off so that the debug code does not increase the size of an image.\r
c9ec7047 6\r
5ee9264a 7 Note that a reserved macro named MDEPKG_NDEBUG is introduced for the intention\r
8 of size reduction when compiler optimization is disabled. If MDEPKG_NDEBUG is\r
9 defined, then debug and assert related macros wrapped by it are the NULL implementations.\r
c9ec7047 10\r
5ea9d0c3 11Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
af2dc6a7 12This program and the accompanying materials are licensed and made available under \r
13the terms and conditions of the BSD License that accompanies this distribution. \r
14The full text of the license may be found at\r
15http://opensource.org/licenses/bsd-license.php.\r
fb3df220 16\r
50a64e5b 17THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
18WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
fb3df220 19\r
20**/\r
21\r
22#ifndef __DEBUG_LIB_H__\r
23#define __DEBUG_LIB_H__\r
24\r
25//\r
26// Declare bits for PcdDebugPropertyMask\r
27//\r
28#define DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED 0x01\r
29#define DEBUG_PROPERTY_DEBUG_PRINT_ENABLED 0x02\r
30#define DEBUG_PROPERTY_DEBUG_CODE_ENABLED 0x04\r
31#define DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED 0x08\r
32#define DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED 0x10\r
33#define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED 0x20\r
34\r
35//\r
36// Declare bits for PcdDebugPrintErrorLevel and the ErrorLevel parameter of DebugPrint()\r
37//\r
38#define DEBUG_INIT 0x00000001 // Initialization\r
39#define DEBUG_WARN 0x00000002 // Warnings\r
40#define DEBUG_LOAD 0x00000004 // Load events\r
41#define DEBUG_FS 0x00000008 // EFI File system\r
42#define DEBUG_POOL 0x00000010 // Alloc & Free's\r
43#define DEBUG_PAGE 0x00000020 // Alloc & Free's\r
9a8e70ce 44#define DEBUG_INFO 0x00000040 // Informational debug messages\r
3ae55b76 45#define DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers\r
fb3df220 46#define DEBUG_VARIABLE 0x00000100 // Variable\r
47#define DEBUG_BM 0x00000400 // Boot Manager\r
48#define DEBUG_BLKIO 0x00001000 // BlkIo Driver\r
49#define DEBUG_NET 0x00004000 // SNI Driver\r
50#define DEBUG_UNDI 0x00010000 // UNDI Driver\r
48d97c8b 51#define DEBUG_LOADFILE 0x00020000 // LoadFile\r
fb3df220 52#define DEBUG_EVENT 0x00080000 // Event messages\r
5a2e7dd2 53#define DEBUG_GCD 0x00100000 // Global Coherency Database changes\r
54#define DEBUG_CACHE 0x00200000 // Memory range cachability changes\r
9a8e70ce 55#define DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may significantly impact boot performance\r
fb3df220 56#define DEBUG_ERROR 0x80000000 // Error\r
57\r
58//\r
59// Aliases of debug message mask bits\r
60//\r
61#define EFI_D_INIT DEBUG_INIT\r
62#define EFI_D_WARN DEBUG_WARN\r
63#define EFI_D_LOAD DEBUG_LOAD\r
64#define EFI_D_FS DEBUG_FS\r
65#define EFI_D_POOL DEBUG_POOL\r
66#define EFI_D_PAGE DEBUG_PAGE\r
67#define EFI_D_INFO DEBUG_INFO\r
c759eb45 68#define EFI_D_DISPATCH DEBUG_DISPATCH\r
fb3df220 69#define EFI_D_VARIABLE DEBUG_VARIABLE\r
70#define EFI_D_BM DEBUG_BM\r
71#define EFI_D_BLKIO DEBUG_BLKIO\r
72#define EFI_D_NET DEBUG_NET\r
73#define EFI_D_UNDI DEBUG_UNDI\r
74#define EFI_D_LOADFILE DEBUG_LOADFILE\r
75#define EFI_D_EVENT DEBUG_EVENT\r
9a8e70ce 76#define EFI_D_VERBOSE DEBUG_VERBOSE\r
fb3df220 77#define EFI_D_ERROR DEBUG_ERROR\r
78\r
79/**\r
fb3df220 80 Prints a debug message to the debug output device if the specified error level is enabled.\r
81\r
2891fc8b 82 If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function \r
83 GetDebugPrintErrorLevel (), then print the message specified by Format and the \r
84 associated variable argument list to the debug output device.\r
fb3df220 85\r
86 If Format is NULL, then ASSERT().\r
87\r
88 @param ErrorLevel The error level of the debug message.\r
af2dc6a7 89 @param Format The format string for the debug message to print.\r
90 @param ... The variable argument list whose contents are accessed \r
285010e7 91 based on the format string specified by Format.\r
fb3df220 92\r
93**/\r
94VOID\r
95EFIAPI\r
96DebugPrint (\r
97 IN UINTN ErrorLevel,\r
98 IN CONST CHAR8 *Format,\r
99 ...\r
100 );\r
101\r
102\r
103/**\r
fb3df220 104 Prints an assert message containing a filename, line number, and description. \r
105 This may be followed by a breakpoint or a dead loop.\r
106\r
107 Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"\r
108 to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of \r
109 PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if \r
110 DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then \r
111 CpuDeadLoop() is called. If neither of these bits are set, then this function \r
112 returns immediately after the message is printed to the debug output device.\r
584125bc 113 DebugAssert() must actively prevent recursion. If DebugAssert() is called while\r
fb3df220 114 processing another DebugAssert(), then DebugAssert() must return immediately.\r
115\r
584125bc 116 If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.\r
584125bc 117 If Description is NULL, then a <Description> string of "(NULL) Description" is printed.\r
fb3df220 118\r
af2dc6a7 119 @param FileName The pointer to the name of the source file that generated the assert condition.\r
fb3df220 120 @param LineNumber The line number in the source file that generated the assert condition\r
af2dc6a7 121 @param Description The pointer to the description of the assert condition.\r
fb3df220 122\r
123**/\r
124VOID\r
125EFIAPI\r
126DebugAssert (\r
127 IN CONST CHAR8 *FileName,\r
128 IN UINTN LineNumber,\r
129 IN CONST CHAR8 *Description\r
130 );\r
131\r
132\r
133/**\r
fb3df220 134 Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.\r
135\r
136 This function fills Length bytes of Buffer with the value specified by \r
137 PcdDebugClearMemoryValue, and returns Buffer.\r
138\r
139 If Buffer is NULL, then ASSERT().\r
2281e7a9 140 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
fb3df220 141\r
af2dc6a7 142 @param Buffer The pointer to the target buffer to be filled with PcdDebugClearMemoryValue.\r
143 @param Length The number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. \r
fb3df220 144\r
af2dc6a7 145 @return Buffer The pointer to the target buffer filled with PcdDebugClearMemoryValue.\r
fb3df220 146\r
147**/\r
148VOID *\r
149EFIAPI\r
150DebugClearMemory (\r
151 OUT VOID *Buffer,\r
152 IN UINTN Length\r
153 );\r
154\r
155\r
156/**\r
fb3df220 157 Returns TRUE if ASSERT() macros are enabled.\r
158\r
159 This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of \r
af2dc6a7 160 PcdDebugProperyMask is set. Otherwise, FALSE is returned.\r
fb3df220 161\r
162 @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.\r
163 @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.\r
164\r
165**/\r
166BOOLEAN\r
167EFIAPI\r
168DebugAssertEnabled (\r
169 VOID\r
170 );\r
171\r
172\r
3e5c3238 173/** \r
174 Returns TRUE if DEBUG() macros are enabled.\r
fb3df220 175\r
176 This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of \r
af2dc6a7 177 PcdDebugProperyMask is set. Otherwise, FALSE is returned.\r
fb3df220 178\r
179 @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.\r
180 @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.\r
181\r
182**/\r
183BOOLEAN\r
184EFIAPI\r
185DebugPrintEnabled (\r
186 VOID\r
187 );\r
188\r
189\r
3e5c3238 190/** \r
191 Returns TRUE if DEBUG_CODE() macros are enabled.\r
fb3df220 192\r
193 This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of \r
af2dc6a7 194 PcdDebugProperyMask is set. Otherwise, FALSE is returned.\r
fb3df220 195\r
196 @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.\r
197 @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.\r
198\r
199**/\r
200BOOLEAN\r
201EFIAPI\r
202DebugCodeEnabled (\r
203 VOID\r
204 );\r
205\r
206\r
3e5c3238 207/** \r
208 Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.\r
fb3df220 209\r
eceb3a4c 210 This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of \r
af2dc6a7 211 PcdDebugProperyMask is set. Otherwise, FALSE is returned.\r
fb3df220 212\r
eceb3a4c
LG
213 @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.\r
214 @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.\r
fb3df220 215\r
216**/\r
217BOOLEAN\r
218EFIAPI\r
219DebugClearMemoryEnabled (\r
220 VOID\r
221 );\r
222\r
5ea9d0c3
LG
223/**\r
224 Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.\r
225\r
226 This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.\r
227\r
228 @retval TRUE Current ErrorLevel is supported.\r
229 @retval FALSE Current ErrorLevel is not supported.\r
230\r
231**/\r
232BOOLEAN\r
233EFIAPI\r
234DebugPrintLevelEnabled (\r
235 IN CONST UINTN ErrorLevel\r
236 );\r
fb3df220 237\r
3e5c3238 238/** \r
fb3df220 239 Internal worker macro that calls DebugAssert().\r
240\r
1a2f870c 241 This macro calls DebugAssert(), passing in the filename, line number, and an\r
242 expression that evaluated to FALSE.\r
fb3df220 243\r
1a2f870c 244 @param Expression Boolean expression that evaluated to FALSE\r
fb3df220 245\r
246**/\r
247#define _ASSERT(Expression) DebugAssert (__FILE__, __LINE__, #Expression)\r
248\r
249\r
3e5c3238 250/** \r
fb3df220 251 Internal worker macro that calls DebugPrint().\r
252\r
253 This macro calls DebugPrint() passing in the debug error level, a format \r
254 string, and a variable argument list.\r
79142ebf 255 __VA_ARGS__ is not supported by EBC compiler, Microsoft Visual Studio .NET 2003\r
6e6f5e03 256 and Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830.\r
fb3df220 257\r
258 @param Expression Expression containing an error level, a format string, \r
259 and a variable argument list based on the format string.\r
260\r
261**/\r
fb3df220 262\r
d9a55c78 263#if !defined(MDE_CPU_EBC) && (!defined (_MSC_VER) || _MSC_VER > 1400)\r
5ea9d0c3
LG
264 #define _DEBUG_PRINT(PrintLevel, ...) \\r
265 do { \\r
266 if (DebugPrintLevelEnabled (PrintLevel)) { \\r
267 DebugPrint (PrintLevel, ##__VA_ARGS__); \\r
268 } \\r
269 } while (FALSE)\r
270 #define _DEBUG(Expression) _DEBUG_PRINT Expression\r
271#else\r
272#define _DEBUG(Expression) DebugPrint Expression\r
273#endif\r
fb3df220 274\r
3e5c3238 275/** \r
1a2f870c 276 Macro that calls DebugAssert() if an expression evaluates to FALSE.\r
fb3df220 277\r
c9ec7047 278 If MDEPKG_NDEBUG is not defined and the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED \r
279 bit of PcdDebugProperyMask is set, then this macro evaluates the Boolean \r
280 expression specified by Expression. If Expression evaluates to FALSE, then \r
281 DebugAssert() is called passing in the source filename, source line number, \r
282 and Expression.\r
fb3df220 283\r
af2dc6a7 284 @param Expression Boolean expression.\r
fb3df220 285\r
286**/\r
c9ec7047 287#if !defined(MDEPKG_NDEBUG) \r
288 #define ASSERT(Expression) \\r
289 do { \\r
290 if (DebugAssertEnabled ()) { \\r
291 if (!(Expression)) { \\r
292 _ASSERT (Expression); \\r
293 } \\r
294 } \\r
295 } while (FALSE)\r
296#else\r
297 #define ASSERT(Expression)\r
298#endif\r
fb3df220 299\r
3e5c3238 300/** \r
fb3df220 301 Macro that calls DebugPrint().\r
302\r
c9ec7047 303 If MDEPKG_NDEBUG is not defined and the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED \r
304 bit of PcdDebugProperyMask is set, then this macro passes Expression to \r
305 DebugPrint().\r
fb3df220 306\r
307 @param Expression Expression containing an error level, a format string, \r
308 and a variable argument list based on the format string.\r
309 \r
310\r
311**/\r
c9ec7047 312#if !defined(MDEPKG_NDEBUG) \r
313 #define DEBUG(Expression) \\r
314 do { \\r
315 if (DebugPrintEnabled ()) { \\r
316 _DEBUG (Expression); \\r
317 } \\r
318 } while (FALSE)\r
319#else\r
320 #define DEBUG(Expression)\r
321#endif\r
fb3df220 322\r
3e5c3238 323/** \r
fb3df220 324 Macro that calls DebugAssert() if an EFI_STATUS evaluates to an error code.\r
325\r
c9ec7047 326 If MDEPKG_NDEBUG is not defined and the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED \r
327 bit of PcdDebugProperyMask is set, then this macro evaluates the EFI_STATUS \r
328 value specified by StatusParameter. If StatusParameter is an error code, \r
329 then DebugAssert() is called passing in the source filename, source line \r
330 number, and StatusParameter.\r
fb3df220 331\r
332 @param StatusParameter EFI_STATUS value to evaluate.\r
333\r
334**/\r
c9ec7047 335#if !defined(MDEPKG_NDEBUG)\r
336 #define ASSERT_EFI_ERROR(StatusParameter) \\r
337 do { \\r
338 if (DebugAssertEnabled ()) { \\r
339 if (EFI_ERROR (StatusParameter)) { \\r
340 DEBUG ((EFI_D_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", StatusParameter)); \\r
341 _ASSERT (!EFI_ERROR (StatusParameter)); \\r
342 } \\r
343 } \\r
344 } while (FALSE)\r
345#else\r
346 #define ASSERT_EFI_ERROR(StatusParameter)\r
347#endif\r
fb3df220 348\r
3e5c3238 349/** \r
fb3df220 350 Macro that calls DebugAssert() if a protocol is already installed in the \r
351 handle database.\r
352\r
c9ec7047 353 If MDEPKG_NDEBUG is defined or the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit \r
354 of PcdDebugProperyMask is clear, then return.\r
fb3df220 355\r
356 If Handle is NULL, then a check is made to see if the protocol specified by Guid \r
357 is present on any handle in the handle database. If Handle is not NULL, then \r
358 a check is made to see if the protocol specified by Guid is present on the \r
359 handle specified by Handle. If the check finds the protocol, then DebugAssert() \r
360 is called passing in the source filename, source line number, and Guid.\r
361\r
362 If Guid is NULL, then ASSERT().\r
363\r
364 @param Handle The handle to check for the protocol. This is an optional \r
365 parameter that may be NULL. If it is NULL, then the entire \r
366 handle database is searched.\r
367\r
af2dc6a7 368 @param Guid The pointer to a protocol GUID.\r
fb3df220 369\r
370**/\r
c9ec7047 371#if !defined(MDEPKG_NDEBUG)\r
372 #define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid) \\r
373 do { \\r
374 if (DebugAssertEnabled ()) { \\r
375 VOID *Instance; \\r
376 ASSERT (Guid != NULL); \\r
377 if (Handle == NULL) { \\r
378 if (!EFI_ERROR (gBS->LocateProtocol ((EFI_GUID *)Guid, NULL, &Instance))) { \\r
379 _ASSERT (Guid already installed in database); \\r
380 } \\r
381 } else { \\r
382 if (!EFI_ERROR (gBS->HandleProtocol (Handle, (EFI_GUID *)Guid, &Instance))) { \\r
383 _ASSERT (Guid already installed on Handle); \\r
384 } \\r
385 } \\r
386 } \\r
387 } while (FALSE)\r
388#else\r
389 #define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid)\r
390#endif\r
fb3df220 391\r
392/**\r
393 Macro that marks the beginning of debug source code.\r
394\r
395 If the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set, \r
396 then this macro marks the beginning of source code that is included in a module.\r
397 Otherwise, the source lines between DEBUG_CODE_BEGIN() and DEBUG_CODE_END() \r
398 are not included in a module.\r
399\r
400**/\r
401#define DEBUG_CODE_BEGIN() do { if (DebugCodeEnabled ()) { UINT8 __DebugCodeLocal\r
402\r
403\r
3e5c3238 404/** \r
af2dc6a7 405 The macro that marks the end of debug source code.\r
fb3df220 406\r
407 If the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set, \r
408 then this macro marks the end of source code that is included in a module. \r
409 Otherwise, the source lines between DEBUG_CODE_BEGIN() and DEBUG_CODE_END() \r
410 are not included in a module.\r
411\r
412**/\r
413#define DEBUG_CODE_END() __DebugCodeLocal = 0; __DebugCodeLocal++; } } while (FALSE)\r
414\r
415\r
3e5c3238 416/** \r
af2dc6a7 417 The macro that declares a section of debug source code.\r
fb3df220 418\r
419 If the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set, \r
420 then the source code specified by Expression is included in a module. \r
421 Otherwise, the source specified by Expression is not included in a module.\r
422\r
423**/\r
424#define DEBUG_CODE(Expression) \\r
425 DEBUG_CODE_BEGIN (); \\r
426 Expression \\r
427 DEBUG_CODE_END ()\r
428\r
429\r
3e5c3238 430/** \r
af2dc6a7 431 The macro that calls DebugClearMemory() to clear a buffer to a default value.\r
fb3df220 432\r
433 If the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set, \r
434 then this macro calls DebugClearMemory() passing in Address and Length.\r
435\r
af2dc6a7 436 @param Address The pointer to a buffer.\r
fb3df220 437 @param Length The number of bytes in the buffer to set.\r
438\r
439**/\r
440#define DEBUG_CLEAR_MEMORY(Address, Length) \\r
441 do { \\r
442 if (DebugClearMemoryEnabled ()) { \\r
443 DebugClearMemory (Address, Length); \\r
444 } \\r
445 } while (FALSE)\r
446\r
447\r
448/**\r
fb3df220 449 Macro that calls DebugAssert() if the containing record does not have a \r
450 matching signature. If the signatures matches, then a pointer to the data \r
451 structure that contains a specified field of that data structure is returned. \r
af2dc6a7 452 This is a lightweight method hide information by placing a public data \r
fb3df220 453 structure inside a larger private data structure and using a pointer to the \r
454 public data structure to retrieve a pointer to the private data structure.\r
455\r
c9ec7047 456 If MDEPKG_NDEBUG is defined or the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit \r
457 of PcdDebugProperyMask is clear, then this macro computes the offset, in bytes,\r
af2dc6a7 458 of the field specified by Field from the beginning of the data structure specified \r
c9ec7047 459 by TYPE. This offset is subtracted from Record, and is used to return a pointer \r
460 to a data structure of the type specified by TYPE.\r
461\r
462 If MDEPKG_NDEBUG is not defined and the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit\r
463 of PcdDebugProperyMask is set, then this macro computes the offset, in bytes, \r
464 of field specified by Field from the beginning of the data structure specified \r
465 by TYPE. This offset is subtracted from Record, and is used to compute a pointer\r
466 to a data structure of the type specified by TYPE. The Signature field of the \r
467 data structure specified by TYPE is compared to TestSignature. If the signatures \r
468 match, then a pointer to the pointer to a data structure of the type specified by \r
469 TYPE is returned. If the signatures do not match, then DebugAssert() is called \r
470 with a description of "CR has a bad signature" and Record is returned. \r
fb3df220 471\r
472 If the data type specified by TYPE does not contain the field specified by Field, \r
473 then the module will not compile.\r
474\r
475 If TYPE does not contain a field called Signature, then the module will not \r
476 compile.\r
477\r
af2dc6a7 478 @param Record The pointer to the field specified by Field within a data \r
fb3df220 479 structure of type TYPE.\r
480\r
481 @param TYPE The name of the data structure type to return This \r
482 data structure must contain the field specified by Field. \r
483\r
484 @param Field The name of the field in the data structure specified \r
485 by TYPE to which Record points.\r
486\r
487 @param TestSignature The 32-bit signature value to match.\r
488\r
489**/\r
c9ec7047 490#if !defined(MDEPKG_NDEBUG)\r
491 #define CR(Record, TYPE, Field, TestSignature) \\r
492 (DebugAssertEnabled () && (BASE_CR (Record, TYPE, Field)->Signature != TestSignature)) ? \\r
493 (TYPE *) (_ASSERT (CR has Bad Signature), Record) : \\r
494 BASE_CR (Record, TYPE, Field)\r
495#else\r
496 #define CR(Record, TYPE, Field, TestSignature) \\r
497 BASE_CR (Record, TYPE, Field)\r
498#endif\r
fb3df220 499 \r
500#endif\r