summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen/StrGather.py
diff options
context:
space:
mode:
authorMax Knutsen <maknutse@microsoft.com>2019-07-16 17:26:55 +0800
committerLiming Gao <liming.gao@intel.com>2019-08-01 15:36:48 +0800
commit307e1650be267b67db7be1089e0979ace460d830 (patch)
tree5c7d2a53371f84c079de722389dccbba90442c8d /BaseTools/Source/Python/AutoGen/StrGather.py
parent76912197fabec2603f6c206f087a84265f451b32 (diff)
downloadedk2-307e1650be267b67db7be1089e0979ace460d830.tar.gz
edk2-307e1650be267b67db7be1089e0979ace460d830.tar.bz2
edk2-307e1650be267b67db7be1089e0979ace460d830.zip
BaseTools:Add extra debugging message
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2014 Add extra debugging to improve error identification. Error while processing file if the file is read incorrectly This patch is going to fix that issue. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/StrGather.py')
-rw-r--r--BaseTools/Source/Python/AutoGen/StrGather.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/BaseTools/Source/Python/AutoGen/StrGather.py b/BaseTools/Source/Python/AutoGen/StrGather.py
index 2e4671a433..eed30388be 100644
--- a/BaseTools/Source/Python/AutoGen/StrGather.py
+++ b/BaseTools/Source/Python/AutoGen/StrGather.py
@@ -526,12 +526,16 @@ def SearchString(UniObjectClass, FileList, IsCompatibleMode):
return UniObjectClass
for File in FileList:
- if os.path.isfile(File):
- Lines = open(File, 'r')
- for Line in Lines:
- for StrName in STRING_TOKEN.findall(Line):
- EdkLogger.debug(EdkLogger.DEBUG_5, "Found string identifier: " + StrName)
- UniObjectClass.SetStringReferenced(StrName)
+ try:
+ if os.path.isfile(File):
+ Lines = open(File, 'r')
+ for Line in Lines:
+ for StrName in STRING_TOKEN.findall(Line):
+ EdkLogger.debug(EdkLogger.DEBUG_5, "Found string identifier: " + StrName)
+ UniObjectClass.SetStringReferenced(StrName)
+ except:
+ EdkLogger.error("UnicodeStringGather", AUTOGEN_ERROR, "SearchString: Error while processing file", File=File, RaiseError=False)
+ raise
UniObjectClass.ReToken()