[edk2-devel] [Question] How to get debug or release information in codes.

krishnaLee sssky307 at 163.com
Thu May 2 02:55:28 UTC 2019


Hi, 


I want to add some memory leak test in only in a module's debug mode,
if "build -p xxx.dsc -m xxx.inf -b DEBUG", the memoryleak test will work,
if "build -p xxx.dsc -m xxx.inf -b RELEASE", no memoryleak test.


/* the added codes for test only in debug mode. */
#ifdef _DEBUG
#define AllocateZeroPool(x) LogMalloc(x)
#define FreePool(x) LogFree(x)
#define CHECK_MEMORY_LEAK(CheckPoint) CheckLogForMemoryLeak(CheckPoint)
#else
#define CHECK_MEMORY_LEAK(CheckPoint)
#endif // _DEBUG


the question is how to bind "_DEBUG"  to debug-build-mode?


and I found something in ShellPkg.dsc,some API  have both debug and release implementation for this,is this the only way?
!if $(TARGET) == RELEASE
  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
!else
  DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
!endif






thanks,
Krishna.






-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#39902): https://edk2.groups.io/g/devel/message/39902
Mute This Topic: https://groups.io/mt/31452690/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20190502/61853ace/attachment.htm>


More information about the edk2-devel-archive mailing list