]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
BaseTools: Fix the bug to parse the new map file format
[mirror_edk2.git] / BaseTools / Source / Python / GenPatchPcdTable / GenPatchPcdTable.py
index f4fd51a256caefb65f4953184b6dde282d56a871..4452fac0406460556197a3c4aa6ec09cf213f41d 100644 (file)
@@ -66,7 +66,7 @@ def _parseForGCC(lines, efifilepath):
     imageBase = -1\r
     sections = []\r
     bpcds = []\r
     imageBase = -1\r
     sections = []\r
     bpcds = []\r
-    for line in lines:\r
+    for index, line in enumerate(lines):\r
         line = line.strip()\r
         # status machine transection\r
         if status == 0 and line == "Memory Configuration":\r
         line = line.strip()\r
         # status machine transection\r
         if status == 0 and line == "Memory Configuration":\r
@@ -80,14 +80,18 @@ def _parseForGCC(lines, efifilepath):
             continue\r
 \r
         # status handler\r
             continue\r
 \r
         # status handler\r
-        if status == 2:\r
+        if status == 3:\r
             m = re.match('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$', line)\r
             if m != None:\r
                 sections.append(m.groups(0))\r
             m = re.match('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$', line)\r
             if m != None:\r
                 sections.append(m.groups(0))\r
-        if status == 2:\r
-            m = re.match("^([\da-fA-Fx]+) +[_]+gPcd_BinaryPatch_([\w_\d]+)$", line)\r
+        if status == 3:\r
+            m = re.match('^.data._gPcd_BinaryPatch_([\w_\d]+)$', line)\r
             if m != None:\r
             if m != None:\r
-                bpcds.append((m.groups(0)[1], int(m.groups(0)[0], 16) , int(sections[-1][1], 16), sections[-1][0]))\r
+                if lines[index + 1]:\r
+                    PcdName = m.groups(0)[0]\r
+                    m = re.match('^([\da-fA-Fx]+) +([\da-fA-Fx]+)', lines[index + 1].strip())\r
+                    if m != None:\r
+                        bpcds.append((PcdName, int(m.groups(0)[0], 16) , int(sections[-1][1], 16), sections[-1][0]))\r
                 \r
     # get section information from efi file\r
     efisecs = PeImageClass(efifilepath).SectionHeaderList\r
                 \r
     # get section information from efi file\r
     efisecs = PeImageClass(efifilepath).SectionHeaderList\r