BaseTools: make build report tolerant of FVs specified by name

Check if the FV name is in the FV dictionary before using it which fixes 
a crash during build report generation when FVs are specified by path in 
the FDF.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen <eugene@hp.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19705 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Eugene Cohen 2016-01-21 09:10:55 +00:00 committed by yzhu52
parent 61f816bd75
commit a243297253
1 changed files with 38 additions and 34 deletions

View File

@ -4,7 +4,7 @@
# This module contains the functionality to generate build report after # This module contains the functionality to generate build report after
# build all target completes successfully. # build all target completes successfully.
# #
# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -1175,18 +1175,20 @@ class FdRegionReport(object):
# @param Wa Workspace context information # @param Wa Workspace context information
# #
def _DiscoverNestedFvList(self, FvName, Wa): def _DiscoverNestedFvList(self, FvName, Wa):
for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList: FvDictKey=FvName.upper()
for Section in Ffs.SectionList: if FvDictKey in Wa.FdfProfile.FvDict:
try: for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList:
for FvSection in Section.SectionList: for Section in Ffs.SectionList:
if FvSection.FvName in self.FvList: try:
continue for FvSection in Section.SectionList:
self._GuidsDb[Ffs.NameGuid.upper()] = FvSection.FvName if FvSection.FvName in self.FvList:
self.FvList.append(FvSection.FvName) continue
self.FvInfo[FvSection.FvName] = ("Nested FV", 0, 0) self._GuidsDb[Ffs.NameGuid.upper()] = FvSection.FvName
self._DiscoverNestedFvList(FvSection.FvName, Wa) self.FvList.append(FvSection.FvName)
except AttributeError: self.FvInfo[FvSection.FvName] = ("Nested FV", 0, 0)
pass self._DiscoverNestedFvList(FvSection.FvName, Wa)
except AttributeError:
pass
## ##
# Constructor function for class FdRegionReport # Constructor function for class FdRegionReport
@ -1264,27 +1266,29 @@ class FdRegionReport(object):
# Collect the GUID map in the FV firmware volume # Collect the GUID map in the FV firmware volume
# #
for FvName in self.FvList: for FvName in self.FvList:
for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList: FvDictKey=FvName.upper()
try: if FvDictKey in Wa.FdfProfile.FvDict:
# for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList:
# collect GUID map for binary EFI file in FDF file. try:
# #
Guid = Ffs.NameGuid.upper() # collect GUID map for binary EFI file in FDF file.
Match = gPcdGuidPattern.match(Ffs.NameGuid) #
if Match: Guid = Ffs.NameGuid.upper()
PcdTokenspace = Match.group(1) Match = gPcdGuidPattern.match(Ffs.NameGuid)
PcdToken = Match.group(2) if Match:
if (PcdToken, PcdTokenspace) in PlatformPcds: PcdTokenspace = Match.group(1)
GuidValue = PlatformPcds[(PcdToken, PcdTokenspace)] PcdToken = Match.group(2)
Guid = GuidStructureByteArrayToGuidString(GuidValue).upper() if (PcdToken, PcdTokenspace) in PlatformPcds:
for Section in Ffs.SectionList: GuidValue = PlatformPcds[(PcdToken, PcdTokenspace)]
try: Guid = GuidStructureByteArrayToGuidString(GuidValue).upper()
ModuleSectFile = mws.join(Wa.WorkspaceDir, Section.SectFileName) for Section in Ffs.SectionList:
self._GuidsDb[Guid] = ModuleSectFile try:
except AttributeError: ModuleSectFile = mws.join(Wa.WorkspaceDir, Section.SectFileName)
pass self._GuidsDb[Guid] = ModuleSectFile
except AttributeError: except AttributeError:
pass pass
except AttributeError:
pass
## ##