# This tool depends on DIA2Dump.exe (VS) or nm (gcc) to parse debug entry.\r
#\r
# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials are licensed and made available under\r
-# the terms and conditions of the BSD License that accompanies this distribution.\r
-# The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php.\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
#\r
##\r
\r
+from __future__ import print_function\r
import os\r
import re\r
import sys\r
try:\r
nmCommand = "nm"\r
nmLineOption = "-l"\r
- print "parsing (debug) - " + pdbName\r
+ print("parsing (debug) - " + pdbName)\r
os.system ('%s %s %s > nmDump.line.log' % (nmCommand, nmLineOption, pdbName))\r
except :\r
- print 'ERROR: nm command not available. Please verify PATH'\r
+ print('ERROR: nm command not available. Please verify PATH')\r
return\r
\r
#\r
DIA2DumpCommand = "Dia2Dump.exe"\r
#DIA2SymbolOption = "-p"\r
DIA2LinesOption = "-l"\r
- print "parsing (pdb) - " + pdbName\r
+ print("parsing (pdb) - " + pdbName)\r
#os.system ('%s %s %s > DIA2Dump.symbol.log' % (DIA2DumpCommand, DIA2SymbolOption, pdbName))\r
os.system ('%s %s %s > DIA2Dump.line.log' % (DIA2DumpCommand, DIA2LinesOption, pdbName))\r
except :\r
- print 'ERROR: DIA2Dump command not available. Please verify PATH'\r
+ print('ERROR: DIA2Dump command not available. Please verify PATH')\r
return\r
\r
#\r
try :\r
DOMTree = xml.dom.minidom.parse(Options.inputfilename)\r
except Exception:\r
- print "fail to open input " + Options.inputfilename\r
+ print("fail to open input " + Options.inputfilename)\r
return 1\r
\r
if Options.guidreffilename is not None:\r
try :\r
guidreffile = open(Options.guidreffilename)\r
except Exception:\r
- print "fail to open guidref" + Options.guidreffilename\r
+ print("fail to open guidref" + Options.guidreffilename)\r
return 1\r
genGuidString(guidreffile)\r
guidreffile.close()\r
\r
Handler = smiHandler.getElementsByTagName("Handler")\r
RVA = Handler[0].getElementsByTagName("RVA")\r
- print " Handler RVA: %s" % RVA[0].childNodes[0].data\r
+ print(" Handler RVA: %s" % RVA[0].childNodes[0].data)\r
\r
if (len(RVA)) >= 1:\r
rvaName = RVA[0].childNodes[0].data\r
\r
Caller = smiHandler.getElementsByTagName("Caller")\r
RVA = Caller[0].getElementsByTagName("RVA")\r
- print " Caller RVA: %s" % RVA[0].childNodes[0].data\r
+ print(" Caller RVA: %s" % RVA[0].childNodes[0].data)\r
\r
if (len(RVA)) >= 1:\r
rvaName = RVA[0].childNodes[0].data\r
try :\r
newfile = open(Options.outputfilename, "w")\r
except Exception:\r
- print "fail to open output" + Options.outputfilename\r
+ print("fail to open output" + Options.outputfilename)\r
return 1\r
\r
newfile.write(DOMTree.toprettyxml(indent = "\t", newl = "\n", encoding = "utf-8"))\r