]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fix the bug to parse the short varname in map file
authorYonghong Zhu <yonghong.zhu@intel.com>
Tue, 7 Feb 2017 08:05:13 +0000 (16:05 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Wed, 8 Feb 2017 05:36:03 +0000 (13:36 +0800)
current in the map file, there have two ways for var to save its offset,
if the varname is short, then the offset will in the same line with
varname, otherwise, it saved in the next line.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/Common/Misc.py

index 43d08183f7ebcba7bb935296f171aab087f2744b..1a5968a221654c725dfc8625931d429d471b98c0 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # Common routines used by all tools\r
 #\r
-# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -93,10 +93,16 @@ def _parseForGCC(lines, efifilepath, varnames):
             if m != None:\r
                 sections.append(m.groups(0))\r
             for varname in varnames:\r
-                m = re.match(".data.(%s)$" % varname, line)\r
+                Str = ''\r
+                m = re.match("^.data.(%s)" % varname, line)\r
                 if m != None:\r
-                    if lines[index + 1]:\r
-                        m = re.match('^([\da-fA-Fx]+) +([\da-fA-Fx]+)', lines[index + 1].strip())\r
+                    m = re.match(".data.(%s)$" % varname, line)\r
+                    if m != None:\r
+                        Str = lines[index + 1]\r
+                    else:\r
+                        Str = line[len(".data.%s" % varname):]\r
+                    if Str:\r
+                        m = re.match('^([\da-fA-Fx]+) +([\da-fA-Fx]+)', Str.strip())\r
                         if m != None:\r
                             varoffset.append((varname, int(m.groups(0)[0], 16) , int(sections[-1][1], 16), sections[-1][0]))\r
 \r