summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c51
1 files changed, 36 insertions, 15 deletions
diff --git a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
index cfdd2f50d5..7b07916bbd 100644
--- a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
+++ b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
@@ -268,6 +268,7 @@ DebugAssert (
UINTN HeaderSize;
UINTN TotalSize;
CHAR8 *Temp;
+ UINTN ModuleNameSize;
UINTN FileNameSize;
UINTN DescriptionSize;
@@ -275,31 +276,40 @@ DebugAssert (
// Get string size
//
HeaderSize = sizeof (EFI_DEBUG_ASSERT_DATA);
+ //
+ // Compute string size of module name enclosed by []
+ //
+ ModuleNameSize = 2 + AsciiStrSize (gEfiCallerBaseName);
FileNameSize = AsciiStrSize (FileName);
DescriptionSize = AsciiStrSize (Description);
//
// Make sure it will all fit in the passed in buffer.
//
- if (HeaderSize + FileNameSize + DescriptionSize > sizeof (Buffer)) {
+ if (HeaderSize + ModuleNameSize + FileNameSize + DescriptionSize > sizeof (Buffer)) {
//
- // FileName + Description is too long to be filled into buffer.
+ // remove module name if it's too long to be filled into buffer
//
- if (HeaderSize + FileNameSize < sizeof (Buffer)) {
- //
- // Description has enough buffer to be truncated.
- //
- DescriptionSize = sizeof (Buffer) - HeaderSize - FileNameSize;
- } else {
+ ModuleNameSize = 0;
+ if (HeaderSize + FileNameSize + DescriptionSize > sizeof (Buffer)) {
//
- // FileName is too long to be filled into buffer.
- // FileName will be truncated. Reserved one byte for Description NULL terminator.
+ // FileName + Description is too long to be filled into buffer.
//
- DescriptionSize = 1;
- FileNameSize = sizeof (Buffer) - HeaderSize - DescriptionSize;
+ if (HeaderSize + FileNameSize < sizeof (Buffer)) {
+ //
+ // Description has enough buffer to be truncated.
+ //
+ DescriptionSize = sizeof (Buffer) - HeaderSize - FileNameSize;
+ } else {
+ //
+ // FileName is too long to be filled into buffer.
+ // FileName will be truncated. Reserved one byte for Description NULL terminator.
+ //
+ DescriptionSize = 1;
+ FileNameSize = sizeof (Buffer) - HeaderSize - DescriptionSize;
+ }
}
}
-
//
// Fill in EFI_DEBUG_ASSERT_DATA
//
@@ -307,12 +317,23 @@ DebugAssert (
AssertData->LineNumber = (UINT32)LineNumber;
TotalSize = sizeof (EFI_DEBUG_ASSERT_DATA);
+ Temp = (CHAR8 *)(AssertData + 1);
+
+ //
+ // Copy Ascii [ModuleName].
+ //
+ if (ModuleNameSize != 0) {
+ CopyMem(Temp, "[", 1);
+ CopyMem(Temp + 1, gEfiCallerBaseName, ModuleNameSize - 3);
+ CopyMem(Temp + ModuleNameSize - 2, "] ", 2);
+ }
+
//
// Copy Ascii FileName including NULL terminator.
//
- Temp = CopyMem (AssertData + 1, FileName, FileNameSize);
+ Temp = CopyMem (Temp + ModuleNameSize, FileName, FileNameSize);
Temp[FileNameSize - 1] = 0;
- TotalSize += FileNameSize;
+ TotalSize += (ModuleNameSize + FileNameSize);
//
// Copy Ascii Description include NULL terminator.