From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7283781F81 for ; Tue, 7 Feb 2017 16:54:20 -0800 (PST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP; 07 Feb 2017 16:54:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,346,1477983600"; d="scan'208";a="63084936" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga006.fm.intel.com with ESMTP; 07 Feb 2017 16:54:20 -0800 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 7 Feb 2017 16:54:19 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 7 Feb 2017 16:54:19 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.132]) with mapi id 14.03.0248.002; Wed, 8 Feb 2017 08:54:17 +0800 From: "Gao, Liming" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch] BaseTools: Fix the bug to parse the short varname in map file Thread-Index: AQHSgT4SAGYIqu6D/EOdc6iJQErZXKFeSTKQ Date: Wed, 8 Feb 2017 00:54:16 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D6D79CF@shsmsx102.ccr.corp.intel.com> References: <1486470658-25476-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1486470658-25476-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTools: Fix the bug to parse the short varname in map file X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Feb 2017 00:54:20 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yong= hong Zhu Sent: Tuesday, February 7, 2017 8:31 PM To: edk2-devel@lists.01.org Cc: Gao, Liming Subject: [edk2] [Patch] BaseTools: Fix the bug to parse the short varname i= n map file 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 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Common/Misc.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index 43d0818..1a5968a 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1,9 +1,9 @@ ## @file # Common routines used by all tools # -# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BS= D License # which accompanies this distribution. The full text of the license may b= e found at # http://opensource.org/licenses/bsd-license.php # @@ -91,14 +91,20 @@ def _parseForGCC(lines, efifilepath, varnames): if status =3D=3D 3: m =3D re.match('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$',= line) if m !=3D None: sections.append(m.groups(0)) for varname in varnames: - m =3D re.match(".data.(%s)$" % varname, line) + Str =3D '' + m =3D re.match("^.data.(%s)" % varname, line) if m !=3D None: - if lines[index + 1]: - m =3D re.match('^([\da-fA-Fx]+) +([\da-fA-Fx]+)', = lines[index + 1].strip()) + m =3D re.match(".data.(%s)$" % varname, line) + if m !=3D None: + Str =3D lines[index + 1] + else: + Str =3D line[len(".data.%s" % varname):] + if Str: + m =3D re.match('^([\da-fA-Fx]+) +([\da-fA-Fx]+)', = Str.strip()) if m !=3D None: varoffset.append((varname, int(m.groups(0)[0],= 16) , int(sections[-1][1], 16), sections[-1][0])) =20 if not varoffset: return [] --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel