public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [Question] How to get debug or release information in codes.
@ 2019-05-02  2:55 krishnaLee
  2019-05-02 10:03 ` Laszlo Ersek
  0 siblings, 1 reply; 2+ messages in thread
From: krishnaLee @ 2019-05-02  2:55 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 871 bytes --]

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.






[-- Attachment #2: Type: text/html, Size: 1357 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-02 10:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-02  2:55 [edk2-devel] [Question] How to get debug or release information in codes krishnaLee
2019-05-02 10:03 ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox