Revision: 19705
          http://sourceforge.net/p/edk2/code/19705
Author:   yzhu52
Date:     2016-01-21 09:10:55 +0000 (Thu, 21 Jan 2016)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Yonghong Zhu <[email protected]>

Modified Paths:
--------------
    trunk/edk2/BaseTools/Source/Python/build/BuildReport.py

Modified: trunk/edk2/BaseTools/Source/Python/build/BuildReport.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/build/BuildReport.py     2016-01-21 
07:11:59 UTC (rev 19704)
+++ trunk/edk2/BaseTools/Source/Python/build/BuildReport.py     2016-01-21 
09:10:55 UTC (rev 19705)
@@ -4,7 +4,7 @@
 # This module contains the functionality to generate build report after
 # 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
 # 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
@@ -1175,18 +1175,20 @@
     # @param Wa              Workspace context information
     #
     def _DiscoverNestedFvList(self, FvName, Wa):
-        for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList:
-            for Section in Ffs.SectionList:
-                try:
-                    for FvSection in Section.SectionList:
-                        if FvSection.FvName in self.FvList:
-                            continue
-                        self._GuidsDb[Ffs.NameGuid.upper()] = FvSection.FvName
-                        self.FvList.append(FvSection.FvName)
-                        self.FvInfo[FvSection.FvName] = ("Nested FV", 0, 0)
-                        self._DiscoverNestedFvList(FvSection.FvName, Wa)
-                except AttributeError:
-                    pass
+        FvDictKey=FvName.upper()
+        if FvDictKey in Wa.FdfProfile.FvDict:
+            for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList:
+                for Section in Ffs.SectionList:
+                    try:
+                        for FvSection in Section.SectionList:
+                            if FvSection.FvName in self.FvList:
+                                continue
+                            self._GuidsDb[Ffs.NameGuid.upper()] = 
FvSection.FvName
+                            self.FvList.append(FvSection.FvName)
+                            self.FvInfo[FvSection.FvName] = ("Nested FV", 0, 0)
+                            self._DiscoverNestedFvList(FvSection.FvName, Wa)
+                    except AttributeError:
+                        pass
 
     ##
     # Constructor function for class FdRegionReport
@@ -1264,27 +1266,29 @@
         # Collect the GUID map in the FV firmware volume
         #
         for FvName in self.FvList:
-            for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList:
-                try:
-                    #
-                    # collect GUID map for binary EFI file in FDF file.
-                    #
-                    Guid = Ffs.NameGuid.upper()
-                    Match = gPcdGuidPattern.match(Ffs.NameGuid)
-                    if Match:
-                        PcdTokenspace = Match.group(1)
-                        PcdToken = Match.group(2)
-                        if (PcdToken, PcdTokenspace) in PlatformPcds:
-                            GuidValue = PlatformPcds[(PcdToken, PcdTokenspace)]
-                            Guid = 
GuidStructureByteArrayToGuidString(GuidValue).upper()
-                    for Section in Ffs.SectionList:
-                        try:
-                            ModuleSectFile = mws.join(Wa.WorkspaceDir, 
Section.SectFileName)
-                            self._GuidsDb[Guid] = ModuleSectFile
-                        except AttributeError:
-                            pass
-                except AttributeError:
-                    pass
+            FvDictKey=FvName.upper()
+            if FvDictKey in Wa.FdfProfile.FvDict:
+                for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList:
+                    try:
+                        #
+                        # collect GUID map for binary EFI file in FDF file.
+                        #
+                        Guid = Ffs.NameGuid.upper()
+                        Match = gPcdGuidPattern.match(Ffs.NameGuid)
+                        if Match:
+                            PcdTokenspace = Match.group(1)
+                            PcdToken = Match.group(2)
+                            if (PcdToken, PcdTokenspace) in PlatformPcds:
+                                GuidValue = PlatformPcds[(PcdToken, 
PcdTokenspace)]
+                                Guid = 
GuidStructureByteArrayToGuidString(GuidValue).upper()
+                        for Section in Ffs.SectionList:
+                            try:
+                                ModuleSectFile = mws.join(Wa.WorkspaceDir, 
Section.SectFileName)
+                                self._GuidsDb[Guid] = ModuleSectFile
+                            except AttributeError:
+                                pass
+                    except AttributeError:
+                        pass
 
 
     ##


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to