mirror of https://github.com/acidanthera/audk.git
Update PeiDxeDebugLibReportStatusCode library instance to print partial ASSERT message if ASSERT message is too big.
Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13339 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
d4605c23ea
commit
ea1b39e617
|
@ -258,44 +258,71 @@ DebugAssert (
|
||||||
{
|
{
|
||||||
UINT64 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE / sizeof(UINT64)];
|
UINT64 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE / sizeof(UINT64)];
|
||||||
EFI_DEBUG_ASSERT_DATA *AssertData;
|
EFI_DEBUG_ASSERT_DATA *AssertData;
|
||||||
|
UINTN HeaderSize;
|
||||||
UINTN TotalSize;
|
UINTN TotalSize;
|
||||||
CHAR8 *Temp;
|
CHAR8 *Temp;
|
||||||
UINTN FileNameSize;
|
UINTN FileNameSize;
|
||||||
UINTN DescriptionSize;
|
UINTN DescriptionSize;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make sure it will all fit in the passed in buffer
|
// Get string size
|
||||||
//
|
//
|
||||||
FileNameSize = AsciiStrSize (FileName);
|
HeaderSize = sizeof (EFI_DEBUG_ASSERT_DATA);
|
||||||
DescriptionSize = AsciiStrSize (Description);
|
FileNameSize = AsciiStrSize (FileName);
|
||||||
TotalSize = sizeof (EFI_DEBUG_ASSERT_DATA) + FileNameSize + DescriptionSize;
|
DescriptionSize = AsciiStrSize (Description);
|
||||||
if (TotalSize <= sizeof (Buffer)) {
|
|
||||||
//
|
|
||||||
// Fill in EFI_DEBUG_ASSERT_DATA
|
|
||||||
//
|
|
||||||
AssertData = (EFI_DEBUG_ASSERT_DATA *)Buffer;
|
|
||||||
AssertData->LineNumber = (UINT32)LineNumber;
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Make sure it will all fit in the passed in buffer.
|
||||||
|
//
|
||||||
|
if (HeaderSize + FileNameSize + DescriptionSize > sizeof (Buffer)) {
|
||||||
//
|
//
|
||||||
// Copy Ascii FileName including NULL.
|
// FileName + Description is too long to be filled into buffer.
|
||||||
//
|
//
|
||||||
Temp = AsciiStrCpy ((CHAR8 *)(AssertData + 1), FileName);
|
if (HeaderSize + FileNameSize < sizeof (Buffer)) {
|
||||||
|
//
|
||||||
//
|
// Description has enough buffer to be truncated.
|
||||||
// Copy Ascii Description
|
//
|
||||||
//
|
DescriptionSize = sizeof (Buffer) - HeaderSize - FileNameSize;
|
||||||
AsciiStrCpy (Temp + FileNameSize, Description);
|
} else {
|
||||||
|
//
|
||||||
REPORT_STATUS_CODE_EX (
|
// FileName is too long to be filled into buffer.
|
||||||
(EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED),
|
// FileName will be truncated. Reserved one byte for Description NULL terminator.
|
||||||
(EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE),
|
//
|
||||||
0,
|
DescriptionSize = 1;
|
||||||
NULL,
|
FileNameSize = sizeof (Buffer) - HeaderSize - DescriptionSize;
|
||||||
NULL,
|
}
|
||||||
AssertData,
|
|
||||||
TotalSize
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fill in EFI_DEBUG_ASSERT_DATA
|
||||||
|
//
|
||||||
|
AssertData = (EFI_DEBUG_ASSERT_DATA *)Buffer;
|
||||||
|
AssertData->LineNumber = (UINT32)LineNumber;
|
||||||
|
TotalSize = sizeof (EFI_DEBUG_ASSERT_DATA);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copy Ascii FileName including NULL terminator.
|
||||||
|
//
|
||||||
|
Temp = AsciiStrnCpy ((CHAR8 *)(AssertData + 1), FileName, FileNameSize);
|
||||||
|
Temp[FileNameSize - 1] = 0;
|
||||||
|
TotalSize += FileNameSize;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copy Ascii Description include NULL terminator.
|
||||||
|
//
|
||||||
|
Temp = AsciiStrnCpy (Temp + FileNameSize, Description, DescriptionSize);
|
||||||
|
Temp[DescriptionSize - 1] = 0;
|
||||||
|
TotalSize += DescriptionSize;
|
||||||
|
|
||||||
|
REPORT_STATUS_CODE_EX (
|
||||||
|
(EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED),
|
||||||
|
(EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE),
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
AssertData,
|
||||||
|
TotalSize
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
|
// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
|
||||||
|
|
Loading…
Reference in New Issue