From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 48C8721A16E47 for ; Mon, 22 May 2017 23:04:31 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP; 22 May 2017 23:04:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,380,1491289200"; d="scan'208";a="1173055381" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga002.fm.intel.com with ESMTP; 22 May 2017 23:04:30 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 22 May 2017 23:04:26 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.246]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.193]) with mapi id 14.03.0319.002; Tue, 23 May 2017 14:04:25 +0800 From: "Yao, Jiewen" To: "Zeng, Star" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] MdeModulePkg SmiHandlerProfile: Fix no PDB case handling incorrectly Thread-Index: AQHS033e3qK4vpYGRUuBy5DzhSSgAKIBbdPg Date: Tue, 23 May 2017 06:04:24 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503A953ED9@shsmsx102.ccr.corp.intel.com> References: <1495514049-71204-1-git-send-email-star.zeng@intel.com> In-Reply-To: <1495514049-71204-1-git-send-email-star.zeng@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg SmiHandlerProfile: Fix no PDB case handling incorrectly X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 May 2017 06:04:31 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 ; Yao, Jiewen > Subject: [PATCH] MdeModulePkg SmiHandlerProfile: Fix no PDB case handling > incorrectly >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D569 >=20 > 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. >=20 > Cc: Jiewen Yao > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Star Zeng > --- > .../Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c | 10 ++++= ++---- > MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c | 8 > ++++++-- > 2 files changed, 12 insertions(+), 6 deletions(-) >=20 > 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 !=3D 0) { > + GetShortPdbFileName ((CHAR8 *) ((UINTN) ImageStruct + > ImageStruct->PdbStringOffset), mNameString); > return mNameString; > } >=20 > @@ -355,8 +355,10 @@ DumpSmmLoadedImage( > Print(L" FvFile=3D\"%g\"", &ImageStruct->FileGuid); > Print(L" RefId=3D\"0x%x\"", ImageStruct->ImageRef); > Print(L">\n"); > - PdbString =3D (CHAR8 *)((UINTN)ImageStruct + > ImageStruct->PdbStringOffset); > - Print(L" %a\n", PdbString); > + if (ImageStruct->PdbStringOffset !=3D 0) { > + PdbString =3D (CHAR8 *)((UINTN)ImageStruct + > ImageStruct->PdbStringOffset); > + Print(L" %a\n", PdbString); > + } > Print(L" \n"); > } >=20 > 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 =3D mImageStruct[Index].EntryPoint; > ImageStruct->ImageBase =3D mImageStruct[Index].ImageBase; > ImageStruct->ImageSize =3D mImageStruct[Index].ImageSize; > - ImageStruct->PdbStringOffset =3D > sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE); > - CopyMem ((VOID *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset)= , > mImageStruct[Index].PdbString, mImageStruct[Index].PdbStringSize); > + if (mImageStruct[Index].PdbStringSize !=3D 0) { > + ImageStruct->PdbStringOffset =3D > sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE); > + CopyMem ((VOID *)((UINTN)ImageStruct + > ImageStruct->PdbStringOffset), mImageStruct[Index].PdbString, > mImageStruct[Index].PdbStringSize); > + } else { > + ImageStruct->PdbStringOffset =3D 0; > + } > ImageStruct =3D (SMM_CORE_IMAGE_DATABASE_STRUCTURE > *)((UINTN)ImageStruct + ImageStruct->Header.Length); > Size +=3D sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE) + > mImageStruct[Index].PdbStringSize; > } > -- > 2.7.0.windows.1