From aa0a514967f4fb1dce1134b64b6f69aa87641de9 Mon Sep 17 00:00:00 2001 From: Baraneedharan Anbazhagan Date: Mon, 7 Dec 2015 03:06:02 +0000 Subject: [PATCH] MdePkg: DebugAssert enhancement If the assert happens in a library, then it's hard to determine which module using that library is generating that assert. Use gEfiCallerBaseName in DebugAssert to display the module name. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Baraneedharan Anbazhagan Reviewed-by: Liming Gao Reviewed-by: Jaben Carsey git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19127 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c | 2 +- MdePkg/Library/UefiDebugLibConOut/DebugLib.c | 3 ++- MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c | 3 ++- MdePkg/Library/UefiDebugLibStdErr/DebugLib.c | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c b/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c index 6fa235c2af..8ab084721e 100644 --- a/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c +++ b/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c @@ -133,7 +133,7 @@ DebugAssert ( // // Generate the ASSERT() message in Ascii format // - AsciiSPrint (Buffer, sizeof (Buffer), "ASSERT %a(%d): %a\n", FileName, LineNumber, Description); + AsciiSPrint (Buffer, sizeof (Buffer), "ASSERT [%a] %a(%d): %a\n", gEfiCallerBaseName, FileName, LineNumber, Description); // // Send the print string to the Console Output device diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c index 2ac2204e1d..0bc112fd1b 100644 --- a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c +++ b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c @@ -121,7 +121,8 @@ DebugAssert ( UnicodeSPrintAsciiFormat ( Buffer, sizeof (Buffer), - "ASSERT %a(%d): %a\n", + "ASSERT [%a] %a(%d): %a\n", + gEfiCallerBaseName, FileName, LineNumber, Description diff --git a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c index 10d3e347cc..44bf6ba128 100644 --- a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c +++ b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c @@ -175,7 +175,8 @@ DebugAssert ( AsciiSPrint ( Buffer, sizeof (Buffer), - "ASSERT %a(%d): %a\n", + "ASSERT [%a] %a(%d): %a\n", + gEfiCallerBaseName, FileName, LineNumber, Description diff --git a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c index bbd6d94644..cacb90a244 100644 --- a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c +++ b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c @@ -122,7 +122,8 @@ DebugAssert ( UnicodeSPrintAsciiFormat ( Buffer, sizeof (Buffer), - "ASSERT %a(%d): %a\n", + "ASSERT [%a] %a(%d): %a\n", + gEfiCallerBaseName, FileName, LineNumber, Description -- 2.39.2