From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.2440.1609899726698682258 for ; Tue, 05 Jan 2021 18:22:06 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: bob.c.feng@intel.com) IronPort-SDR: M5NU4W4ofWXWl+/uQdokmFi6q6r5+QJtx5x7DGMVq4TpP6MU01mDxDHMNEjNsjkFEq4jp3s5m+ 6hCN55I1HfyA== X-IronPort-AV: E=McAfee;i="6000,8403,9855"; a="177315954" X-IronPort-AV: E=Sophos;i="5.78,478,1599548400"; d="scan'208";a="177315954" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2021 18:22:05 -0800 IronPort-SDR: mielMBq1/De3dF9qZdBv5jlRW9WsjmgUyjmtehwzyT7ngpOHqv3i0FtHN9HUza6X31SP1vIcFa GlHA8reSQcwg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,478,1599548400"; d="scan'208";a="402538315" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.32]) by FMSMGA003.fm.intel.com with ESMTP; 05 Jan 2021 18:22:04 -0800 From: "Bob Feng" To: devel@edk2.groups.io Cc: Liming Gao , Yuwei Chen Subject: [Patch 1/1] BaseTools: Fix the build report crash issue Date: Wed, 6 Jan 2021 10:21:57 +0800 Message-Id: <20210106022157.1748-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.29.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In the following corner case, the build report will crash. This patch is to fix this problem. Case: Multiple SKU are used and 2 more DynamicHii structure Pcds are set in dsc file under different SKU. And 1 more of those Pcds are not used in any INF file. Signed-off-by: Bob Feng Cc: Liming Gao Cc: Yuwei Chen --- BaseTools/Source/Python/build/BuildReport.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index 3b1add9999d2..468772930ca1 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1123,14 +1123,15 @@ class PcdReport(object): for Sku in SkuList: SkuInfo = Pcd.SkuInfoList[Sku] if SkuInfo.DefaultStoreDict: DefaultStoreList = sorted(SkuInfo.DefaultStoreDict.keys()) for DefaultStore in DefaultStoreList: - OverrideValues = Pcd.SkuOverrideValues[Sku] - DscOverride = self.ParseStruct(OverrideValues[DefaultStore]) - if DscOverride: - break + OverrideValues = Pcd.SkuOverrideValues.get(Sku) + if OverrideValues: + DscOverride = self.ParseStruct(OverrideValues[DefaultStore]) + if DscOverride: + break if DscOverride: break if DscOverride: DscDefaultValue = True DscMatch = True @@ -1386,13 +1387,14 @@ class PcdReport(object): FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + DefaultStore + ')', Value)) else: FileWrite(File, ' %-*s : %6s %10s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', '(' + DefaultStore + ')', Value)) FileWrite(File, '%*s: %s: %s' % (self.MaxLen + 4, SkuInfo.VariableGuid, SkuInfo.VariableName, SkuInfo.VariableOffset)) if IsStructure: - OverrideValues = Pcd.SkuOverrideValues[Sku] - OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[DefaultStore]) - self.PrintStructureInfo(File, OverrideFieldStruct) + OverrideValues = Pcd.SkuOverrideValues.get(Sku) + if OverrideValues: + OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[DefaultStore]) + self.PrintStructureInfo(File, OverrideFieldStruct) self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue) else: Value = SkuInfo.DefaultValue IsByteArray, ArrayList = ByteArrayForamt(Value) if Pcd.DatumType == 'BOOLEAN': -- 2.29.1.windows.1