mirror of https://github.com/acidanthera/audk.git
IntelFrameworkModulePkg: 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. In V2: Updated patch to use CopyMem instead of AsciiSPrint. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Baraneedharan Anbazhagan <anbazhagan@hp.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19129 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
39eccb9c66
commit
1ffe7cc562
|
@ -268,6 +268,7 @@ DebugAssert (
|
|||
UINTN HeaderSize;
|
||||
UINTN TotalSize;
|
||||
CHAR8 *Temp;
|
||||
UINTN ModuleNameSize;
|
||||
UINTN FileNameSize;
|
||||
UINTN DescriptionSize;
|
||||
|
||||
|
@ -275,12 +276,21 @@ 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 + ModuleNameSize + FileNameSize + DescriptionSize > sizeof (Buffer)) {
|
||||
//
|
||||
// remove module name if it's too long to be filled into buffer
|
||||
//
|
||||
ModuleNameSize = 0;
|
||||
if (HeaderSize + FileNameSize + DescriptionSize > sizeof (Buffer)) {
|
||||
//
|
||||
// FileName + Description is too long to be filled into buffer.
|
||||
|
@ -299,7 +309,7 @@ DebugAssert (
|
|||
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.
|
||||
|
|
Loading…
Reference in New Issue