* [PATCH] MdeModulePkg SmiHandlerProfile: Fix no PDB case handling incorrectly
@ 2017-05-23 4:34 Star Zeng
2017-05-23 6:04 ` Yao, Jiewen
0 siblings, 1 reply; 2+ messages in thread
From: Star Zeng @ 2017-05-23 4:34 UTC (permalink / raw)
To: edk2-devel; +Cc: Star Zeng, Jiewen Yao
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>
---
.../Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c | 10 ++++++----
MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c | 8 ++++++--
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
index 2419cd2959a9..338671374c72 100644
--- a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
+++ b/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/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c b/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c
index 63dcf6e3a1e7..49eba945fd9a 100644
--- a/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c
+++ b/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;
}
--
2.7.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] MdeModulePkg SmiHandlerProfile: Fix no PDB case handling incorrectly
2017-05-23 4:34 [PATCH] MdeModulePkg SmiHandlerProfile: Fix no PDB case handling incorrectly Star Zeng
@ 2017-05-23 6:04 ` Yao, Jiewen
0 siblings, 0 replies; 2+ messages in thread
From: Yao, Jiewen @ 2017-05-23 6:04 UTC (permalink / raw)
To: Zeng, Star, edk2-devel@lists.01.org
Reviewed-by: Jiewen.yao@intel.com
> -----Original Message-----
> From: Zeng, Star
> Sent: Tuesday, May 23, 2017 12:34 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [PATCH] 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>
> ---
> .../Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c | 10 ++++++----
> MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c | 8
> ++++++--
> 2 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git
> a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
> b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
> index 2419cd2959a9..338671374c72 100644
> ---
> a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
> +++
> b/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/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c
> b/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c
> index 63dcf6e3a1e7..49eba945fd9a 100644
> --- a/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c
> +++ b/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;
> }
> --
> 2.7.0.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-23 6:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-23 4:34 [PATCH] MdeModulePkg SmiHandlerProfile: Fix no PDB case handling incorrectly Star Zeng
2017-05-23 6:04 ` Yao, Jiewen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox