public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Liming" <liming.gao@intel.com>
To: "Zhu, Yonghong" <yonghong.zhu@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [Patch] BaseTools: Fix the bug to parse the short varname in map file
Date: Wed, 8 Feb 2017 00:54:16 +0000	[thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D6D79CF@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1486470658-25476-1-git-send-email-yonghong.zhu@intel.com>

Reviewed-by: Liming Gao <liming.gao@intel.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yonghong Zhu
Sent: Tuesday, February 7, 2017 8:31 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>
Subject: [edk2] [Patch] BaseTools: Fix the bug to parse the short varname in 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 <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 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/Python/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.<BR>
+# Copyright (c) 2007 - 2017, 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
 # http://opensource.org/licenses/bsd-license.php
 #
@@ -91,14 +91,20 @@ def _parseForGCC(lines, efifilepath, varnames):
         if status == 3:
             m = re.match('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$', line)
             if m != None:
                 sections.append(m.groups(0))
             for varname in varnames:
-                m = re.match(".data.(%s)$" % varname, line)
+                Str = ''
+                m = re.match("^.data.(%s)" % varname, line)
                 if m != None:
-                    if lines[index + 1]:
-                        m = re.match('^([\da-fA-Fx]+) +([\da-fA-Fx]+)', lines[index + 1].strip())
+                    m = re.match(".data.(%s)$" % varname, line)
+                    if m != None:
+                        Str = lines[index + 1]
+                    else:
+                        Str = line[len(".data.%s" % varname):]
+                    if Str:
+                        m = re.match('^([\da-fA-Fx]+) +([\da-fA-Fx]+)', Str.strip())
                         if m != None:
                             varoffset.append((varname, int(m.groups(0)[0], 16) , int(sections[-1][1], 16), sections[-1][0]))
 
     if not varoffset:
         return []
-- 
2.6.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


      reply	other threads:[~2017-02-08  0:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 12:30 [Patch] BaseTools: Fix the bug to parse the short varname in map file Yonghong Zhu
2017-02-08  0:54 ` Gao, Liming [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A89E2EF3DFEDB4C8BFDE51014F606A14D6D79CF@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox