summaryrefslogtreecommitdiff
path: root/Core
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2017-05-23 12:28:51 +0800
committerGuo Mang <mang.guo@intel.com>2017-07-12 11:24:46 +0800
commit4ba1fc4b7c091368e9d80b98f5866fbd6c12b3c4 (patch)
treeef02de7946b563e2c9776e29bd125374598abbe8 /Core
parentb5e5587d1ece37cfe5d71bd7475ad7e2f632dfc9 (diff)
downloadedk2-platforms-4ba1fc4b7c091368e9d80b98f5866fbd6c12b3c4.tar.xz
MdeModulePkg SmiHandlerProfile: Fix no PDB case handling incorrectly
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=569 The PdbStringOffset should be set to 0 for no PDB case, then SmiHandlerProfileInfo can use it to know whether there is PCD info or not. Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> (cherry picked from commit 8ced192d5cf1e8ccd56fa5daed2c2ca28fb04cff)
Diffstat (limited to 'Core')
-rw-r--r--Core/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c10
-rw-r--r--Core/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c8
2 files changed, 12 insertions, 6 deletions
diff --git a/Core/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c b/Core/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
index 2419cd2959..338671374c 100644
--- a/Core/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
+++ b/Core/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
@@ -266,8 +266,8 @@ GetDriverNameString (
//
// Method 1: Get the name string from image PDB
//
- if (ImageStruct->Header.Length > sizeof (SMM_CORE_IMAGE_DATABASE_STRUCTURE)) {
- GetShortPdbFileName ((CHAR8 *) (ImageStruct + 1), mNameString);
+ if (ImageStruct->PdbStringOffset != 0) {
+ GetShortPdbFileName ((CHAR8 *) ((UINTN) ImageStruct + ImageStruct->PdbStringOffset), mNameString);
return mNameString;
}
@@ -355,8 +355,10 @@ DumpSmmLoadedImage(
Print(L" FvFile=\"%g\"", &ImageStruct->FileGuid);
Print(L" RefId=\"0x%x\"", ImageStruct->ImageRef);
Print(L">\n");
- PdbString = (CHAR8 *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset);
- Print(L" <Pdb>%a</Pdb>\n", PdbString);
+ if (ImageStruct->PdbStringOffset != 0) {
+ PdbString = (CHAR8 *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset);
+ Print(L" <Pdb>%a</Pdb>\n", PdbString);
+ }
Print(L" </Image>\n");
}
diff --git a/Core/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c b/Core/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c
index 63dcf6e3a1..49eba945fd 100644
--- a/Core/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c
+++ b/Core/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c
@@ -651,8 +651,12 @@ GetSmmImageDatabaseData (
ImageStruct->EntryPoint = mImageStruct[Index].EntryPoint;
ImageStruct->ImageBase = mImageStruct[Index].ImageBase;
ImageStruct->ImageSize = mImageStruct[Index].ImageSize;
- ImageStruct->PdbStringOffset = sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE);
- CopyMem ((VOID *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset), mImageStruct[Index].PdbString, mImageStruct[Index].PdbStringSize);
+ if (mImageStruct[Index].PdbStringSize != 0) {
+ ImageStruct->PdbStringOffset = sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE);
+ CopyMem ((VOID *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset), mImageStruct[Index].PdbString, mImageStruct[Index].PdbStringSize);
+ } else {
+ ImageStruct->PdbStringOffset = 0;
+ }
ImageStruct = (SMM_CORE_IMAGE_DATABASE_STRUCTURE *)((UINTN)ImageStruct + ImageStruct->Header.Length);
Size += sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE) + mImageStruct[Index].PdbStringSize;
}